-->
Page 1 of 1

ESP-01 won't boot with buzzer MODULE plugged into GPIO2

PostPosted: Wed Feb 03, 2021 11:52 am
by fr0zt
Hello,

I'm trying my first project with an ESP-01s. I am trying to control a passive buzzer module, but the ESP8266 won't boot when the signal wire is connected to GPIO2 on boot.

The same question has already been asked for a buzzer (not a buzzer module) here: viewtopic.php?f=160&t=16177

In that thread, a workaround was suggested to connect the buzzer between 3.3v and GPIO2 rather than between GPIO2 and ground, so that the buzzer receives 0v on boot.

In the case of the buzzer MODULE, there are 3 pins (VCC, GND, S). Does anyone know how I can drive this from my ESP01? At present, I can only get it working if I boot with the buzzer disconnected, and then connect it while running.

Thanks!

Re: ESP-01 won't boot with buzzer MODULE plugged into GPIO2

PostPosted: Thu Feb 04, 2021 2:15 am
by JurajA
it is io 2, not gpio 2. use a different pin. io 2 must be HIGH at reset for normal boot. you can't connect to it a device which pulls the pin down

Re: ESP-01 won't boot with buzzer MODULE plugged into GPIO2

PostPosted: Thu Feb 04, 2021 9:08 am
by QuickFix
JurajA wrote:it is io 2, not gpio 2.

Huh?
The ports/pins of an ESP8266 are called GPIO (for "General Purpose Input Output") and is equivalent to IO or I/O if you like.

With some development boards (like the NodeMCU and Wemos) there's always some confusion between the D (for data) lines and the actual GPIO port they belong to, but the ESP-01 isn't a development board and the pins are just called what they are: GPIO (or I/O or IO, whatever you like).

Image

But, as said: GPIO0 and GPIO2 are best to be pulled high for normal boot (to program the ESP GPIO0 should be pulled low and GPIO *could* have an undetermined state).

GPIO2 acts as a serial debug port (copying GPIO1 at boot), so you might want to pull it up (using a 1k~10k or so resistor) and on the cold end connect a transistor to drive the buzzer; that might possibly work.
But mind that, since GPIO2 is the debug port, you might hear a short buzz at boot, until you've set the pinMode of GPIO2 to OUTPUT.

Something like this (might need some tweaking):
Buzzer.png

Since you didn't mention what (type of) buzzer module you're using, I've drawn up a generic driver schematic; the resistor to Vcc might not be needed (depending on the signal input of the module).
As for the transistor: any generic NPN type would suffice, like the 2N2222 or the BC547.

Re: ESP-01 won't boot with buzzer MODULE plugged into GPIO2

PostPosted: Fri Feb 05, 2021 1:39 am
by JurajA
it is not "general purpose" because it is a boot configuration pin.