Timeline for How to accept switched GND or switched Positive on a 3v3 MCU input
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 11, 2020 at 15:10 | history | edited | CommunityBot |
Commonmark migration
|
|
Oct 4, 2016 at 13:44 | comment | added | Transistor | See Figure 2 for clarification on connection options. | |
Oct 4, 2016 at 13:43 | history | edited | Transistor | CC BY-SA 3.0 |
Added Figure 2.
|
Oct 4, 2016 at 13:02 | comment | added | Transistor | You can't. That selection is done on the hardware simply by the wiring. The way I've shown the opto-isolator transistors is that they pull to ground when the LED turns on whether switched positive or switched negative. The micro will never see the 24 V circuit and can't configure it. They're completely opto-isolated. Don't forget to use the internal pull-ups in the micro. | |
Oct 4, 2016 at 12:26 | comment | added | Newbie Noob | Yep I understand now! What if wanted to select ground or 24v for every input how could I do this through firmware? | |
Oct 4, 2016 at 9:49 | comment | added | Transistor | I don't think you've got it yet. That one chip gives you to opto-isolated inputs. (1) If your switches connect to GND then connect COM to +24V and connect the two switches to In1 and In2. (2) If your switches connect to +24V then connect COM to GND (24V-). (3) You can apply 24 V directly between COM and either input as shown. The 2k7 resistor will limit current through the opto-LED to about 8.5 mA and power dissipated in the resistor will be about 0.2 W. No extra circuitry required. | |
Oct 4, 2016 at 9:43 | history | edited | Transistor | CC BY-SA 3.0 |
Improved Figure 1.
|
Oct 4, 2016 at 9:35 | comment | added | Newbie Noob | So I connect IN1 to Ground and IN2 to VIN say 24V, I would still need some extra circuitry to make the input 24V tolerant. The only down side I can see is having two output pins for the pull-select. | |
Oct 2, 2016 at 16:02 | history | answered | Transistor | CC BY-SA 3.0 |