Shop OBEX P1 Docs P2 Docs Learn Events
Using -5v and +12v and optos to drive ULN2803 at ~17v: Not fully driving -- Pul — Parallax Forums

Using -5v and +12v and optos to drive ULN2803 at ~17v: Not fully driving -- Pul

ZootZoot Posts: 2,227
edited 2009-03-02 02:22 in General Discussion
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-18 17:01
    You could do this by using optoisolators between the SX and the ULN2803. The SX can drive the LED side of the optoisolator like any other LED. The phototransistor side of the optoisolator can use the -5V supply as its ground and you'd have a pullup from the collector to the 0V terminal of your power supply. The ULN2803 would be connected to the -5V supply as its ground and the ULN2803 outputs would go to the switch machines with the other end of the switch machines connected to the +12V supply lead. You'd also connect the "flyback" protective diodes to the +12V supply lead.

    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
  • ZootZoot Posts: 2,227
    edited 2009-02-18 18:16
    Thanks Mike. Nice. So the system ground effectively becomes +5v to the opto output for the pullup.

    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
  • ZootZoot Posts: 2,227
    edited 2009-03-01 22:05
    So, I had an opportunity to wire this all up using some H11A817 opto-isolators. It basically works expected, except that I had to use what I think are pretty strong pull-ups on the opto collectors in order to drive the 2803A. The turnout solenoids basically snap to position when triggered, but not with the kind of "oomph" they should have.

    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 JakackiPeter Jakacki Posts: 10,193
    edited 2009-03-02 00:18
    I haven't read your post fully but one of the thoughts that came to my head was why wouldn't you use the power-supply common as your +5V supply to the SX48 as well and then you wouldn't need to worry about optos etc. I can't imagine that you would actually need a +5V @23A rail just for the SX48. So reference everything from the -5V rail as ground. Wouldn't that work?

    *Peter*
  • ZootZoot Posts: 2,227
    edited 2009-03-02 00:32
    That would be a good idea for some purposes, but that won't work here. The +5v rail is rated up to 23A, the -5v is only rated 500ma -- which is enough to change the turnouts every 10 or 15 minutes, but not for much else.

    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 smile.gif 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 JakackiPeter Jakacki Posts: 10,193
    edited 2009-03-02 00:51
    Ok, but remember that there are solid state isolators available with integrated DC-DC converters that have been mentioned on this forum (who can ever find them again). I have used ADuM540x parts that allow you to operate it as a normal logic inverter in and out, except isolated.

    *Peter*
  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-03-02 01:05
    TI's ISO721 is a great high-speed isolator. They are cheap, and you can get a few for free as samples.
  • ZootZoot Posts: 2,227
    edited 2009-03-02 02:22
    Those both sound nice, but they are *very* expensive, plus they are SMD only, which is a problem, for me anyway. The optos I bought were ~.17 each, so it cost me maybe $2 w/postage to get the parts to run 4 bi-directional solenoids. I used some of the extras between the micro and the main track's H-bridge which also helped cut down on noise a lot.

    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 smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
Sign In or Register to comment.