0
\$\begingroup\$

I have got my hands on a Intel Edison system on chip. I would like to use it to detect non-zero voltage. For example I have a test point that could be either 0 volt or 24 volt and I want to detect which using the microcontroller.

What ways are there to achieve this? Is a simple voltage divider the way to go? Is there any disadvantages of doing that?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ How about a comparator? \$\endgroup\$
    – Null
    Oct 29, 2014 at 21:21
  • 3
    \$\begingroup\$ A voltage divider and a tiny bit of software is the cheapest and smallest PCB space I can think of. \$\endgroup\$
    – KyranF
    Oct 29, 2014 at 21:38

1 Answer 1

5
\$\begingroup\$

A voltage divider and a tiny bit of software is the cheapest and smallest PCB space I can think of. Shown below is a 1/10 divider, so you should be safe up to 33V on the input, and perhaps even more if the Edison has [any?] good clamping protection diodes. The capacitor is there for simple noise reduction, it is optional if you are good with firmware.

schematic

simulate this circuit – Schematic created using CircuitLab

Otherwise, give this a go! The NPN BJT called Q1 in the schematic diagram acts as a switch, taking the node below R1 to 0V when the 24V signal becomes "high". The diode D1 protects Q1 from nasty voltages, and the 10K resistor R2 can be higher if you wanted. Currently it will put 2.4mA into the base of Q1. The capacitor is there to act as a minor RC filter to help with bouncy/noisy goodness.

schematic

simulate this circuit

\$\endgroup\$
5
  • \$\begingroup\$ Thanks for a great explanasion! It just hit me that I might be able to use an optocoupler to protect the edison. Is that a good idea? I guess I could just wire it up between gnd and "to micro" in boh your drawings? \$\endgroup\$ Oct 29, 2014 at 22:12
  • \$\begingroup\$ eww gross, an optocoupler, really?? They are huge and ugly and unnecessary. The transistor Q1 shown in the second drawing is enough protection/isolation, it's much better than just a voltage divider. \$\endgroup\$
    – KyranF
    Oct 29, 2014 at 22:13
  • \$\begingroup\$ @www.jensolsson.se see above comment, forgot to tag you in it \$\endgroup\$
    – KyranF
    Oct 29, 2014 at 22:29
  • 3
    \$\begingroup\$ I would add a resistor from the base to ground in your bottom schematic. With that and R2 you can adjust the threshold voltage. Your threshold voltage is the B-E drop, about 700 mV. If the input is really 24 V, then somewhere near half of that would give you better noise immunity. \$\endgroup\$ Oct 29, 2014 at 22:33
  • \$\begingroup\$ @OlinLathrop Indeed, on my own private design for 12V - 3.3V interface I've done that, 33K ohm and 10K ohm divider, plus what is shown here \$\endgroup\$
    – KyranF
    Oct 29, 2014 at 22:40

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.