ULN2803A Darlington array - GRR

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Post Reply
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

ULN2803A Darlington array - GRR

Post by Newz2000 »

I'm hooking up a Toshiba ULN2803A darlington array to my pic in order to control a stepper motor. I'm using a 9v battery to power the whole circuit. There's a 7805 regulator (et all) knocking the voltage down to 5v for the pic. I'm getting just about 5v at the pic, and at least 6v (sometimes 7 or a little more) on my 'high' voltage side.<p>If I grab the high voltage and tap the pins of the motor in order, the motor turns as expected. So the voltage works, and the motor works.<p>When I use LEDs on the designated output pins, the LEDs light up in order, so the pic works and the program works.<p>I hook the circuit up like this:
<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">code:</font><hr><pre>
+--U--+
IN 1->+ +-> OUT 1
IN 2->+ U +-> OUT 2
IN 3->+ L +-> OUT 3
IN 4->+ N +-> OUT 4
->+ 2 +->
->+ 8 +->
->+ 0 +->
->+ 3 +->
GND <-+ +<- 9v in (actually, 6-7v)
+-----+
</pre><hr></blockquote><p>When I measure the voltage on pin 1 of the ULN2803A I get 5v, but on pin 18 I get .2 v.<p>I've looked at the datasheet, but it didn't make any sense to me. I found a note from parallex about using the ULN2803A for a stepper motor driver, and their description matched my setup perfectly (thanks!).<p>Just to be clear, the output from my pic goes directly to the ULN2803A input. The coresponding output from the ULN2803A goes directly to the stepper. The stepper is a five pin unipolar with a common ground. The ground goes directly to the ground on the high voltage side. The ground of the ULN2803A goes to the low voltage ground. I've measured the input voltage on the 2803 (pin 10) and its atleast 6v. The circuit is manual, meaning that it doesn't spin the motor automatically, it only rotates one step when I press a button.<p>There are a total of 10 pins in use on the ULN2803 (the top 4 on each side, the bottom one on each side), 8 pins are not used.<p>If I leave the circuit in place, and tap the pins on the output side of the uln2803 in the correct order with the high voltage line, the motor turns. If I tap the input pins on the ULN2803A with the 5v in the correct order I get NOTHING. :( <p>Am I missing something? I'm sure its something that would be immediately clear to me if I just had a few gray hairs. ;)
hp
Posts: 245
Joined: Sat Aug 09, 2003 1:01 am
Location: Friendswood, TX
Contact:

Re: ULN2803A Darlington array - GRR

Post by hp »

Did you connect the other side of the coils on your stepper motor to the pos side of your 9v battery? I would check that first since the ULN2803A looks like it has open collector outputs. This means it switches to ground when active.<p>Take a look at the datasheet (http://www.ucapps.de/midio128/uln2803.pdf) if you need more info. Page 2 has the internal driver schematic.<p>Harrison<p>[ July 13, 2005: Message edited by: hp ]</p>
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: ULN2803A Darlington array - GRR

Post by Gorgon »

Hi Matt,
I think you have it a bit off. The ULN2803A is a open collector sink driver (Just like a NPN transistor). You put 5v in and get 0v(0.2v) out. 0v in and the output floats.
The +V (pin10) is only connected to the cathode of a row of protection diodes from each of the eight outputs. To use it for your project you need to connect the +V(9v) to the common line on the motor to get voltage over the motor coils. I don't know if you need to rearrange the coils when you reverse the voltage.<p>TOK ;) <p>[ July 14, 2005: Message edited by: Gorgon ]<p>[ July 14, 2005: Message edited by: Gorgon ]</p>
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: ULN2803A Darlington array - GRR

Post by Newz2000 »

This is a new concept to me. I understand sinking current, I think. For example, a pin on a Pic can be an output and it can either put out 5v, low mA when the pin is on, or it can pass 5v, slightly higher mA, to ground when the pin is off.<p>I looked for open collector on google, and found this explanation (with a picture!) but I'm not sure I have it. Let me describe what I think I'm reading and please correct me if I'm off.<p>I connect my +9v battery lead to the common lead on the stepper. I leave everything the way its connected.
When I want to energize a coil (aka let current flow through one of the wires coming out of the motor) I send a logic 0 to the pin on the pic.. Otherwise all of the pins on the motor should be logical 1.<p>Having a 0 on the logical pin allows current to flow through the common wire on the motor, through the wire connected to the ULN2803A pin and then to ground.<p>The only change I will need to make then is to connect my common wire to 9v instead of ground, right?
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: ULN2803A Darlington array - GRR

Post by Newz2000 »

Ah, this note explains it well. http://www.phanderson.com/stamp/tutorial_3.html<p>He uses the stepper motor as an example, and he even clearly illustrates half stepping.<p>I think I've got it. Any additional feedback is 100% welcome and appreciated.
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: ULN2803A Darlington array - GRR

Post by Gorgon »

Hi Matt,
Sorry if I confused you in my answer. 'Sink' is when you connect a signal to the 0V, or a passive connection. 'Source' on the other hand is when you actively supply voltage to a signal.<p>There is of course no real difference in these two concepts, more a way of thinking.<p>Please keep the +v to pin10 on the ULN2803A, this will suppress inductive spikes from the coils, and lengthen the life of the IC.<p>TOK ;)<p>[ July 14, 2005: Message edited by: Gorgon ]</p>
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
ecerfoglio
Posts: 108
Joined: Thu Nov 25, 2004 1:01 am
Location: Buenos Aires Argentina
Contact:

Re: ULN2803A Darlington array - GRR

Post by ecerfoglio »

When its input is high (~5 volts), each driver inside the ULN 2803 will sink current from its output - in other words, it will connect its output to ground (pin 9).<p>When its input is low (~ 0 volts), its output will simply act as an "open circuit". It cannot "source" current to its load. (The connection at pin 10, as Gorgon said, is only used for the surge protection diodes inside the chip)<p>The load (in your case, the stepper's coils) should be connected between the ULN 2803's output and the + side of the power suply (in your case, the 9 V battery). <p>Note that the drivers are inverters. So when they recieve a High they output a Low, which powers up the coil.<p>This family of open collector drivers are a good way to control loads that are connected to "exotic" voltages (in your case 9 V, but it may be 12 V, 24 V or anything up to 50 V) from logic or a microcontroller (usualy 5 V).<p>[ July 13, 2005: Message edited by: ecerfoglio ]</p>
E. Cerfoglio
Buenos Aires
Argentina
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: ULN2803A Darlington array - GRR

Post by philba »

Here's a picture that will help you visualize what these gents are saying
Image<p>the load is the resistor and led. I don't know why they are using a zener with that circuit (resistive loads don't kick back).<p>[ July 13, 2005: Message edited by: philba ]</p>
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: ULN2803A Darlington array - GRR

Post by Newz2000 »

Beautiful! It works. Thanks everyone.
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: ULN2803A Darlington array - GRR

Post by Gorgon »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by philba:
;)<p>[ July 14, 2005: Message edited by: Gorgon ]</p>
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: ULN2803A Darlington array - GRR

Post by Newz2000 »

So, correct me if I'm wrong...<p>If I startup my pic and set my outputs low (0) I'm basically draining my battery and getting no motion from my motor, right?<p>If so, that would explain a lot. Thank goodness for rechargable batteries.
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: ULN2803A Darlington array - GRR

Post by Newz2000 »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Matt Nuzum:
So, correct me if I'm wrong...<hr></blockquote><p>Never mind, I'll do it myself. I don't know what I was thinking. Current flows only when there's a logical 1 on the port, it just causes the current to sink to ground.<p>I am draining batteries but it's not because of that. I'm sure I'll figure out.
Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests