A buzzer will produce a single audible tone when a voltage is applied and current passes through it. To play different tones or musical tunes consider using the piezo instead.
Buzzer
Schematic
PCB
Activate a buzzer
The following program will activate a FET or Darlington transistor connected to output B.1, which in turn will sound the buzzer, for a second every five seconds.
- Code Example:
-
main: high B.1 ; Switch on output B.1 pause 1000 ; Wait 1 second low B.1 ; Switch off output B.1 pause 5000 ; Wait 5 seconds goto main ; Loop back to start
Copy Code Submit an Example
Create Module
An buzzer may be connected via a BCX38C darlington transistor.
Bill of Materials
Description | Code | Qty | |
---|---|---|---|
Buzzer | SPE005 | 1 | Buy Now |
BCX38C Darlington driver transistor | TRT002 | 1 | Buy Now |
1k resistor (pack 100) | RES1K | 1 | Buy Now |
1N4001 Diode | RES041 | 1 | Buy Now |
Simulation
Submit Your Own Code!
You must be logged in to submit code examples. Login now.
Share