I cant turn off my water pump via relay

Ok, I got it.
At this point i think that the problem is the ESP8226 itself, probably the micro controller can't output enough current on I/O pins, to use the relay with the ESP8226 you need to drive a transistor that drive the relay.
The ground needs to stai in common with the ESP, the relay, and aniting else.

Thank you i will try to do this. But i have a question is that a 9,7k or 4,7k

Quite big alkalines to my eyes, did you measure voltage of them with yours?

It's 4.7K, sorry :sweat_smile: i'm really tired but I have to finish studying physics :smiling_face_with_tear: and i want to go to sleep :smiling_face_with_tear:

1 Like

Just show us your relay module pic in details, so one can recognize the optocoupler circuit used.

It seems to me that they are normal alkaline batteries, due to their size and the graphics and logos on them, i've a similar varta batteries, however I don't think it matters much since in the circuit they are only used to power the pump and that's it

That I agree!

1 Like

It was simple :joy:

To measure voltage with eyes? Tell me how... :face_with_monocle: :stuck_out_tongue:

:rofl: I assumed that the batteries was all alkaline batteris, the voltage of an alkaline cell is 1.5V, so 1.5V*4=6V

Drawing show 18650.

That's why I asked...

Yep, drawing, but not the pictures

Arduino pin outputs 5V, ESP32 pin outputs 3.3V.
Not all 5V relay supports 3.3V logic (in IN pin). Please make sure that your relay module supports 3.3V logic. You can see a relay that supports 3.3V logic here: https://www.amazon.com//dp/B0B1ZHXXXD

Hi!
I'll try to help you, I can't really understand your program since I work with different and perhaps simpler methods, anyway.
Not knowing if your program actually turns off the pump, you could check it using the serial monitor, this way from the computer you can see the status of the relay variable.
If the problem is not software, it could be the relay module that needs a voltage of 5V to switch states. you can do this via a transistor that is activated on the output pin of the micro controller, which in turn will control the relay.
There could also be other problems such as the undersized transistor and therefore when it trips the contacts melt and to open them you have to detach them by giving them blows for example.
I really don't think this is your case, also because a relay like that can handle higher loads than the pump you use.
this is a good product
Have a good day

This unfortunate not really explaining the 3.3V and the alkaline batteries

Hi, @gabbofox
Using some maths...


Only 2V6 on the input pin of the relay module.
Is that enough to activate the relay?

Needs to be checked with DMM.

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

Yes. I do not know that the circuit @gabbofox pffers in #21 will work.

I do know that this circuit will

or that someone will say it doesn't and offer a third circuit.

a7

Maybe you should post a diagram of your ACTUAL components instead of generic pictures strung together with colored lines..

1 Like

No no, the relay input would practically receive 5V, that transistor when in saturation has a drop between C and E of a few mV. while when the transistor is not conducting the relay input is brought to 0V of the resistance that pulls bown.
I have already used those transistors, perhaps the only problem is the fact that it is positioned with the collector connected directly to 5V and with the emitter not connected directly to ground.
I'm going to make the circuit and try to see if it works