So Im building a basic door lock however im having some issues with the power input,I am trying to use a DC input of 12V and 2amps, which will go to two places one the relay part that goes to the solenoid, and the other part will go to the breadboard which will go through a voltage reducer down to 5v, this 5v will power the arduino through the VIN in the arduino.The problem is that when I use the usb power for the arduino separately from the 12v supply everything works however when I use the schematic shown above the relay does not work at all. I would really appreciate any advice.
It should go to the 5V pin, not Vin pin.
Also, the black wire from your solenoid is connected to the wrong rail on the breadboard. EDIT: oh, hang on, you are using the rail next to the red line as ground and the rail next to the blue line as 12V. That's unusual and confusing. But, whatever, the connections are wrong and the solenoid cannot activate like that.
You need to add a fly-back diode across the wires to the solenoid. 1n4001 for example, cathode to 12V, anode to ground, to protect the circuit from negative voltages induced when the solenoid is switched off.
Hey Paul thanks for the answer!, I will place a fly-back diode. However I just tried switching the cable from the VIN to the 5v and the relay still does not work as it should. And yeap the red cable from the relay end is wrong but only in the schematic. Just updated the schematic.
5V still connected to Vin.
Please do not update your previous posts like that. It's ok to edit them for spelling errors, broken links, missing code tags etc, but don't change them in a way that makes the replies stop making sense. For the sake of others reading the forum, who may be facing similar issues to you, let them see what you did wrong originally and how you corrected it later in the topic. That way, they can see if they made the same mistake as you did and learn from that.
Not sure why your relay module is not working now. It would have been better to use a 12V relay module because you have a 12V battery. Even better would be to use a logic-level MOSFET.
Try connecting the yellow wire in your diagram to 5V. Does the relay activate then?
Does your stepdown module supply enough current to run everything?
Why?
Only because then @chriscarp22 could avoid burdening the dc-dc converter with supplying current to the relay coil. In some circuits it might have been possible to remove the dc-dc converter and power the Uno with 12V to Vin. Yes, I know you don't approve of recommending that, and I only do so where the 5V demand is very low, and I warn about the dangers. But in this case, the RFID reader (assuming that is what it is) will be quite hungry for 5V power, which might cause the Uno's regulator to overheat if powered that way, so the dc-dc converter is still required and the benefit of the 12V relay is marginal.
@chriscarp22 Most RFID readers sold for use with Arduino need a 3.3V supply. Are you sure your module can accept 5V?
If I believe his schematic Fritzing (and I am surprised no-one mentioned the MB102 boards with a break in the middle of the power rails), it shows a switchmode "buck" converter which will find the relay no "burden" and be just as power efficient as using a 12 V relay.
My concern is that not all relay modules are "high level trigger" and there might be a 12 V "low level trigger" module.
I was wondering what it might be.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.