Ultrasonic goes off and LCD go crazy and display weird characters when i activate water pump through relay and 9v battery

When i activate the water pump, positive water pump is connected to NC of relay, postive 9v battery is connected to COM of relay, and both negative terminals of pump and battery are connected together, when i activate nodemcu, everything seems normal, the LCD display the texts i want, once i activate the pump, the ultrasonic stops working and lcd displays weird characters, and even after turning off the pump, everything stays messed up, i have to restart the system. I saw a topic similar to this but i couldnt know what is the exact solution? Please help.

Welcome to the forum

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Covid

Please post your code and a schematic of your project. A picture of a hand drawn schematic is good enough

Is the 9V battery a type PP3 by any chance ?

  • Place a kickback diode across the relay coil.

  • Place a kickback diode across the pump.

  • Try an I2C LCD


Always show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

What type of 9V battery are you using ?
Hopefully not a square PP3 type.

my drawing might be a mess and not clear but tried my best. When i search for 9v battery sqaure pp3 there are alot of 9v energizer batteries which i exactly have right now, is this the problem?

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Most probably: yes.
These batteries do not have sufficient capacity to drive a relay.

6 AA batteries might do the job.
But easier would be a proper power supply.

How about using power from USB or power adapter for testing. If it works, the problem is on battery that may not provide enough current when the relay is activated

i removed the 9v battery and connected a power supply in the same connection, the process worked for like 10 seconds, everything was fine, the LCD didnt change characters and i was able to activate or stop the pump normally but then suddenly it stopped working and it won't work again. i re-uploaded my connection and code and explanation, i need a stable solution, i will try 6AA battery now and see if it works. This is so hard, someone else in another forum managed to solve this, he used diode or capacitor i am not sure he didn't explain well, also, his diagram and connections are not clear as well, the diagram doesn't have the names of each object. Anyway, soneone please help...

Post a picture of your wiring, especially the relay.

whats the lcd, is it char lcd, graphics lcd, 7 segment lcd, nokia 5110/3310 lcd,TFT LCD shield,ST7789 3.3v TFT LCD,VGA,EGA,CGA. also do you use uno/nano

i drew a picture of connections up and explanation of all connections. a picture of Real connections here won't let you understand anything because there are so many cables. S or input pin of relay goes to RX pin of nodemcu, G of relay goes to G of nodemcu, and +ve of relay goes to 3v pin of nodemcu. +ve of battery goes into COM and +ve of pump goes into NO, and both negative terminals of battery and pump are connected together.

Then do you have the kickback diodes @LarryD mentioned?

i am using NodeMCU ESP8266 on arduino IDE. LCD is 1602 with i2c connected, i am not sure how can i know its type exactly. this is a link of what i have:

If i have them, where and how do i connect them? how many do i need?

From post#6 the OP is trying to directly drive a relay coil with a 3.3V device. That's an issue. The 3.3V GPIO does not have enough arse to drive the relay coil. Do a search on "arduino relay bjt" and you'll get a hint or 2 or three or none on how to drive a relay coil with a GPIO pin.

Unfortunately your schematic was not there yet when I recommended a proper battery.
Still the proper battery is a good idea, but feeding a relay from 3v3 is not a good idea.
You have probably blown your voltage regulator. It might start working again after cooling down if you are lucky...
Otherwise, try to feed your board with 3v3 from some other supply. Without the relay!
Is it a 3v3 relay?
Can you share a type number of the relay?
A relay needs quote some peak current. The on board regulators cannot supply that...

His diagram indicate he hooked the relay to the board's 5V pin and ground.
Depend on how much power the relay need it might be both over the 500mA of the USB fuse and the on-board step-down regulator.

also char lcds (you have) is works with 5v not 3.3v, 3.3v is for advanced screens like ST7789

Hi, @Electro_maker
Welcome to the forum.

It will help, as we can see how you have arranged your hardware.
So please some images of your project.

Please post your code as per the below instructions, in a new post.
To add code please click this link;

Thanks.. Tom.. :smiley: :+1: :coffee: :australia: