12v led acid - motors and arduino

Hi Forum,

I am working on a project, where I will be driving an arduino based vehicle. It will on-board have a sealed lead acid battery (12v, 4Ah), and two motors (High Torque 80RPM 12V DC Geared Motor - Silver - Free shipping - DealExtreme).
These motors will be controlled via an H-bridge (http://arduino.cc/documents/datasheets/L293D.pdf).

I have tested the motors, and they appear to have plenty of power to run everything, at least for the few seconds I was able to run it (untill the wheels broke off due to the torque).

My first question is: Do I need a capacitor anywhere in my circuit, protecting from noise from the motors? My guess would be that the on-board voltage converter of the arduino can compensate?
I understand the risk of heat on the regulator if I draw a lot of power through the Arduino - but with one IR led, one IR receiver and the H-bridge I would assume this not to be an issue.

Another thing - right now I have both motors hooked up to the same "channel" on the bridge - apparantly able to handle 600mA according to the datasheet. I do not know how much current my motors draw (have been unable to locate my voltmeter), but does it sound reasonable to have both on the same channel, or would you put each on their own channel? They will always both be at the same speed/same direction.
Could you imagine them drawing more than the 600mA - and if so, how would you handle such a situation?

Thank you in advance for any advice you may have.
Casper

untill the wheels broke off due to the torque

Your first question should really be, "how do I stop that happening?" :smiley:

JimboZA:

untill the wheels broke off due to the torque

Your first question should really be, "how do I stop that happening?" :smiley:

Hehe, good point indeed :slight_smile: Have had a LOT of those types of problems - not just the wheels breaking off, but also the "gears" I have glued to the shaft of the motors no longer holding on (so that it slips without pulling the wheels).
I guess I need better glue - gluing plastic to metal and wood to metal is no easy task :stuck_out_tongue: But one thing at a time :slight_smile:

Hotcut:
My first question is: Do I need a capacitor anywhere in my circuit, protecting from noise from the motors? My guess would be that the on-board voltage converter of the arduino can compensate?

Put a non-polarized ceramic disc capacitor - around 0.1 uF - across the motor leads, right at the base of the motor, like this:

Hotcut:
I understand the risk of heat on the regulator if I draw a lot of power through the Arduino - but with one IR led, one IR receiver and the H-bridge I would assume this not to be an issue.

Why do you assume that? The regulator on the Arduino can only give you about 500 mA of current; the ATMega328 can (in theory) consume up to 200 mA of that - that doesn't leave a lot left for everything else. If the regulator had proper heat sinking, it could probably go up a bit higher. It might be ok, but it might be best to employ a seperate regulator for your other parts, just to give you more headroom (especially if you intend on expanding in the future). A 7805 regulator project is fairly easy to build, and is something you should become knowledgeable in doing.

Hotcut:
Another thing - right now I have both motors hooked up to the same "channel" on the bridge - apparantly able to handle 600mA according to the datasheet.

Yes - it can - but do you know the stall current of the motors? The specs shown at DX for those motors don't say anything specific about the current draw - just that they draw 0.05 amps; I can only assume this is the no-load running current (at what voltage, though?). The loaded current can be much greater than this, and will change depending on the voltage as well. The stalled current can be much, much higher. Guess what current a motor will draw (for a brief instant) when voltage is first applied? That's the current level you need to know in order to properly select an h-bridge driver.

Hotcut:
I do not know how much current my motors draw (have been unable to locate my voltmeter), but does it sound reasonable to have both on the same channel, or would you put each on their own channel?

That will depend on how much current they draw - so you'd better find your multimeter and measure the current draw.

To do so, carefully remove the motor from the gearbox - you should be able to remove those screws from the front of the gearbox and remove the motor; be careful because I don't know how the gearbox is constructed - whether it is "open-backed" or not - don't let gears fall out (handle it with the output shaft facing down to prevent this). There will probably be a bunch of grease in the gearbox and on the end of the pinion on the motor; when you get the motor removed, wipe this grease off (if you can do it cleanly, and save the majority for re-assembly - that's best).

Then hook your meter to the terminals and set the meter for resistance measurement. Slowly rotate the motor's shaft with your fingertips and note the resistance readings. Get several readings, rotating the shaft completely, then take an average of the readings. Divide the voltage you plan to use by the number of ohms to get your current (Ohm's law - I = V/R). That will be the stall current.

Alternatively (though not really recommended), you could hook up the leads to the multimeter to measure current (put it on the 10A setting) - putting the meter in series with the motor. Mount the motor in such a way so that the shaft cannot be turned (don't use your fingers for this - if the motor has enough torque, the pinion will tear your fingers up), and while watching the meter, briefly apply your intended voltage to the motor, and note the reading (do not leave the motor connected for longer than a half-second, if that - you'll burn out the motor). This is called a "pony-brake" test; it isn't really the best method because of the stress it puts on the motor, but it does work.

If 2x your current measurement is under 600 mA - it should be fine (it should be noted that, on the L293, the 600 mA rating is only valid if there is a heatsink on the IC; heat is conducted from the IC via the central ground pins and the top of the chip - finding proper heatsinks for the DIP version of the chip is not easy nowadays).

Hotcut:
Could you imagine them drawing more than the 600mA - and if so, how would you handle such a situation?

There are numerous ways to handle such a situation - the simplest (but most wasteful) method is to bleed the current off using a resistor; put a resistor in series with the motor to act as a current limiter (google "current limiting resister for motors" or similar) - basically it will be a low-ohm, high-wattage resistor used - and you'd need to calculate everything.

A better way would be to monitor the current used by the motor; if you can get a very low-ohm resistor (like a thick piece of wire - look up "homebrew shunt resistor" for details), you can measure the voltage drop across it using the Arduino's analog input - with the knowledge of the voltage being used and the resistance, you can calculate (in the code) the amount of current being used, and if it goes beyond a certain amount - turn off the motor.

As it stands, though, the L293 already has a "thermal overload" facility ("overtemperature protection" in the datasheet) - even so, you should still try to avoid that scenario.

If you find that the stall current of your motors is too high, go with a different h-bridge; there are tons out there (many much better than the L293 and L298).

I guess I need better glue

Epoxy resin. I use it in many of my smaller projects. Kicks other 'glues' a@*#. It can be a pain mixing it every time you need it, but it is worth it. I built an RC submarine hull out of it, with fiberglass strips. Rock solid!

Hi,

Wow, what a detailed response cr0sh!

Put a non-polarized ceramic disc capacitor - around 0.1 uF - across the motor leads, right at the base of the motor, like this:

I don't have any of those at home, so will have to order. Would this set be a good pick so that I have some for various projects? http://dx.com/p/10pf-50v-leaded-multilayer-ceramic-capacitor-yellow-210-piece-pack-133612#.Ut4nPPSKZhM

It might be ok, but it might be best to employ a seperate regulator for your other parts, just to give you more headroom

Good point - I have some 5v regulators - at the very leasy I can have that separate from the Arduino, so it is only this I fry if I pull too much current through the system. I assume the heat sink I need is minimal - just a few square cm of some kind of metal, a few mm thick? Will have to see if I can make something, or find somewhere to buy something.

you'd better find your multimeter and measure the current draw.

I was fearing that was the case :wink: I will purchase an additional motor, so I have that to test with, in case I break something. And see to locate my meter.
From there I will see what to do - if we are talking a different H-bridge or something else.

If you find that the stall current of your motors is too high, go with a different h-bridge; there are tons out there (many much better than the L293 and L298).

What general purpose H-bridge for small-ish projects like this could you recommend? (if such a thing even exists) Just so I could order some good once to have on stock at home for future projects.

you can measure the voltage drop across it using the Arduino's analog input - with the knowledge of the voltage being used and the resistance, you can calculate (in the code) the amount of current being used, and if it goes beyond a certain amount - turn off the motor.

This would be an interesting project on it's own - though I guess also quite a difficult task, at least for a beginner like me. I will have to google some more on that.
Let's say that the stall current for each motor is 200mA. When would you cut power to the motor to prevent damage? At 80% of it's stall current, or is there no rule of thumb for this?
I guess the easy way would be to install a fuse at about the right rating, but not nearly as much fun :wink: And apparantly difficult to find some with low/exact enough current rating, at least with the car fuses I am looking at currently.

Epoxy resin. I use it in many of my smaller projects. Kicks other 'glues' a@*#.

Awesome - will see what I can find :slight_smile: Really annoying to have things breaking off all the time :stuck_out_tongue: