Maker Pro
Maker Pro

ESP8266 for controlling selenoid door lock

Hello, I'm new in electric and I'm trying to use ESP8266 for controlling selenoid door lock, as picture attached.

I've checked ESP8266 works fine it could get data from firebase and send data to pin.
But I could not make it works with Selenoid Door Lock.
For battery I used 9v alkaline battery and it did work for selenoid door lock without relay when I checked it out. I've also already tried to replace battery with Adaptor 12V 2A.
I've already tried to use a diode parallel to magnetic locks but still does not work.

Could you please tell me where did the wiring go wrong?

Did it not work because I use 3.3v in ESP8266 as VCC in Relay Module?
Should I add Arduino Uno for Mikrocontroller to get 5v VCC?trial2_bb.jpg
I would appreciate it if anyone could help me.

Thank you.
 

Attachments

  • trial2_bb.jpg
    trial2_bb.jpg
    119.5 KB · Views: 0
The SDR-05VDC-SL-C is a relay module that needs 5V to operate, and will require nominal 71 or 89 mA to operate (depends on type of relay (Standard or High Sensitivity)). The minimal pull-in voltage of the relay is 75% of the operating voltage, so 3.75V. Both the voltage and the current is a problem for the nodemcu. This module operates at 3.3V and can deliver a maximum of 20mA (in sync mode, 12mA source mode) per output.
There are similar relays that can work on 3V but require even more current (120mA). An Arduino Uno does operate on 5V but also cannot deliver enough current (about 40mA max).

So you have multiple issues here
- In your schematics the nodemcu is not powered
- the nodemcu cannot drive the relay (voltage and current issue) directly.

You can power the nodemcu with the 9V battery when you connect it to the Power Vin.
You should add a FET / transistor to drive the relay from the 3.3V output, but then you must also limit the voltage you provide to the relay (this one only allows 110% max (5.5V)). Simple solution here (but not really reliable / optimal when powered with a battery) is using a resistor that limits the voltage over the relay.
 
The SDR-05VDC-SL-C is a relay module that needs 5V to operate, and will require nominal 71 or 89 mA to operate (depends on type of relay (Standard or High Sensitivity)). The minimal pull-in voltage of the relay is 75% of the operating voltage, so 3.75V. Both the voltage and the current is a problem for the nodemcu. This module operates at 3.3V and can deliver a maximum of 20mA (in sync mode, 12mA source mode) per output.
There are similar relays that can work on 3V but require even more current (120mA). An Arduino Uno does operate on 5V but also cannot deliver enough current (about 40mA max).

So you have multiple issues here
- In your schematics the nodemcu is not powered
- the nodemcu cannot drive the relay (voltage and current issue) directly.

You can power the nodemcu with the 9V battery when you connect it to the Power Vin.
You should add a FET / transistor to drive the relay from the 3.3V output, but then you must also limit the voltage you provide to the relay (this one only allows 110% max (5.5V)). Simple solution here (but not really reliable / optimal when powered with a battery) is using a resistor that limits the voltage over the relay.

Hello Coen.
Thanks for your reply.
I'm currently using Relay Module JQC-3FF-S-Z, I have not found it's fritzing part anywhere else so I use SDR-05VDC-SL-C that most similar in fritzing.
I've tried to use Vin pin as someone suggested to me.
I could hear the "click" sound in relay it means that relay should be working.

But when I change the value in D7 pin, it still does not change the state of door lock.
When I tried to measure the voltage in pin D7, when the value is "HIGH", the voltage measured only 2.67V. Is that why the relay does not work?

I've powered up NodeMCU using USB cable provided plugged in to my Laptop.
I measured the voltage in VCC is around 4.35V.

Should I change the relay module instead?
Do you know what I should do?
 
Hello,

How are you powering the nodemcu?
This page shows a Vin of 7 to 12 Volts:
https://www.theengineeringprojects.com/2018/10/introduction-to-nodemcu-v3.html

The relay module needs 5 Volts for the relay to work.

Bertus

Hello Bertus, thanks for your reply.
I've powered up NodeMCU using USB Cable plugged in my laptop. Voltage measured around 4.35V.
I'm pretty sure the relay does work but when I changed the value in "D7" pin the relay does not trigger.
The voltage measured in D7 is around 2.67 V.
Do you know what should I do?
 
Hello Coen.
Thanks for your reply.
I'm currently using Relay Module JQC-3FF-S-Z, I have not found it's fritzing part anywhere else so I use SDR-05VDC-SL-C that most similar in fritzing.
I've tried to use Vin pin as someone suggested to me.
I could hear the "click" sound in relay it means that relay should be working.

But when I change the value in D7 pin, it still does not change the state of door lock.
When I tried to measure the voltage in pin D7, when the value is "HIGH", the voltage measured only 2.67V. Is that why the relay does not work?

I've powered up NodeMCU using USB cable provided plugged in to my Laptop.
I measured the voltage in VCC is around 4.35V.

Should I change the relay module instead?
Do you know what I should do?

Looking at the specifications of the relay and assuming it is the 5V version, it needs a minimal voltage of 3.75V. Besides that it will draw about 70mA. Both of these are above the output rating of the nodemcu.
My previous suggestions to use a output driver like a transistor to enable the nodemcu to drive the higher current and voltage will help.
 

Harald Kapp

Moderator
Moderator
Relay Module JQC-3FF-S-Z
The JQC-3FF is the relay. There are sevral different modules using this relay. Some modules may have the required driver transistors, others not.Which specific module do you use?
I measured the voltage in VCC is around 4.35V.
That is irrelevant. Your diagram shows you using the 3V3 pin to power the relay module which will not work for a 5 V relay:
upload_2022-2-5_15-53-18.png

The voltage measured in D7 is around 2.67 V.
If the relay module does not have a built-in driver, you need to add one. See our resource on how to do this.
 
The JQC-3FF is the relay. There are sevral different modules using this relay. Some modules may have the required driver transistors, others not.Which specific module do you use?

That is irrelevant. Your diagram shows you using the 3V3 pin to power the relay module which will not work for a 5 V relay:
View attachment 54137


If the relay module does not have a built-in driver, you need to add one. See our resource on how to do this.

I checked and I think the module already has a built-in driver.
It has 2TY for npn resistor.
 
I did it several time and it should work:
- If you use USB port as power supply, use VU pin to power (VCC) relay module.
- With some modules, you need to set the logic pin to LOW to trigger the relay. If you set the pin to HIGH change your code and try again.
 
Top