# opto isolator used to change voltage

The Arduino DUE runs at 3v3 and almost everything in the world runs at 5v. When driving for example an h-bridge chip that needs at least 5v to operate, can I use an opto isolator with the diode being driven by the 3v3 from the DUE and the other side switching a 5v supply? I need the superior speed and resources that a DUE has so using an UNO or MEGA will not work - simply not enough processing power to do all the kinematic calculations for a 6 axis arm. I also like the idea of isolating my DUE from the side that will probably be making blue smoke ;>} (32 PIC MCU's fried in my last attempt at this project) Thanks people.

• 74HCTxx devices accept 3V in to 5V out. Logic level drivers with crossover dead time control and RdsOn must be much less than motor coil resistance., – Sunnyskyguy EE75 Sep 16 '16 at 6:42
• "almost everything in the world runs at 5v" is a bit of a stretch. Lots of modern stuff run at 3.3V, dissipating much less power than their 5V counterparts would require. – Dmitry Grigoryev Sep 16 '16 at 7:19

Yes you can get voltage shifting and isolation using opto couplers.

Be warned that low cost couplers used in saturating mode, that is the 'obvious' way to use them to transmit logic signals, are fairly slow, a 10kHz waveform should go through, 100kHz won't. As long as you allow for this in your choice of PWM speeds, you should be OK.

They work much faster in non-saturating mode, but then you need a little more hardware around them.

You can get premium couplers that work to MHz or 10s of MHz, if you really need low latency.

If you don't need isolation, there are several ICs that will handle level translation, or use discrete transistors.

• Ouch - seeing as there will be a bunch of PWM happening and as yet I dont know what frequencies they will be because I have not finished working out the gear train, then maybe this is not such a "bright" idea for my current application. Thanks for the input. – MadMan Sep 16 '16 at 8:08
• @MadMan if you're controlling motors, I'd expect PWM frequencies in kHz range to be OK. One reason you'd want to go higher is to avoid buzz from frequencies in audible range, but motors often produce enough noise by themselves, so PWM noise is a lesser problem. – Dmitry Grigoryev Sep 16 '16 at 9:16

Note that if your project uses only low voltages (anything up to 12V can certainly be considered low), you don't really need optocouplers to isolate magic smoke failures. Connecting your arduino via MOSFETs offers reasonable protection from overvoltage on its pins, and adding resistors in series guarantees limited current.

Here's an example from this answer:

Of course, I don't imply that optocouplers are useless in low-voltage electronics. There are other reasons to use them, e.g. when you cannot connect grounds of different parts of the circuit together.

• Thanks for the info Dmitry - The IRF510 is available locally (ZAR8.90 or about US$0.61) but the 2N3903 is nowhere - find 2N3904 (alternative??) (ZAR1.19 / US$0.09) - making a bunch of these on veroboard is in my future ;>} – MadMan Sep 16 '16 at 8:53
• Just a last point - Does the circuit above need anything like flyback diodes or other "self protection"? Sorry but I am not very intelligent as far as electronics is concerned. – MadMan Sep 16 '16 at 8:58
• @MadMan obviously it does. MOSFET will probably protect the arduino, but will die itself if you don't put flyback diodes in place. The same is true for optocouplers btw. Oh, and if you don't happen to have 2N3903, almost any NPN rated to withstand your voltage should do. – Dmitry Grigoryev Sep 16 '16 at 9:11
• I thought so Dmitry - thanks - hopefully one day I will know enough about semiconductors not to have to ask these sorts of questions. ;>} – MadMan Sep 16 '16 at 12:47