Optocoupler wiring and resistance values  - Page 1
Forum section: electronics / beginners

author: briskCZ
author_rank: Newbie
timestamp: August 13, 2015, 01:25:29 pm
content: Hello, I study electrical engineering on high school and I have been always intersted in electronics etc...I want to build nixie tube clock controlled by arduino, and my teacher recomended me to use optocoulplers to galvanicaly separate the arduino from the main board because there could potencialy be high voltage powering the nixie tubes. Its summer break here and I cant ask the teacher if I am doing this right, so I decided to ask here.My wiring is as shown on attached picture. I have optocouplers CNY17 (datasheet:http://www.farnell.com/datasheets/1795692.pdf) so I decided to use them.Pin 1 is attached to digital arduino pin, and the current is limiter by 68R resistor ( I calculated its resistance here:http://led.linear1.org/1led.wiz)Pin 2 is arduino ground...Pin 4 is connected to the ground of a second board driving the nixie tubesPin 5 is connected to IC on the second board and its connected via pull-up (pull-down?) resistor to 5 volts.I think that it will work, but I want to confirm that before I make the pcb.Thanks for the replies. I hope you will understand my post because my english isnt the best

author: McBryce
author_rank: Super Contributor
timestamp: August 13, 2015, 02:10:27 pm
content: That looks generally fine. Just remember that your opto circuit is inverting the signal. So a "1" output from the arduino will set the output of the optocoupler to "0" and the opposite too. So your arduino software will have to account for this.Yes, the resistor is a pull-up resistor - "up" if connected to VCC "down" if connected to GND. You've chosen quite a high value though. 10K would probably be fine if the Nixie driver has TTL inputs.The resistor on the optocoupler input seems a little high. The forward current of the coupler LED is 60mA, forward voltage drop is 1.65V. This means the resistor is dropping about 3.35V so: I = V/R = 3.35/68 = 49mA, a bit low for the LED. 56R would give you 59mA, closer to what you want.Generally regarding Nixie projects. The Tubes are driven with voltages between 170 and 180VDC. This is not to be taken lightly. Keep your hands away from the circuit when it's live!McBryce.

author: briskCZ
author_rank: Newbie
timestamp: August 13, 2015, 02:43:14 pm
content: Thanks for the replyI will use resistance values that you suggested, thats why I was asking.I want galvanicaly separated arduino from the rest just because the high voltage used for the tubes. If somehow the high voltage found a way to the arduino, it would be fine, I could just replace it, but if that happened when the arduino is connected to my PC it would be bigger problem.What would I have to change in order to make it non-inverting? It shouldn't be a problem like it is now, but I am just curious

author: Svuppe
author_rank: Regular Contributor
timestamp: August 13, 2015, 02:56:02 pm
content: 60 mA in to that opto sounds like way to much. It is right up at its absolute maximum rating. Can an Arduino even deliver that much current on a port pin?

author: briskCZ
author_rank: Newbie
timestamp: August 13, 2015, 03:39:51 pm
content: Arduino can deliver 20mA per I/O pin...

author: fcb
author_rank: Super Contributor
timestamp: August 13, 2015, 04:15:16 pm
content: 68R seems a little low (you're driving the LED far harder than necessary) and 220K seems a little high.You should read up on opto-couplers and CTR (current transfer ratio).

author: briskCZ
author_rank: Newbie
timestamp: August 13, 2015, 05:01:18 pm
content: I will use 10k resistor for the output.If I correctly understand the datasheet, best CTR is when IFis 10mA so the input resistor should be 390R ?I work with optocouplers for the first time, so I am a bit confused.

author: fcb
author_rank: Super Contributor
timestamp: August 13, 2015, 05:13:58 pm
content: If a part has a CTR of 50% it means that if you ran the LED at say 10mA, the output wouldn't be able to source/sink more than 5mA.Likewise if you had a CTR of 200%, running the LED at 10mA would allow you to source/sink a maximum of 20mA.So in your case running 10mA into the LED (a sensible amount!) and having a 10K on the output (5V/10K= 0.5mA) would require a CTR of greater than 5% and you'll easily meet that with your CNY17.

author: briskCZ
author_rank: Newbie
timestamp: August 13, 2015, 05:51:28 pm
content: So if I use 390R input resistor which gives me 10mA input current, and 10k output resistor, will it work well?

author: picandmix
author_rank: Frequent Contributor
timestamp: August 13, 2015, 08:07:47 pm
content: Quote from: briskCZ on August 13, 2015, 05:51:28 pmFind using a lower led current of around 4ma much better and it turns on the output transistor ok.Try higher values, 680R , 860R or 1K and see what current your chip actually takes, (my opto runs on 1K ok ) experiment on a breadboard before connecting to your Arduinos output pins.If you are using several outputs with opto couplers you need to be aware that the each output has a maximum output current of 20 ma according to Ardunio, but the maximum the whole chip can handle is 200ma according to the ATmel 328 datasheet.However they are maximum figures which you really want to avoid getting that high as you will have heat problems that shorten the components life, so always run as low current as practicable.

author: McBryce
author_rank: Super Contributor
timestamp: August 14, 2015, 08:00:39 am
content: Sorry, for the confusion briskCZ. I accidently read the absolute max for opto LED. Ignore my recommendation on that resistor.McBryce.

author: fcb
author_rank: Super Contributor
timestamp: August 16, 2015, 10:39:56 am
content: Quote from: briskCZ on August 13, 2015, 05:51:28 pmI would say so. Why don't you try it?