(SOLVED) Relay wont switch but signal is on

Hello everyone! im having an issue that you might be able to help.

I want to make an automatic irrigation system. When the sensor detects dry soil and the water level sensor knows theres enough water it would turn on the pump and start irrigating.

Everything is working except the relay. im connecting the relay module to vcc, gnd and signal (digital output of arduino through a transistor.)
When its time for the relay to switch, the led signal turns on but it wont switch (theres no click sound).
I wanted to test the relay module if maybe it is damaged by connecting vcc, gnd, and the signal to vcc but it doesnt work. Not very familiar with this module, am i doing something wrong? (i tried another module and same problem)

i attach the diagram an 3 pics when is off and on.

any help is well received!

thanks a lot

When the LED comes on, what's the V drop across the LED? 1.5,6,7,8V Is 1.5,6,7,8V enough to turn on the transistor?

Im not sure if this is what you are asking but if i measure with the multimeter the output of the transistor (N) with a vcc it shows 5V

A 10k base resistor is too large, try 220 Ω

The LED on pin 13 needs a series resistor.

Thanks for the answer but still cant make it work.

I connected the pin 13 to a 14ohm resistor (i dont have a 220 right now) with the base of the transistor. And when i measure the output of the transistor when its supposed to be off it says 3.7V (measuring the output of the resistor with a vcc). When its on it says 5V

any thoughts?

thanks!

Yea, a thought. It is very strange that the O/P of a GPIO pin when low is 3.7V.

If you detach all items hooked to the GPIO pin does the pin go from 5V to 0V?

Do a test on the transistor with the DMM.

You see, from your schematic, you put a diode from a GPIO pin to ground withOUT a current limiting resistor, that can cause damage.

Oh, +1 for your original posting.

The relay board has transistors and diodes built in, you don’t need an external transistor (which appears connected wrong anyway).

awsome thank you both, ill try that and keep you posted!

Update! so i tried removing the transistor and diode and connect directly the pin 13 to the signal of the relay.

The relay module does turn on when its supposed but theres not enough power to make the switch. I can tell by the led of the relay module that is not fully bright.

any thoughts?

thanks!

Did you happen to try another gpio pin?

well after many frustrations i found the mistake!!
In the code i wasnt stating the pin13 as an output.

the pinMode(13, OUTPUT); was missing.

:smiley:

thanks everyone for the help

felipesosadiaz:
the pinMode(13, OUTPUT); was missing.

thanks everyone for the help

Good job!

Editing the initial post title to include "[SOLVED]" may help others in the future.