I made a simple ultrasonic project with Arduino. Used an LCD to show the distance. Also I want to turn a LED on with a 5V relay with a switch for some reason. I'm using external power supply 7.5V 2A and regulate it with 7805 and feed the 5V to LCD back light and to relay(the LCD supply pins are connected to Arduino). Also turning on the back light with a NPN that the base is connected to 5V of Arduino.(I also common the GNDs).
So the problem is here: when the circuit is running, it works good and measure distance but when I push the switch and driving relay to turn on the LED the back light of LCD gets weak and even almost turns off. Also LCD and serial print get noise and show junk characters.
what should I do to solve this huge voltage drop and noise of relay?
-
1\$\begingroup\$ Are you measuring a voltage drop on your +5V when the relay is powered? \$\endgroup\$– StarCatMar 15, 2020 at 10:39
-
1\$\begingroup\$ Tip: turn off the background grid when taking a screenshot. It makes the text much easier to read. \$\endgroup\$– TransistorJan 28, 2021 at 14:13
1 Answer
You should reverse the connections of diode D2. The anode should be connected to Q1 and the cathode to 5V.
When you turn on Q1 the current flows through it and D2 between the ground and voltage supply forming an almost short circuit.
-
\$\begingroup\$ oh yes you're right, but when I did it the relay never runs when I push the switch. what's the problem again? \$\endgroup\$– sepehrMar 16, 2020 at 16:27
-
1\$\begingroup\$ If you use the relay OMIH-SH124D (farnell.com/datasheets/…), it has 24VDC coil. It means, that you can't turn on it by 5V. You should use another relay with a 5V coil. The better way is to connect the Led D1 through transistor without relay. Just connect D1 anode to 5V, cathode with R2 and then to Q1. Remove D2 and relay. \$\endgroup\$ Mar 16, 2020 at 18:47