Relay Flickering at Startup

Thread Starter

albabcreators

Joined Jun 10, 2025
11
I have a relay module attached with esp-01 and it turns on/off at pin 2 state on/off The circuit works fine and does intended work but my esp-01 is pulled-up at pin-2 which causes the relay to turn on at circuit startup then off. I want to turn it off at startup and don't know if any additional component or such should be added to control this behaviourCapture.PNG
 
You pulled up the transistor base through R1 to 5V.
If you want the relay to be off at beginning pull the transistor base down by connecting the R1 to Gnd.

Btw, don’t use capacitor across relay coil, it’s useless and causes slow relay contacts make/break.
 

Thread Starter

albabcreators

Joined Jun 10, 2025
11
if i don't apply 3V through R1 then my ESP does not power-up; and i know it causes relay to be on but it a requirement of the esp and i want to entertain both the relay and esp but don't know how; for intended relay off at startup
 

Thread Starter

albabcreators

Joined Jun 10, 2025
11
Of course it will activate when you pull the base to V+.
Actually I want to implement GPIO 2 output to base of transistor, but this GPIO 2 is high for boot of ESP and it cannot be changed, my problem is that despite this momentary high I don't want to effect base of transistor to be high at this point; what should I implement or do so that this boot-up high is discarded or not passed on to transistor but after that transistor is attached to GPIO 2
 

meth

Joined May 21, 2016
298
I dont know which model do you use of ESP8266 but I guess there should be other GPIO pins available, why search weird solution to pull the pin high just during boot then drop it low, when you can simply use another pin?

Or if it has to be GPIO 2, a solution might be PNP transistor?
 

ronsimpson

Joined Oct 7, 2019
4,647
Why is C1 across the relay?
Leave the + end where it is on +5V.
Move the - end to ground.
I think it should be across the 5V and not across the relay. When you turn on the relay it must be charged up through the transistor. This loads down the power supply for a short time.
 

Thread Starter

albabcreators

Joined Jun 10, 2025
11
I dont know which model do you use of ESP8266 but I guess there should be other GPIO pins available, why search weird solution to pull the pin high just during boot then drop it low, when you can simply use another pin?

Or if it has to be GPIO 2, a solution might be PNP transistor?
My ESP is ESP-01 Module; it has only two GPIOs and both are required to be high on boot
PNP transistor is not working I have tried it
 

Thread Starter

albabcreators

Joined Jun 10, 2025
11
Why is C1 across the relay?
Leave the + end where it is on +5V.
Move the - end to ground.
I think it should be across the 5V and not across the relay. When you turn on the relay it must be charged up through the transistor. This loads down the power supply for a short time.
Even if I remove C1 the circuit behaved the same. My problem is the connection between transistor base and ESP-01 Module
My ESP-01 requires momentary high at both GPIOs to boot and then goes to low, this momentary high causes flick in the relay
 

eetech00

Joined Jun 8, 2013
4,704
Use GPIO4 or GPIO5.
Disable internal weak pullup or pulldown in ESP8266.
Change R1 to 10k and connect to ground.
Remove capacitor C1.
 
Last edited:

Thread Starter

albabcreators

Joined Jun 10, 2025
11
Use GPIO4 or GPIO5.
Disable internal weak pullup or pulldown in ESP8266.
Change R1 to 10k and connect to ground.
Remove capacitor C1.
1749653865110.png
is this the changes you mentioned?
I have tried these but with this my esp does not boot and relay still flicks

also there are no GPIO 3 and GPIO 4 in ESP-01 module only TX RX pins and GPIO 0 and 2
I need TX RX as is to make internet connection and can only utilize GPIO 0 and 2 which needs to be momentary high for boot
 

Irving

Joined Jan 30, 2016
4,996
Why do you need TX and RX for internet connection? Why not use RXD aka GPIO3 as its a general purpose I/O at start up.
 
Top