0

I have a Raspberry Pi 1 Model A and have a simple hobby project I'm tinkering with. I will have two pushbuttons (PB1 and PB2 respectively) wired to the GPIO pins, as well as a buzzer and an LED. The idea is to power this on with batteries.

When the pi is powered on, Raspbian will start up and a syste service (daemon) that I write will start up. Once this service is running it will power on the LED and keep it turned on until the service shuts down or the pi is powered off (obviously).

If both PB1 and PB2 are pushed at the same time, this running service will detect this and will cause the buzzer to sound. If either pushbutton is released the service will detect this and turn the buzzer off. Really simple. (Yes I realize I could accomplish this without the pi but there's more to the story here.)

I want to make sure that the hardware I've selected is compatible with my pi (especially the buzzer) and that I'm not gonna fry my pi.

The pushbuttons:

  • RadioShack brand (275-1566)
  • Momentary Pushbutton Switch
  • Contacts rated at 3A at 125VAC; 1A at 250VAC

enter image description here

The buzzer:

  • RadioShack brand (273-0793)
  • 6VDC

enter image description here

The LED:

  • RadioShack brand (276-0307)
  • 5mm
  • 1.7V
  • 20mA

enter image description here

Can I wire these components directly to my pi's GPIO pins or should I put any protective elements (resistors, etc.) in between them? Keep in mind that there would be periods of time when all of them would be operating at the same time (the pushbuttons are being pushed, the LED is being lit up and the buzzer is sounding). Or are there other parts with different ratings that I should be using? What types of batteries would work for this project (it's fine if I have to replace the batteries often, they don't have to be heavy duty this is just a toy project). Thanks in advance!

1 Answer 1

1

LEDs need a current limiting resistor. here is a answer how to calculate the resistor How to get started with basic Raspberry Pi electronics?

Buttons. Look here https://www.raspberrypi.org/learning/physical-computing-with-python/trafficlights/

Buzzer, the GPIO can deliver 3,3volt, 16mA and the buzzer is a 6volt, 45mA device. Both the voltage and the current is to high for a GPIO. So you need a external power and a driver circuit, a transistor and a resistor. Replace Arduino with Raspberry Pi in the picture.

Driver circuit

2
  • Actually @MatsK if you're still there - I just found this video on Youtube where the author doesn't add any of the stuff you mentioned (circuit driver, transistor, resistor, etc.). Any idea why? Since I'm so new to electronics, if there's an easier buzzer to work with that "just works" with my model pi I'd rather go that route, rather than muck around with driver circuits and "fancier" setups. Thoughts? Any idea what model/make that buzzer is? Thanks again!
    – smeeb
    Commented Aug 31, 2017 at 13:53
  • @smeeb A Raspberry Pi can drive approx. 16mA, and that's a 1/3 of what the buzzer consumes (45mA). And yes there are other buzzers that could be used without additional circuits, just search for buzzers that needs less than 16mA and is driven by 3.3volt. And please notice the size of the buzzer in the youtube video you refers to.
    – MatsK
    Commented Aug 31, 2017 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.