My relay doesn't change it state

Hello
I'm testing my relay SRD-05VDC-SL-C, wich was bought in Az-Delivery, with a simple Blink program, and the relay doesn't change his state. I'm using an ESP8266 microcontroller, conecting "IN" input to a digital pin, VCC to a 5V output and GND to GND of the pcb. Whith this conection, it's always on close state.

Nevertheless, if I disconnect the digital pin and "IN" input of the relay, it changes his state (it changes to open).

I don´t have anything conected to the output of the relay.

I don´t understand why it doesn´t work, it´s a very simple testing program.

Pruebas_Rel_.ino (191 Bytes)

Hmmm.

Could you please read the forum instructions, post your code in "code" tags according to the instructions, and give us a Web link to the actual relay module you are using?

Also which ESP8266 module you are using and to which pin you are connecting the module?

Just guessing but it sounds like the output pin was not defined as an output or has a 1 written to it not a zero. Use your VOM to see if the pin changes state and that all grounds are connected. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

Relay datasheet says it wants 70+ma @5V. ATMEGA328P output pin maximum capability is 40ma. :cold_sweat:

Two problems with that answer.

  • He said "IN" - the relay datasheet does not refer to "IN"!
  • He said ESP8266!Not a bad idea to read the question. :cold_sweat:

Paul__B:
Two problems with that answer.

  • He said "IN" - the relay datasheet does not refer to "IN"!
  • He said ESP8266!

Not a bad idea to read the question. :cold_sweat:

Yep, you're right. :roll_eyes: Shame on me. Still, the sketch's only output is, presumably, to the relay, to cycle it on and off. The *8266 *datasheet says 12ma max. for I/O pins. Isn't this going to be a problem? Could the output already be blown?

The reference to "IN", 5 V to "VCC" and "GND" indicates it is a relay module containing the specified relay, in which case overloading the ESP8266 is not going to happen.

If the OP ever re-surfaced, we might know answers to my questions and even, just perhaps, be able to figure out his problem. :astonished:

Paul__B:
If the OP ever re-surfaced, we might know answers to my questions and even, just perhaps, be able to figure out his problem. :astonished:

Yes, it happens all too often.

sins OP is talking about IN, and PCB when talking about the relay, i'm guessing OP is using a module with mosfet/BJT on.. .

and the modules i have used you have to pull the IN signal LOW for it to energize the relay.

Speculation: maby the OP is using 3.3v ESP and that is not read as high enough for it to de energize the relay.

It's looking like a dead thread but ...

jonasnic:
Speculation: maybe the OP is using 3.3v ESP and that is not read as high enough for it to de energize the relay.

roberto1698:
I'm using an ESP8266 microcontroller, connecting "IN" input to a digital pin, VCC to a 5V output and GND to GND of the PCB.

So he is indeed using an ESP8266, all of which use 3.3 V.

Now when you refer to active-low relay modules, the ones with opto-couplers mostly use this circuit:

which actually requires the "VCC" to connect to 5 V in order for the ESP to pull down sufficient voltage to turn on the optocoupler and series green LED - about 3.5 V in total, so no trouble switching off at 3.3 V.

The non-isolated module you describe however,


would exhibit the problem you describe.

A third variant uses an optocoupler and is "switchable" between active-low and active-high - I do not have a circuit for it.

As I said, the OP seems to have gone to ground so we may never know. :grinning: