Go Down

Topic: opto isolator and filter question (Read 1 time) previous topic - next topic

Tangles84

Jul 28, 2015, 09:04 am Last Edit: Jul 28, 2015, 10:24 am by Tangles84 Reason: adding shematic
I am making a general input and output sheild for arduino uno for about 7 input and 7 output.
it am planing on using this for home automation and things like that and am therefor going to be running long cables near who knows what and possibly some long runs too.
I'm concerned about filtering the inputs. my plan is to run the input circuits on 24v to avoid too much small interferance . so the input will run through a resister and then past a zener and schottky diode to stop high volrage and negative voltage. then through an rc filter set at about 25 ms so that 50 htz power will be to high frequency . then after the filter trigger the led in optocoupler.
transistor side of optocoupler has the input pin of arduino connected to resistor then through transistor to ground. the internal pullup resistor is  activated.  

so when 24v is connected to input on sheild the pin on arduino is pulled low through all the filtering. one question I guess is this the best method for this without using an op amp. (I don't understand their operation yet)

also the grounds are supposed to be separate from opto isolator and the rest of project? is this going to void my filtering if I connect the grounds together?  I'm trying to avoid 2 power supplies. my main purpose if using opti couple is for 24v triggering separation is not electrical separation . it's not necessary as far as I can tell. the separation was just to avoid nusuanse triggering . I could always use resistors for voltage splitting but I liked that optocoupler did the digital switching rather than arduino pin. so if there was a surge or something it would kill opto coupler and leave everything else in tact. I've seen plc that have opto coupler on the inputs but only have 1 power supply.
how do I achieve this?

thanks in advance for the help.

Tangles84

this is the wiring digram but I messed it up. I'll have zener then skotshy diode then resistor then capacitor for filter then resistor for dropping down voltage for led in octo coupler. 

Grumpy_Mike

If you connect the grounds together then you are negating most of the advantages of having an opto isolator. You might just as well directly connect to a transistor to catch your 24V signals.

Grumpy_Mike


Tangles84

Dammit pic too big for diagram. .


24v --- skotshy to earth --- zener to earth --- resistor for rc filter ----- capacitor to earth ---- resistor to lower voltage for led in optocoupler ------ optocoupler.


then on transitor side collector is connected to internal pullup activated pin and emitter connected to arduino ground.


what are the advantages other than higher voltage switching lower volrage and noise immunity?

would that be a better option?

so can I connect transistor in that place instead.? and have base 12v controlling the 5v pin in arduino pulling it low?


Grumpy_Mike

Sorry that connection list seems to be lots of things connected to ground. Can you make your diagram smaller or post it on a photo web site and post a link to it.

Tangles84

but all earth's are tied except arduino one.

Tangles84

the 2 diodes are at the start to stop negative voltage or over voltage. ones a skotshy and the other a zener.

Tangles84

I can't find any way online to use transistor to have 24v on base and 5v from collector.

should I just use resistors for voltage splitting rather than opto isolator?  what is the best method for this?

MarkT

What sort of cabling are you using?  Is the sending end powered separately?

With a reasonable setup the optocoupler will filter out the RF all by itself (but add 1nF
ceramic across the terminals for good measure).  Common-mode interference is completely
irrelevant when opto coupled, only differential mode interference will be a problem, and
frankly the series resistor to the opto-coupler will prevent such noise from doing anything bad,
the slow response of the opto coupler (if photo-transistor sort) will lose most of the rest
and software debouncing at the Arduino is all that's then needed.

You seem to be taking all the precautions needed for directly connected signals at 5V,
which isn't what you have.

Make sure the cabling is suitable (STP, UTP or coax will all be reasonable).

5V may be plenty unless this is in an industrial environment with lots of big motors.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Tangles84

I was planning on using cat 6 shielded cable. earthed at arduino end and powered at arduino end. 

so is all those diodes and resistor not needed?  are they over done? should I just cut it down to rc filter and resistor to lower voltage for led in optocoupler?

I may use it in industrial area with welders and motors. that's why I was raising voltage to 24v.

will the octo coupler still give good filtering if the earth of the octo coupler is joined to the earth of the arduino? or do I need 2 power supplies? one for arduino and one for input?

Grumpy_Mike

I can't find any way online to use transistor to have 24v on base and 5v from collector.
Why not? You connect the base through a transistor to the 24V signal, therefore you don't have 24V on the base. Remember transistors are current driven devices. The collector goes to the Arduino input with either the internal pull up enabled or an external pull up to 5V.

but all earth's are tied except arduino one.
Thanks for the diagram. If you want to use those diodes then move them to the other side of the resistor so you have something to drop any excess voltage across.

However for general protection see:-
http://www.thebox.myzen.co.uk/Tutorial/Protection.html
or
http://www.digikey.com/us/en/techzone/microcontroller/resources/articles/protecting-inputs-in-digital-electronics.html

Tangles84

are you saying put resistor before the transistor base to drop voltage to 5v? that's a good idea.

that second link, down the bottom is the design I was going for. 

so if I copy that circuit down the bottom. but add a resistor at the end to drop the volrage down to 5v at transistor and keep current in range then i could just add transistor to switch arduino pin low?
that would be a noise stable configuration? 

I like this plan . I have transistors at home. no need for new parts.

Grumpy_Mike

Quote
are you saying put resistor before the transistor base
Yes.
Quote
to drop voltage to 5v?
No that is not what the resistor does. You will not get more than 0.7V on the base of a transistor if you ever get to anywhere close to 5V then you have killed the transistor. The resistor limits the CURRENT in the base, not the voltage at the base.

Quote
but add a resistor at the end ...
You could but if you add the resistor at the start then you only need one resistor.

Quote
that would be a noise stable configuration? 
There is no such thing. All you can do is to reduce the effects of noise. The difference between operating and how large the noise has to be to stop normal operation is called the "noise margin", you take steps to maximize the noise margin but there is always a point, if you wind the noise up to a big enough level, where the circuit will stop working normally.

Go Up