enter image description hereIn this circuit, switches should be connected to 24V DC and arduino pins should check whether switches are on or off to control led behaviour. I don't know how to use 24VDC for this situation. I would be glad if someone can help. Thanks.

  • 4
    \$\begingroup\$ You have failed to actually state an answerable question... Typically to monitor higher voltages you use either resistive dividers or series resistors and diode (possibly zener) clamps. In extreme cases, optoisolators may be warranted. \$\endgroup\$ Jul 6, 2020 at 5:41
  • 1
    \$\begingroup\$ Please post an actual schematic. \$\endgroup\$
    – Lundin
    Jul 6, 2020 at 6:59
  • 1
    \$\begingroup\$ The photo you added doesn’t help much, since we can’t see where some of the wires go. \$\endgroup\$
    – HandyHowie
    Jul 6, 2020 at 7:46
  • \$\begingroup\$ @Lundin I have added schematic. Right now vcc is connected to 5V but it should be 24V. I thought I can use optocoupler but couldn't figure out how to conenct them. I should find the optimum and safest solution. Thanks for attention. \$\endgroup\$
    – alfonso
    Jul 6, 2020 at 7:53
  • 2
    \$\begingroup\$ Something simple like this should do electronics.stackexchange.com/a/320165/16051. There are plenty of question with respect to interfacing a microcontroller with higher input voltages. \$\endgroup\$
    – Rev
    Jul 6, 2020 at 8:32

1 Answer 1

  • Where you currently have pull-down resistors, place a voltage divider with 2 resistors instead. For example something like 3k9 + 1k, to get close to 5V.
  • In case you are worried about the quality/level of the 24V (raw battery voltage etc), then first place a 33V TVS on it, then after the voltage divider, use one diode from ground to signal and one from signal to 5V, as shown here: How would I design a protection clipper circuit for ADC input?. Keep the forward voltage of the diodes in mind - if you pick a standard one with 0.7V then it won't be effective until you go > 5.7V which might be more than the MCU can handle. When in doubt, add a 10k current limiting resistor to the MCU pin.
  • All diodes in your schematic are drawn backwards. The triangle of a diode points to the cathode (-).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.