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

User avatar
By vitorrossi
#82302 I have put together a small circuit to operate a 5V solenoid from GPIO0 on the ESP8266 (01).
When power is connected, the solenoid momentarily actuates ON and back OFF (unwanted behavior).
Afterwards everything works normally, and I can open/close the solenoid from the website hosted on the ESP01.

The behavior at boot is unwanted, but I am not sure why it is happening.
R5 is the pull up resistor on GPIO0 which in my understanding should prevent this from happening.
I have attached the circuit schematic, and an oscilloscope reading of the voltage on GPIO0 when the power is turned on.
Can anyone identify what I'm doing wrong?

Thank you!

Image

Image
Last edited by vitorrossi on Mon Jun 17, 2019 11:08 am, edited 1 time in total.
User avatar
By rudy
#82304 A high on GPIO0 is needed for the ESP8266 to run your program. This high is turning on the transistor that is driving your solenoid. When your initialization code executes, and you configure GPIO0 as an output with a low, then the high driving the transistor is no longer present and the solenoid turns off.

If you have to use GPIO0 then the off state for the solenoid needs to be a high. You can use a common emitter connected NPN transistor between the port pin and the current transistor driving the relay. I would prefer to use a PNP, with the emitter connected to VCC and the collector supplying the current for the base of the darlington transistor. (pull down resistor to turn the darlington off)

Image
For the PNP circuit, on the left, use VCC and not 5V as in the image. If you use the circuit on the right, make sure the base resistor does not prevent a sufficient for GPIO0. You may have to decrease the resistance of the pullup resistor.

I don't know why you are getting those transitions during the high time.
User avatar
By rudy
#82311 I knew GPIO2 could put out serial at start. I didn't know that GPIO0 was a problem as well.

I have never used the ESP-01 since I disliked the lack of available IO pins. I typically only use GPIO0 and GPIO1 for I2C communications or to drive an LED as an indicator.