Edit:Sorry I meant AC as in Alternates with a frequency. It's not just 50-60Hz. Sorry for the poorly asked question earlier, but what I am trying to do, is measure a signal to know the frequency. I'm not going in the direction of voltage dividers because of voltage spikes in automotive circuits. What I would like to know is which opicoupler would be best suited for an arduino if I measured an unknown circuit's frequency or would a transistor be better suited for this task with an example if you could. I"m just trying to find the Vehicle speed that works off of a hall effect sensor that outputs 2000 pulses a mile. I'm trying to read the pulses of that sensor.
This would do however, AC is 60/50 hertz and you will see the this frequency if you don't rectify and filter the signal.
Long story short is that I need to connect a higher AC voltage source to an arduino input and need help. The input is measured to be around 6 volts and I'm not sure of if I should use a transistor or opticoupler
If you add a diode on each wire and a resistor in between the two (to serve as a load), the positive and negative transistions will be reduced by one diode drop (0.7 Vdc) and your signal will be +/- 5.3
V dc. If you combine one germanium diode (0.3 V diode drop) with one silicon diode (1n4001)/0(0.7 Vdc diode drop), on each of the two wires with the negative diodes reversed, put a 10k resistor across
the two wires, you will have +/-5V dc (10 V p-p) across the wires. An opto isolator is by defination isolated between input and output. You can therefore connect the negative voltage to one opto and to positive to the other. Connect the output side of the negative opto with the emitter connected to the arduino ground and a pullup resistor to +5V on the output transistor. The arduino will be blind to the fact that the input to the opto is a negative voltage because there is no common ground between the two optos or the arduino on the input side of the optos. The arduino is therefore safely protected from negative voltages by the iso barrier of the opto. the change in voltage on the input of the opto will be mirrored by an inverted like change in voltage on the output. You will need to add a transistor inverter to convert the signal to the same polarity as the orignal. You will wind up with two analog signals,
one representing positive and one representing negative. It is up to you to reconstruct the original signal by adding the two.
AC is positive & negative transistions, that could be sinewaves or audio or whatever.
An opto-coupler had a led, which is a diode, which means it only conducts in one direction.
Consequently, it will only conduct during the positive transition and all negative transition data will be lost.
I believe there are bi-directional optos for ac use or two regular optos (one reversed) might be used.
You really
If the voltage is only 6 V then you could get away with just using a series resistor to limit the current flowing in the input protection diodes. However, to prevent high voltage spikes which are common in automotive circuits causing damage, a shunt 4.7 V zener after the resistor might be a good idea.
Your post is a bit confusing. It is not a good idea to refer to a previous version of your post when you have deleted it in an edit. Better to leave the original and add a reply to correct it.
Russell.
but what I am trying to do, is measure a signal to know the frequency
Why not use an opto to generate a pulse and then use Nick Gammon's Frequency Counter Sketch ?