Let's Make Robots!

Ideas for motor speed control

I have an idea of how to do a electronic speed control for some DC motor (H-bridges).
I built this circuit and it works pretty well.  Its a PWM generator based on this great tutorial .  I had to convert it to a NE556 instead of a NE555 but it works well with a 100K linear pot..

speed_controller1.jpg

So, the Pot is mechanical ! - I wanted the bot to be able to control its own speed, not manually set it.  So, I came up with this - its a 12 bit binary counter (only using 6 bits), which should give me 64 speed settings. (specs)

 

speed_controller2.jpg

PRO
1. I have the mc14040B on hand and I hate waiting for mail
2. 64 seems like a decent number of speed settings
3. 1 chip 6 resistors and 6 npn bipolar transistors does not seem like a huge number of components
4. stopping would be as simple as hitting the reset line
5. incrementing the speed would be just sending another clock pulse to the mc14040b

CON
1. In order to decrement the speed I would need to reset the whole chip and "quickly" increment to a lower speed (seems sloppy)
2. I have a feeling that this could be done with fewer components.


I'm going to build it anyway and will keep this post updated - (if anyone is interested), but since there are so many great "techies" out there - some could tell me "ha ha GroG - my granny used to build that circuit with vacume tubes, now its a single solid state speed control package ZX115 ! "

 

UPDATE 20081007

 Well it all went together pretty smoothly.  I had a little trouble remembering on how to interface with other subchannels of the dio. But, luckly I mapped the hole thing out here .

 The circuit currently has 330 Ohm resistor for all the bridges - but I will change this to Rik's suggestion of R/2 setup where each resistor is half its neighbor.  This should allow for a binary step through a full 64 different speed values.  Since I did not have the full resistor set the different values I can get with a 330 are as follows:

dio line - ohms
d0 - 330
d1 - 165
d2 - 110
d3 - 82.5
d4 - 66
d5 - 55

 

DSCI0011_0.jpg

Yeah I know its messy - but it's a prototype :P

Circuit Diagram

 speed_controller6.jpg

 

I did not reach 100% duty cycle - but I think I should be able to get it when I have lower resistor values.

 

Here are some of the results:

d0 high - 330 ohms

DSCI0024.jpg

d0 & d1 high 165 ohms

DSCI0023_0.jpg

all on 55 ohms

DSCI0019.jpg

 

TODO:

1. find other resistor values beside 330 so I can get 100% duty cycle when all inputs are high
2. connect the input to one of the large drive motors on loki
3. work on the web interface motor module to accept a speed value

 

UPDATE 20081008

 DRAT DRAT DRAT DRAT DRAT !   I connected the large motors to the speed controller and all was working fairly well.  With 7 speed control positions using 6 x 330 ohm resistors. When all the DIO ports were off there was still an irratating noise of the PWM.  I wanted to see if I could turn this off completely.  Unfortunately, I continued to experiment with the large motors - when I was going through a sequence of turning 100% duty cycle off, the H-bridge fried.  And it looks like this time it took the computer with it.  Yes, I know I should have them completely electrically isolated with opto-couplers,  but I wanted to have the computers battery charged by the wheelchair charger.  It was my intention to have a relay in the system which would connect the two power systems together only when charging... but now I will suffer for charging ahead.. DRAT!  I have not yet assesed all the damage, the computer does not boot, I'm hoping i can re-initialize the bios - or at the least the CPU or memory is still good.  Did is say DRAT?

 

Nuke.jpg

 

Lessons Learned

1. ISOLATE THE CONTROL ELECTRONICS FROM THE POWER SYSTEM (EXPECIALLY HIGH CURRENT SYSTEMS)
DUH ! I know this - now I should actually DO IT !  I'll probably be using the DIO card (if its not fried too) and this will be a bit of a pain to create 96 opto couplers for it - but I'll do it to save the computer.

2. The H-bridges I'm using I believe are not heavy duty enough - they are supposed to have current protection - but I think they are a bit underbuilt for the wheelchair - I will be looking into options of geting or building a larger H-bridge that can handle 80 amps -  the spike of dropping the speed from 100% down to a lower value seems to be frying it.

 Crap, back to the drawing board. :P

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Good catch Rik!

Thanks, the problem was the diagram - the actual circuit has it connected to V+ correctly.  I'll update the diagram and post it here for reference, a little later.

Workin on passive parallax webcam ranging - it's going quite well at the moment ... can't stop :)

Grog,

There appears to be a discrepancy between your circuit above and the one in the great tutorial from dprg. Today I tried to draw a 555-based pwm generator in Eagle and I discovered that you did not pull up the discharge port (pin 13 in your case). The 10k resistor is "supposed to be" connected with V+.

I have no idea how this affects the circuit.

8ik

lool :P

Yeah - I first looked at the OMSCs - but i thought i could squeek by with the simple-H's,  I have a tendency to buy cheap and pay for it later.

Ha ha ha...  good point - maybe i'll come around when I stop laughing/crying

That's not fun frying stuff, but like you say, you do learn. I just noticed the "wheelchair" thing. If driving those kind a motors, you may be looking at these h-bridges instead of the ones you got. I've been wanting to try out those Simple-H ones on a smaller bot, but haven't gotten that far yet.

Did I mention that micros are a lot cheaper to fry? (running and ducking)

Thanks Rik,

Oh well , if your not breaking anything - your not learning :P   I'll probably not have alot of updates now, but maybe a better understanding of it all in a couple weeks.  Thanks for you help & interest.

over and out for now,

GroG

Sorry to read about your smoke. I sympathize.

8-(

Nice scope pictures! (is that a ripple on your screen ;-)

For 100% duty cycle, you would need a 0 Ohm resistor, I suppose. Maybe you can find one in the kitchen drawer.

Also: I am not sure (d0 AND d1) would combine into a resistance of 165 Ohm. More like 1/(1/330 + 1/165) = 110 Ohm. I think that's why R/R2 ladders do not use series of halving values, but a combination of values in series and values in parallel. But the usual disclaimer remains: I just sucked in the knowledge of wikipedia and gave it a twist of my own.

Nice work still on the experimental setup! Keep it coming!

8ik

hi Rik!

yeah - the pictures aren't that great - (trying to find out how to use this cheap digital camera) - anyway, the top level of each picture is 5V the bottom 0V. With that in mind, you can see that there is a change with a higher percentage of the line in the 5V level depending on how many DIO lines are set high.

heh, yeah i think i can manage a 0 ohm resistor, i use them more often than i should (too many unintentional shorts) :P

At the moment ALL the resistors are 330 so (d0 and d1) combine to be 1/(1/330 + 1/330) =  165 ohm

I think i now understand a little more about the R/R2 ladders - one purpose being cheap and easy in that they only require 2 resistor values.  I have several different resistors, so I'll probably use several different values instead of creating the r2 bridge.  I think that different motor characteristics will required different  effective values, for example the motor i am testing with now does not actually move until d0 d1 & d2 are on...

Since the large motors are more important to me - this will be my next focus...

I'll keep you posted.

GroG

Just to be sure: I was not knocking your equipment. I envy the scope. The ripple was a dig at your nipple comment earlier.

[note to self: more emoticons you stupid]

8-)

About those resistor values: I get it now. I was under the false impression that you improvised a series of values. Never understood the weird values in that series until now. 

What was not clear from your update is that the machine is now depending on the number of DIO lines set high at the same time. Not on which ones. Reducing your resolution to 1+6=7 distinct values, rather than 2^6=64 values.

Good plan to customize your resistor values to something you actually need. There is no need for fine resolution between 0 and , say, 15% when the motors will not respond to any of those values. The same might be true for the 85%-100% range.

Did you notice on the scope that your cycle length (period) gets longer as you decrease the resistance over your "digital pot"? That is probably a result from your design which does not control the "complement value" in you analogue pot R1. That one is still fixed (at 100k?).