PWM control with encoder regulation

This may sound crazy, but are there any chips available that will regulate a pwm output based on dc motor encoder input?

For example, the chip would have encoder inputs, a desired speed input (0-5V), and a pwm output.

So, basically, I select a speed 0-5V (or even input a pwm signal instead) and based on the encoder feedback, the chip increases or decreases the output pwm signal in order to adjust the dc motor speed.

Buying a chip (or a motor driver board with this ability) could save me alot of time developing the PID control and circuitry to do this myself.

I doubt a motor driver board exists that will do this and meet my specs (24VDC, 20A continuous, 20kHz), but if there is a possibility, I will also consider this.

If anyone has some info on where to even look for something like this, I would really appreciate it.

Reply to
Andrew
Loading thread data ...

This may sound crazy, but are there any chips available that will regulate a pwm output based on dc motor encoder input?

For example, the chip would have encoder inputs, a desired speed input (0-5V), and a pwm output.

So, basically, I select a speed 0-5V (or even input a pwm signal instead) and based on the encoder feedback, the chip increases or decreases the output pwm signal in order to adjust the dc motor speed.

Buying a chip (or a motor driver board with this ability) could save me alot of time developing the PID control and circuitry to do this myself.

I doubt a motor driver board exists that will do this and meet my specs (24VDC, 20A continuous, 20kHz), but if there is a possibility, I will also consider this.

If anyone has some info on where to even look for something like this, I would really appreciate it.

Reply to
Andrew

Martin's suggestion of a motion control chip is good. If you can't find a motion control chip that'll do this it's dead easy with a PIC, AVR,

8051, etc. In fact you could do this with a CPLD, possibly easier than you could with a processor.

Get an AVR (my favorite) with an ADC and possibly a PWM generator (or with SPI if you were going to develop that 0-5V from an ADC). If the encoder is slow enough that you can keep up with it in software you won't need a separate encoder input, but make sure this is possible before doing your board!

For the PID, read

formatting link
Even with a motion controller chip you'd still have to tune the thing, so the only thing you're saving with a motion control chip is a few lines of code.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply to
Tim Wescott

Thanks for the quick help guys.

Just to clarify, this doesn't need to be a precise application - at all. If the speed is within 20% that is fine. Repeatability is more important, that is, if it is 20% off, I need it to be within, say, 5% of being 20% off every time (if that makes sense).

Secondly, I already have a PWM signal available that I can control (or filter to a rough DAC to input to a chip). I said the 0-5V speed input because I figured it to be more likely that a chip would have an analog input of 0-5V than have a filter on board for the PWM signal already, and I could just filter it myself.

Hopefully I'm not way off base, but the reason I am even doing this at all (using feedback) is to allow the motor to have more torque as very low speeds (low speed = low voltage = less torque). I am hoping (and almost certain) that this type of feedback control will effectively increase voltage (by increasing pwm) such that the motor will receive enough voltage to suit my torque needs under a variety of speeds including very slow. At very slow speeds with a large load, the speed would slow down to the point of "stalling," where a small increase in voltage (pwm signal decided by PID and the chip I need) could increase the voltage just enough to spin at the speed I desire. The problem now is that at 50% + there is enough torque, but as the duty cycle gets lower, there is much less torque output.

Reply to
Andrew

Can your motor ever, EVER, go in reverse? If so then the advise you've seen elsewhere to not bother with quadrature decoding goes out the window. In fact, if the motor should happen to stop right on an encoder transition you could have dithering from it going back and forth which a quadrature decoder would track just fine, but which a mere counter would have severe problems.

You are correct in wanting an active controller for this. If you want to drive it down into the region where it'll stall due to friction you also want to read

formatting link
AFAIK most motor controllers provide some mechanism for implementing this sort of thing, although it may be hidden, described in different language, or not be intended by the controller designer.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply to
Tim Wescott

Thanks for the quick help guys.

Just to clarify, this doesn't need to be a precise application - at all. If the speed is within 20% that is fine. Repeatability is more important, that is, if it is 20% off, I need it to be within, say, 5% of being 20% off every time (if that makes sense).

Secondly, I already have a PWM signal available that I can control (or filter to a rough DAC to input to a chip). I said the 0-5V speed input because I figured it to be more likely that a chip would have an analog input of 0-5V than have a filter on board for the PWM signal already, and I could just filter it myself.

Hopefully I'm not way off base, but the reason I am even doing this at all (using feedback) is to allow the motor to have more torque as very low speeds (low speed = low voltage = less torque). I am hoping (and almost certain) that this type of feedback control will effectively increase voltage (by increasing pwm) such that the motor will receive enough voltage to suit my torque needs under a variety of speeds including very slow. At very slow speeds with a large load, the speed would slow down to the point of "stalling," where a small increase in voltage (pwm signal decided by PID and the chip I need) could increase the voltage just enough to spin at the speed I desire. The problem now is that at 50% + there is enough torque, but as the duty cycle gets lower, there is much less torque output.

Reply to
Andrew

Yes it can go in reverse.

The geckodrive 320 actually looks awesome!

As long as I can use the PWM input into the STEP input on the unit (or at least my PWM input filtered), this should be awesome.

Also, on this gecko unit, do I NEED to use 4 encoder inputs? I have not settled on an encoder yet, but it would be easier to only need to use one line of the encoder input, rather than 4 like the gecko has inputs for. Do I need all 4?

Reply to
Andrew

If it can go in reverse you need to look at both channels of the quadrature signal from the encoder -- just one channel will tell you speed but not direction, and in perverse situations it can tell you the thing is moving when it's really at rest.

I don't know why the gecko has 4 wires but I suspect it's for separate ground and signal for each channel, or it's for power, ground, channel A and channel B. At any rate you have to understand what the thing is supposed to do for you.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply to
Tim Wescott

All this stuff exists of course. Look at the G320 from

formatting link
It almost does what you want. All you need to do is connect the G320's 'step' input to a VCO output (a 4046 for example) that you can control with your 0-5V input.

I'm in no way affiliated with Geckodrive except by being a satisfied customer. I only know their G320, and they work like a charm on a VERY broad range of motors.

robert

Reply to
Robert Latest

He doesn't need true quadrature decoding.

robert

Reply to
Robert Latest

google motion control IC

martin

Reply to
martin griffith

I was going to suggest the HCTL2000 breed, but that is very long in the tooth. I rembember that somebody did a clone about 10 years ago, but thats a long time ago

martin

Reply to
martin griffith

On Fri, 07 Oct 2005 10:24:51 -0700, Andrew wrote: ...

Don't drive it with voltage. Drive it with current. I made a PWM controller a couple of years ago, where I pulsed a bog-standard TIP36C current sink, and I got full torque all the way down to almost 0 RPM. That's what PWM is _for_! :-)

Good Luck! Rich

Reply to
Rich Grise

Well, yes, of course. The PWM drive comes out of the controller, which compares the current speed to the desired speed, and adjusts the next PWM pulse's duty cycle as needed.

Heck, even I can do a feedback loop! (Of course, I need somebody smarter than me[1] to work out the compensation network. ;-) )

Cheers! Rich

  1. Smarter than me are? ;-) Maybe just better-edjamacayted. ;-)
Reply to
Rich Grise

The "step" input only commands the controller to advance the motor by one transition of the encoder wheel. So the motor speed is exactly proportional to the frequency pulses applied to the STEP input. If all you have is a PWM output you must filter that to a DC voltage, feed it into a VCO and use the VCO's output to drive the step input of the controller (drive)

The geckodrive has 4 inputs: A and B from the quadrature encoder from the motor (providing position feedback), one for "step" and one for "direction".

Yes, you need all four. The drive cannot function without the quadrature encoder properly connected, and of course you need the step input to make the drive move at all. If you don't ever want to change direction, you just tie the "direction" input to 5V or ground.

In your original post you mentioned that you have "encoder feedback", so I took that as given. If you don't have a quadrature encoder on your motor you can't use the G320, or any other servo motor controller for that matter. On the other hand you need a quadrature encoder for your application if you need a "rock hard" motor control at low speeds.

You can download the user manual from the geckodrive web site and find all your questions answered there.

robert

Reply to
Robert Latest

But he needs feedback. He can't just put his PWM signal into a power bridge for his application.

robert

Reply to
Robert Latest

Right. Except that from his description I gathered that he didn't want to add feedback to his existing PWM application but that he wanted to use that PWM signal to program the RPM for his motor.

PWM --> low pass --> VCO --> servo drive --> PWM --> motor ^ | +---encoder fb ------+

He'd also have to add a one-shot (re)triggered my his primary PWM to gate the VCO output pulses in order to be able to make his motor come to a full stop.

Head too clear ---> smoke more.

Something like that? ;-)

robert

Reply to
Robert Latest

The whole purpose of adding feedback at all was to gain low RPM torque. I didn't want to have to add any feedback, as the exact rpm isn't necessary at all, the feedback will simply be used to increase voltage to the motor when it is stalled at low voltage (low rpms) because of high load. I'm thinking of it like this (and correct me if I'm wrong):

-You have a 24V motor.

-You want to operate at 2.4V because it is evquivalent to the speed you desire (say, 10rpm)

-When operated with normal PWM control at 10% duty cycle, to get 2.4V (average), the motor stalls because the load is too high

--Note that at full 24V (or even lower, lets say, 12V and up) the motor IS capable of turning the load.

-In order to turn the given load at a speed that is equivalent to 2.4V, the voltage (duty cycle) may need to be more like, say, 5V (21%).

-I need the motor driver / circuitry to be able to sense that the motor is stalled (via encoder), and increase the voltage such that the motor begins to spin at the rpm it would under no load.

-For example, at no load, 2.4V, 10% duty cycle, no feedback, the motor spins at 10rpm. When loaded, it spins at 0rpm, BUT, with the feedback, it should increase the voltage until the motor spins at 10rpm!

I hope that this helps to clarify my situation.

I'm not quite sure what you mean by "drive it with current," in that I'm not sure how to do it, but it sounds interesting, because that is essentially what I'm trying to do with the feedback. In order to "drive it with current," though, this requires changing the voltage based on some feedback, which, in my case, will be the encoder feedback...

So the "step" is a variable frequency input, is that the idea? I mean, a regular PWM set frequency, variable duty cycle input would NOT work, as well as a DAC voltage would NOT work?

How do I know what frequency tranlates to the full 24V, max speed? Actually calculate it? I'm not sure I know how to calculate which frequency on the VCO would be good? Unless it is as easy as calculating how many encoder "ticks" there are per revolution, then determine how many rpms you want, and make the frequency equal to number of ticks? Will I have to determine the VCO frequencies based on these factors? Is a VCO variable FREQUENCY based on voltage?

Would you mind suggesting some applicable VCOs? I have never actually used one.

Thanks guys.

Reply to
Andrew

I did find the TI CD74HCT4046A VCO chip. Seems to do pretty much what I need.

Based on the gecko data sheet, the "step pulse frequency" should be 0 to 250kHz, which to me, also equates to the encoder signal frequency.

My motor is operating at 8000rpm, and the encoder that I currently have is 500 CPT (counts per turn), meaning that the encoder frequency is [(8000/60) * 500] =~ 66.67kHz.

So, if I understand this properly, running the VCO at 66.67kHz should run the motor at 8000rpm (full speed). Running the VCO at 33kHz is about 4000rpm (half speed) and so on.

Is this correct? Will the CD74HCT4046A be a good chip for this, or are there some things I am failing to notice?

Reply to
Andrew

If you try to phase lock a 500 count/turn motor with a 4046 you'll be disappointed -- you won't be able to maintain lock, so your fancy phase detector will end up being a high/low frequency detector.

You should also double check -- 'counts per turn' is usually 4 times the number of lines on the encoder. If you're just using one channel of the encoder to tell speed you want to pay attention to the fact that it's

125 lines per turn, or 125 cycles of the square wave per turn.
--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply to
Tim Wescott

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.