Using -5v and +12v and optos to drive ULN2803 at ~17v: Not fully driving -- Pul
Zoot
Posts: 2,227
Short version -- I'm automating a model RR for my family. Everything is going swimmingly, except for my plan to automate switch machines. The switch machines generally use AC, but can be run DC if pulsed quickly. So far so good -- an SX host drives a ULN2803A to the machines.
Here's the rub -- I'm using a salvaged ATX PC power supply -- perfect for this because it supplies 18A clean +12v for the tracks, 23A clean 5v for all the electronics. But the switch machines have got to have 16-18v to operate.
So I thought to use the -5v supply from the ATX as "ground" for the switch machines and the +12v for "+17v". Manual testing it works fine, the problem is how to drive the ULN2803? If it's "ground" is -5v system, then a "high" from the SX is a "0v" to the driver input pin and (as I found the hard way) a "low" from the SX is "-5v" to the ULN2803 input pin (which immediately fried the breadboarded driver -- duh, the min. low input voltage allowed is -.3).
Is there a way to do this cleverly? I have a 16.3v supply that I can hook up separately for just the machines and tie the grounds together, but right now I have very neat project board with the single enclosed supply, power switch, power plug, SX48 and electronics, etc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Post Edited (Zoot) : 3/1/2009 10:09:25 PM GMT
Here's the rub -- I'm using a salvaged ATX PC power supply -- perfect for this because it supplies 18A clean +12v for the tracks, 23A clean 5v for all the electronics. But the switch machines have got to have 16-18v to operate.
So I thought to use the -5v supply from the ATX as "ground" for the switch machines and the +12v for "+17v". Manual testing it works fine, the problem is how to drive the ULN2803? If it's "ground" is -5v system, then a "high" from the SX is a "0v" to the driver input pin and (as I found the hard way) a "low" from the SX is "-5v" to the ULN2803 input pin (which immediately fried the breadboarded driver -- duh, the min. low input voltage allowed is -.3).
Is there a way to do this cleverly? I have a 16.3v supply that I can hook up separately for just the machines and tie the grounds together, but right now I have very neat project board with the single enclosed supply, power switch, power plug, SX48 and electronics, etc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Post Edited (Zoot) : 3/1/2009 10:09:25 PM GMT
Comments
The only problem here would be that the switch machines would all be on by default. If you turn on the LEDs in the optoisolators, that would turn off the switch machines. That may be ok. One way to fix this would be to connect an octal inverter between the optoisolator output and the ULN2803. The inverter would also run with its ground connected to the -5V supply and its Vdd pin connected to the 0V lead of the supply. The 74HC04 is a hex inverter (you'd need two) that's cheap and readily available.
Post Edited (Mike Green) : 2/18/2009 5:09:05 PM GMT
Would an opto like this be about right? http://forums.parallaxinc.com/www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=871210&?
The switch machines must be off (de-powered) when not actually switching. They are basically small push/pull solenoids; by spec anything other than short DC pulses to move the solenoid from one position to another will burn out the machine. So I'd have to use inverters, but I have a few 7404s on hand. My driver has the flyback diodes built in.
One question though -- wouldn't I also need limiting resistors between the micro pins and the opto emitters? I would presume so... e.g. the unit above has an emitter rated up to 50ma. Can I also presume that limiting current down to micro-safe levels won't affect operation of the opto for TTL?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
opto led anode --- 270 resistor --- SX pin
opto led cathode --- system ground (0v)
opto emitter --- (-5v)
opto collector --- ULN2803 input
--- 1k pull-up to system ground (0v)
2803A gnd --- (-5v)
2803A com -- (+12v)
I decided not to use inverters; this is an AC outlet supply and current use is not an issue, so I just have the firmware keep the opto leds on to keep the solenoid off, and pulse the pin low for 50ms to have the switch turnout change position.
If I use anything higher than a 1k pullup, the solenoid doesn't get powered fully. This seems awfully low. I checked all the points on the scope, and the "high/low" from the collector is a solid -5v when the opto led is on, but only jumps about 1.2v higher when the led is off. Obviously with even higher value pull-ups, the output jumps less than 1v. I've also got solid voltages without ripple everywhere (-5v, 0v, 5v, 12v).
When I manually connect the inputs of the 2803A to either -5v (low) or 0v (high), I get much "snappier" and powerful output, so that end of things is OK.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Post Edited (Zoot) : 3/1/2009 10:11:48 PM GMT
*Peter*
The SX48 at 50mhz, IR detectors/emitters, misc chips (595s, 2803s, etc) add up to nearly 1 amp already, and that's before the gazillions of LEDs, and little motors and what not we're putting on the layout My estimate is we'll be up at somewhere around 6 amps or so on the 5v rail when we're done.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
*Peter*
As I said, it works fairly well, just not quite as well as it seems like it should, and the pullup on the opto seems like it shouldn't need to be so strong. I have some reed relays lying around also, so if the performance is still bugging me, I may just use those. The problem is they take up a *lot* more real estate on the project board (8 reed relays + driver vs . two 16-pin sockets + driver).
In any case, I'm trying to keep this inexpensive and quick -- trains are OK and all, but I've got a number of robots awaiting my attention on the bench
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php