Buzzer to raspberry pi 2 lazarus / 37-Linux PDAs ---------------------------------------------------------------------- xinyiman · 2016-04-29 16:03 Hello guys, I bought a buzzer for my raspberry pi 2. Now comes the difficult, after connecting how do I let him make a sound? Thanks for the help ---------------------------------------------------------------------- xinyiman · 2016-05-02 07:25 Any suggestions? No one has ever done this with Lazarus? ---------------------------------------------------------------------- SymbolicFrank · 2016-05-02 08:02 A buzzer is like a switch. It "clicks" every time you turn it on or off. To make it buzz, do that very fast. First you have to find out how it is connected. If it is simply connected between +3.3V and a GPIO pin, use a library for that, a timer, and just swap the state: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure MyTimerOnTimer(Sender: TObject);begin  MyTimerPin := not MyTimerPin;end; ---------------------------------------------------------------------- xinyiman · 2016-05-02 08:07 for my buzzer I have three cables Yellow: in Red: vcc Black: gnd The gpio is the raspberry pi 2. Tell me about what you want to pin gpio I put them so we reason with the same data. Also refer to a library. To what are you referring to? Thanks ---------------------------------------------------------------------- SymbolicFrank · 2016-05-02 08:27 GPIO Library. If it has three wires, it has a built-in resonator, so you only have to turn it on once to get it buzzing, you don't need a timer. ---------------------------------------------------------------------- mig-31 · 2016-05-02 08:36 You should use a buzzer with voltage supplied by Rasberry Pi. Default is 3.3V.  Connected +3.3V and GND pins to your buzzer. ---------------------------------------------------------------------- Thaddy · 2016-05-02 08:47 Quote from: mig-31 on May 02, 2016, 10:36:31 amYou should use a buzzer with voltage supplied by Rasberry Pi. Default is 3.3V.  Connected +3.3V and GND pins to your buzzer. Yup, but that's not all: Given is: Yellow: in   // this controls buzzing or not (hi or low), choose any suitable pin from the GPIO Red: vcc    // is the 3.3V pin, use a hot pin, there are at least two depending on your Pi Black: gnd// is ground. Some buzzers just require red and black, though, as suggested. Yellow should bring down vcc as well. If the buzzer itself is dumb, you can use a pull-up resistor for that between the yellow pin and vcc. See: http://www.seattlerobotics.org/encoder/mar97/basics.html ---------------------------------------------------------------------- xinyiman · 2016-05-02 13:24 Thanks for the suggestions. I did a little test but does not work. I attach the test source and the photos of how I connected the buzzer to 2 pi raspberry. Strangely me error: Error mapping gpio registry Thans ---------------------------------------------------------------------- xinyiman · 2016-05-02 13:25 My connection ---------------------------------------------------------------------- SymbolicFrank · 2016-05-02 13:50 Do you have a multimeter? First, find two pins with 3.3V and one with 0V. Connect the black cable to 0V and the red to 3.3V. You should hear silence. Now connect the yellow to 3.3 as well, and you should hear a buzz. No? Ok, some more explanation. You want to power something. That requires that those pins can deliver that power. Power supply pins can do that, processor pins cannot. So, you want the red cable connected to a power supply pin. The easy way to test this, is that the power on the red and yellow pins has to stay above 3.3V when connected. If it drops, it was a processor pin and not a power supply pin. When you found the right pins and the buzzer makes noise, it is time to program a pin. Write and execute your program and measure if the voltage on the pin switches between 0 and 3.3V. If it did, use that for the yellow cable. If it still doesn't work, you need a pull-up resistor, like Thaddy posted. Start with 10k, if that doesn't work, try 4.7k. If it still doesn't work, post specs. ---------------------------------------------------------------------- Thaddy · 2016-05-02 14:58 Quote from: SymbolicFrank on May 02, 2016, 03:50:41 pmDo you have a multimeter? First, find two pins with 3.3V and one with 0V. Connect the black cable to 0V and the red to 3.3V. You should hear silence. Now connect the yellow to 3.3 as well, and you should hear a buzz. Correct for test... But not correct for programming... Don't, plz, don't (if by chance they are parallel you have a lot more than you want) connect two hot lines, Use a switch line. There are plenty. The correct way to test is connect the yellow wire to the red wire, connect to hot and black to earth. If you're not deaf, disconnect immediately. It is not easy to blow up a buzzer, but you can....