- Thu Feb 04, 2021 9:08 am
#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).
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.
Assumption is the mother of all f*ckups. At least: that's what I'm assuming.