So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Eye
#73953 Hi,

I'm a beginner with ESP8266 and Relays. I'm comfortable with the programming part. However, the hardware part is very difficult.

Actually, the ESP8266 is fine. I've succeeded to upload the program, and it works ;-)
I'd like to use a 5V relay. The best thing I can do is to turn on or off a very small LED on the relay. But the relay doesn't coil. I tried with a second relay, and the LED is even less bright.

The relay needs 5V, so I'm using 5V for the relay and 3.3V for the ESP. The ground is common. The relays I have are like this one (6 pins): http://www.chinalctech.com/index.php?_m=mod_product&_a=view&p_id=1005

Is it a problem with the 5V power supply module? It's my phone charger, so I thought it would be enough power... Thanks!
User avatar
By aledrus
#73963 LED brightness is a function of amperes.
5V is more than enough. I don't quite understand what you mean by "relay doesn't coil", could you rephrase?

Could you also attach your schematic especially for the LED part?
User avatar
By Eye
#73981 Thank you very much.

I meant there is no contact between NO and COM. Even if the LED is on. The contact is always between NC and COM.

ESP is powered with 3.3V. I’m using the GPIO 0 (connected to the ground) to flash the wifi board.

The GPIO 2 is linked to the relay in+ (the third one from the top - see link in the previous post). And there is a jumper between the two pins near the ground.

The 3.3V and the 5v power supply ground are connected to the relay ground. The +5V is connected to the relay VCC.

About the LED part, it’s embedded in the relay board. It seems there are resistances and a transistor. But I don’t have the schematic.

Thank you very much!
User avatar
By aledrus
#73990 From the link to the board I see two resistors, one transistor and a diode and an LED.

One of the resistors is for the LED.

The other resistor would be to limit current into the transistor base. The question now is if the transistor is an NPN or a PNP transistor. How you would activate the relay depends on this.

You can know if the relay is activating or deactivating by listening for a click.

Personally, I would test the relay board first. Connect its VCC to 5V on your power supply, then its ground to your power supply ground. As for the trigger, I don't know if it could operate on 3.3V or 5V. If the transistor (as above) is an NPN it wouldn't matter but if its a PNP it does.

I would suggest making the above connection then with your 3.3V supply connect its ground to your 5V power supply ground. Turn on your 5V power supply then wait one second. Then touch the 3.3V source to the relay trigger pin. You should hear it click.

If not, then try without the 3.3V altogether and just connect the 5V from your power supply to your trigger after one second. Meaning turn the relay on with 5V, wait one second, then connect another line from that 5V to your relay trigger. You should hear it click.

If that doesn't work either, connect the ground from your 5V supply to the trigger pin. You should hear it click.

This test is without using the ESP. Just your two power supplies and the relay board.

If you have documentation with your relay board then this tests aren't necessary.

Once you hear the relay clicking, attach a multimeter to your NO and COM and set it to buzzer mode. By writing down the voltage necessary at the relay trigger and your NO/NC - COM connections you can figure out what you need to write in your code to activate the relay.

Let me know if this helps.