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

User avatar
By fr0zt
#90402 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!
User avatar
By QuickFix
#90413
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.
You do not have the required permissions to view the files attached to this post.