Let's Make Robots!

Control DC motors with an ULN2803

I live in argentina and getting thing shipped here is a mess, so I try to use whatever is available here (which is rather limited) whenever I can.

So I was wondering since I haven't found any of the typical H-bridges ...is it possible to control DC motors (speed + direction) with a ULN2803? These I can buy here. 

If so then how would that setup be? Do I need any additional components? If so then which (transistors, resistors, diodes etc)?

I googled it a bit and I only saw examples of STEPPER motors being controlled with these ICs. 

Comment viewing options

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

Nothing wrong with being curious, it's about the only way to become a better noob =)

The resistors on the left of the ULN2803 are there to limit the current coming out of the Arduino. This makes sure that the input current can be 'disabled' when the other input is already active. You can leave these out (as well as the diode/wire coming from Output_2 to Input_1 and vice-versa) if you're certain there won't be any chance of both inputs turning on at the same time.
The resistors on the right of the ULN2803 are there to limit the current coming out of the PNP transistors. If they weren't there then a large current could easily surge through the PNP, wasting a lot of power and possibly destroying it.

You can use the other pins for another H-Bridge, or even another three if you needed to. On a recent project I used a single ULN2803A for two H-Bridges and then I used the other half of the channels for driving some LED sets.

If I remember correctly the postfix is just the 'grade' of the IC, nothing very important changes from grade A to B to C, etc, etc. Either DitenTec left it off because it's not a big deal, or maybe because they get in a range of grades and don't know what stock will be available at what time. Either way it doesn't matter, the '2803' is the important part as the others in the family (ULN2801 etc) have different properties.

Here's an updated schematic with some recommended values. I can't be 100% sure on the PNP base resistors without knowing what actual transistors you plan on using, but the values are probably close enough:
ULN2803A_H-Bridge_2.jpg

Those D1647s look really nice; Darlington configuration, up to 60V across the collector-emitter at up to 2A, with built in protection diodes too. Definitely usable in an H-Bridge, just make sure you use a resistor in between the control input and the base.

There are a number of ways to control the motor speed other than PWM, but I don't recommend any of them =D
They all involve more parts and more complication, but the end result will probably be worse. If you're really curious I can describe a few, but they're pretty awful. There's a good reason why PWM is so popular!

...however it seems I was saved by the bell. I had given up on finding an H-bridge IC here since I had allready been to like 25 of the most prominent shops (=all the ones I know). But a classmate told me about a tiny shop hidden away that specializes in ICs, and they DID have an L293D chip :) so I think I'll go for that...atleast for this project. I'm definately gonna build my own bridge for another project later (soon), so the knowledge gained here will be used no matter what. I saved your diagrams and explanations in a document to make sure I have it for later use...

Thanks again...I learned a hell of a lot...

 

PS: No need for any further description of the awful non-pwm control methods. I'm busy enough learning USEFUL stuff right now ;)

 

I'm glad you managed to find a local shop that sells some good parts =D

Even I prefer to use prebuilt driver ICs when I can, but there are a few occasions where a more specialised driver is indeed useful.

...yes it does simplify things somewhat. And this particular robot is meant for range sensor based environment mapping (not electronics experiments) and I wanna be able to put it together FAST as soon as I get the motors (ordered from DAGU a few days ago). A secondary purpose is to use it with OddBot's compound eye (ordered with the motors). I call this robot Mappy (so far).

I'm planning to build Mappy's ugly brother Scrappy before long. This will be a robot build entirely from scrap EXCEPT the brain which will be a standalone Atmega168. For that project I'll definately build my own H-bridge. Probably using the D1647 transistors you seemed to like. So far I've also got varios motors, gears, wheels, caps, resistors, transistors, (touchsense) switches,  etc...

:)

This is the H bridge I use:PShbridge.gif

 

The transistors are cheaper than dirt, just don't turn both sides high!

I'll be looking into that...just one question...

This H-bridge seems somewhat more complicated than the ones I've seen. Any particalar advantages in using 6 transistor rather than 4? And why the crossing of the wire (above the motor)? I'm quite a noob in electronics so I don't quite understand this diagram. I was thinking in simpler terms like this...

basic-bridge.gif

 

... which I DO understand!! But I suppose this is incomplete and merely meant to explain the principles to noobs like me...

The H-Bridge you posted requires 4 inputs to control, whereas the one above only needs two =D

In that case I think I'll go for the simpler version and simply use a shift register or (de)multiplexer to make up for the extra use of pins, since I know how to use these and they're easy to buy here (for around $0.5 each)...

Besides I don't think I'll need that either. I'm not really in danger of running out of pins in this project, which is a simple 2 dc motor + 2 servo "start here"-class robot for environment mapping experiments...

Thanks again :)

Just get a dedicated motor controller chip (LM293D, LM298, SN754410) and you will be set.

However if I could JUST get an H-bridge I wouldn't have posted this topic in the 1st place. It seems I can't buy them here and the word JUST simply doesn't apply to getting stuff shipped here. It's extremely slow, expensive and risky. :(

I checked the Arrow ECS and they do not have offices here in Argentina. However they do in Brazil, which may or may not be of use to me. I'll check it out further. But for now it seems I'm back to square one, which means the easiest, fastest and cheapest option probably is building my own H-bridge(s) using transistors and stuff.

Anyway thanks a lot for ruling out the ULN2803...

 

Best wishes :)

Aniss