??? 08/06/06 14:32 Read: times |
#121743 - Using a transistor Responding to: ???'s previous message |
The correct way to drive a buzzer is using a transistor. You can use any PNP or NPN with hFE higher than 100 (a BC547 or BC557 would fit).
Using a NPN transistor: connect a 10k resistor between to the port pin of the MCU and the transistor's base. The emitter goes to ground and the collector is tied to the buzzer(-). The buzzer(+) is tied directly to +5V (no resistor is needed). Using a PNP transistor: connect a 10k resistor between to the port pin of the MCU and the transistor's base. The emitter goes to +5V and the collector is tied to the buzzer(+). The buzzer(-) is tied to GND (no resistor is needed). It's best to use a PNP transistor, since the MCU can source more current in low level, but the NPN should work too. Good luck! Leonardo. |