Driving an optocoupler from 5V
Alex.Stanfield
Posts: 198
Hi there, what's your best bet to drive an optocoupler tied to the 5V rail and making sure you don't have any current when off?
The optocoupler is made of a 270ohm resistor in series with the internal LED.
When active I need to drive between 7mA and 16mA
If I drive it directly from the propeller's pin I'm guessing that: Even when setting the pin as an input, current will flow through the clamping diodes, right? (~5ma which is too near the threshold)
Thanks
Alex
The optocoupler is made of a 270ohm resistor in series with the internal LED.
When active I need to drive between 7mA and 16mA
If I drive it directly from the propeller's pin I'm guessing that: Even when setting the pin as an input, current will flow through the clamping diodes, right? (~5ma which is too near the threshold)
Thanks
Alex
Comments
Robert
That would leave me out of specifications
Alex
It all depends upon what Alex is trying to control. What the optocoupler is driving was never discussed.
For some projects I have used a 74HC14 with a pair of the inverters back to back that buffer the signal. The 74HC14 runs at 5V and has resistors between the inputs of that and the propeller pin. For inductive loads or high voltage signals that may be on the other side of the opto then I still feel the optocoupler is definitely worth considering.
Alex, try using a 74HCT buffer between the output of your Propeller and the coupler. Power the buffer from +5V, and you'll be good to go. The other option would be a common-emitter NPN driver, with the collector connected to the opto's cathode, and its anode connected to +5V.
One thing to consider: if the opto's overall voltage drop at 500uA is more than 1.1V, you could get by with driving it directly from the Prop's output pin. You'll get some conduction through the protection diodes, but probably not enough to turn it on. The other option would be to add a series diode to add another 0.6V to the opto's voltage drop, thus providing additional protection and still giving you 10mA of drive current.
-Phil
Could be but since the actual part # of the Optocoupler was never mentioned we don't know for sure.
-Phil
I don't have the part # for the optocoupler since it' embedded in a stepper driver (2M542 from goodluckbuy.com)
The spec sheet says to drive it between 7 and 16mA. States it has a 270ohm resistor and suggests driving it from 5V directly or adding another resistor when driving from higher voltages.
I'll try to get some measures of the current it draws using the 5v and 3.3v supplies of a protoboard. Maybe adding some diodes to get less voltage across the drivers input, good idea.
Alex
Thanks
Alex
EDIT: Looking at the original post seemed to indicate that it had to be tied to +5V but looking at the stepper driver I see the LEDs are uncommitted in that you can tie them to +5V or +3.3V or even source them directly from the I/O through to ground. I prefer the source approach when the sourcing current doesn't impact on the Prop's regulator as that means that nothing can happen to the supply if it isn't running off-board to an external device. So tie the I/O straight to the LED+ and tie LED- to ground is what I would recommend. BTW, I can't believe the price, is that real?
A simple LED in series should be inside spec, or 2 series diodes.
I get
1.2+7m*270 = 3.09V to 1.2+16m*270 = 5.52V
and a 1.6V red led, will give ~3.4V, so is above your 7mA level.
I ran some manual tests last night and found the following:
Hooked to 5V and grounded it drew between 10-13mA depending on which input I tested. That's exactly what I wanted.
Hooked between the 5V and 3.3V rails (simulating the anode to 5v and a high level on the prop pin) it drew only 1mA, so I believe it should work fine.
Adding a diode in series effectively dropped the high state current to almost 0 but lowered the low state (active) current to 9mA
Probably the best option will be to go with a low cost mosfet.
As for the price, yes it's very real... $40... delivered from hong-kong to your front door. Being such a good price I expected a low tech device with some logic to do the microstepping, however I found some interesting stuff inside. See the picture...
The H-bridge is discrete with 4 transistors between the pcb and the heat-sink
Below, what I believe are the optocouplers
enjoy.
Alex
-Phil
I've worked with a lot of optos including the 2531 and don't think that just because it says a "minimum" of 7ma that 7.7ma is close the bone, not at all.
BTW, the price of the stepper from my link at mycncworld was quoted as $5.98!!
If that doesn't work for some reason, you could put in a series diode between the prop pin and the opto to bring the effective forward drop back up to ~2 volts and then it should work...
Peter, maybe it works directly from the propeller pin now, however I need it to keep working after several years when the opto coupler gets "worn" and diminishes it's sensibilty (I've seen this before). It also needs to keep working reliably under extreme weather conditions (between 0 - 40¤C) so I'd rather spend a little more time and money now instead of reworking the driving line later specially when I can't easily replace the opto-coupler.l
can you paste the link?
thks
Alex
If however you are going to use a transistor to drive the line then use an NPN rather than a MOSFET as a BJT will turn on fully and faster. I use digital transistors such as the DDTD142JC
The link was pasted in my first post under "stepper driver"
Ok, I'll give it a try maybe over the weekend and see what current I get or where it stops working. Thanks for the insight.
I didn't quite trust mycncworld's site since it has strange prices (like this 12Nm stepper for $5.98 http://mycncworld.com/goods-75-12nm+1716oz-in+CNC+NEMA23+Stepper+Motor.html and on the same site a 6.7Nm stepper for $166 http://mycncworld.com/goods-90-67nm+958oz-in+CNC+NEMA23+Stepper+Motor.html. Also none of the pictures belong to these motors) Has anyone used this site?
Thanks to everyone for the tips.
Alex
I understand all too well the need you have to build in that insurance into your product but at the same time if it is totally redundant then it may just become a source of a problem. These problems increase with the number of components and connections so it's a balance between simplicity and "insurance".
Couldn't agree more...Thanks.
Alex
- Driven directly from the prop's pin to ground worked perfectly well !
- Straight 3.3V rail and ground gave a current of about 6.3mA (below specification but close)
- Placing some resistors in series (clk line) I found that It still worked all the way down to aprox 2.75mA, below that it ceased to move
So, maybe it's safe to drive it directly from the prop's pin after all. What do you think? I'm still wodering how it will behave under temperature stress and with aging...
Alex
Great! 6 years should be long enough. Even if I have to replace the opto or rework the driving lines it's fair enough.
Thanks a lot Peter.
Alex