2

I need to read a high level logic level betwwen 0 to 30 volts on a microcontroller input, is this is correct, thank youenter image description here

1tact
  • 51
  • 1
  • 3
  • What is R14 for? – Botnic Dec 14 '15 at 09:57
  • 1
    If you are looking for someone pointing out errors in your way of thinking, you might want to explain your way of thinking and why you think the circuit should be that way. – PlasmaHH Dec 14 '15 at 09:58
  • Note that the 3V3 will be "high" when the 30 V input is around 3 V or so. You will need a different schematic if you need that level to be around 15 V. – Bimpelrekkie Dec 14 '15 at 09:59

1 Answers1

5

Use this optocoupler configuration to read the logic level:

Opto coupler

You need to adjust the resistor labelled 5K to 10K in order to get best results. If you are getting logic HIGH on small voltage like 5-10V then increase the resistor (you are free to go beyond 10K as well). If you not getting logic HIGH at 20-25V, then reduce the resistor value.

On the output side, RC filter has been used to smooth out any fluctuations you might have introduced on the input side. You won't need debounce on the code side.

Besides giving you a nice logic level for arduino, this will also save your arduino from receiving 30V directly in case something goes wrong.

Whiskeyjack
  • 8,286
  • 9
  • 58
  • 99