Hello forum ! i want to measure the voltage of my car battery, (and alternator output), with a microcontroller.
I don't want to use a simple voltage divider circuit, because i am afraid of the large voltage spikes.. (i dont trust my alternator at all)
As i understand, i can use an optocoupler, to completely isolate the input of the microcontroller. with a circuit like this :
My problem is, how do i set up , R1 and R2 so that the output is in the correct range??
for example in the PC817, in the datasheet, it says : CTR : 80 to 160 ... is there something i dont know?? becouse i am not able to make any calculation based on such a big diference... :/
I don't want to use a simple voltage divider circuit, because i am afraid of the large voltage spikes.. (i dont trust my alternator at all)
As i understand, i can use an optocoupler, to completely isolate the input of the microcontroller. with a circuit like this :
My problem is, how do i set up , R1 and R2 so that the output is in the correct range??
for example in the PC817, in the datasheet, it says : CTR : 80 to 160 ... is there something i dont know?? becouse i am not able to make any calculation based on such a big diference... :/