I need to control a led on my weigand reader it gives 5v out on led wire if i connect gnd to the led wire the led glows to green other wise red . Now i want to control the led using Nodemcu(mico controller with pin output 3.3v) . I want to use its digital pin to control the led of the Weigand reader .I tested it and it works fine .But i am giving the 5 v directly to 3.3v pin so i am little bit nervous long exposure of 5v could damage the board .I don't need any data to pass just make it high and low to control the led of the reader.
I need to give some voltage return to turn led back to red otherwise it will always green.I am controlling the Led by using the nodemcu pin high and low
Does this mean that the same wire is used as an input and an output to/from the ESP32? How would that work?
Or do you use two GPIO's, one as an INPUT and the other as OUTPUT?
At what voltage does the led switch from green to red and vice versa?
In general, if you want to make a 5V output from a 3.3V ESP32 GPIO configured as OUTPUT, you can do something like this:
The 5V output will go LOW if you write the ESP32 GPIO HIGH, so it's an inverted output. You can take this into account in your code.
For M1 you can use virtually any small signal MOSFET; I generally use BSS123 or 2N7000/7002 here.
You can replace M1 with an NPN BJT like BC847, 2N2222 etc.; in this case increase R3 to 1k and leave out R4.
Ok i think i am messing things up. I ll go one more time . I am using Weigand reader that operates on 12v it gives 2 wires out that gives data and 2 wire to control the led and buzzer.if the these 2 wire(led and buzzer) got connected to gnd it will work (buzzer start making buzz and led will turn green) so when not connected to ground it works as default (buzzer no sound and led is RED). since i am using nodemcu to read the data from reader .i want to control the led to with it
Ok, so what you can do is take the schematic in #5 above and leave out R5, and connect the '5V OUTPUT' to the buzzer and the LED wires of the reader. M1 will pull down the wire to GND when you set the ESP32 output HIGH.
Is there any way simpler i don't to add many other components to control the led .If i reduce the current by using resistor in series would it destroy the board in long use
Damm not the answer i was expecting for. By the way how about i use it with opto coupler not a good suggestion i know that i want less items there and control the led too do you have any better ideas
I'll try that ,by the way i need to know i am using an 12v smps wall adapter to power the circuit to extent the cable i cuted down the cable and extended by adding few meters of cable .Do i need to add any capacitors at the input .