6

I'm building a morse transmitter. When the volume is up and I press a button it's beeping. (Also using JME8 I coded a program to get the signal from GPIO 17 and decode the morse to characters.) bad wiring

The 5V is needed to drive the buzzer (3,3 was too small for it), but the GPIO can accept 3,3V so I used a voltage divider.

When the volume control is muted and I press the button, the Raspberry restarts. What is wrong with my wiring? How can I fix it?


UPDATE:
When the potmeter is totally down and the button is pressed, a short circuit shows up between the 5V and the ground, thats why the Pi restarts.

How can I resolve a short circuit?


EDIT by SlySven: The details of the buzzer indicated that it IS a buzzer that can be driven by a constant DC supply - from the data-sheet that @SimonÁdám indicated: First page of data-sheet imageSecond page of data-sheet

However using a potentiometer to reduce the supplied current/voltage is not going to work properly to control the volume produced from all that I can see...

  • It may just be the way you drew it but you have the power rails backwards. Why don't you simplify the wiring and power the piezo from the 5 volt pin and connect the switch to ground. Temporarily remove everything else . Then you can build the circuit back up one step at a time. Assuming that is a pot to control the volume below the piezo shouldn't the center pin be the variable resistor and the outer 2 pins be ground and power? electronics.dit.ie/staff/tscarff/DT089_Physical_Computing_1/…. – Steve Robillard Dec 10 '15 at 22:47
  • 3
    Perhaps with the pot in the minimum position when you press the button there is a short-circuit between 5V and ground. – joan Dec 10 '15 at 23:03
  • @SteveRobillard I used this tutorial: link. It shows the opposite way than yours. Where do you see that I have the power rails backwords? I don't want to remove anything because its working like charm, except when the potentiometer is down. – adtewa Dec 10 '15 at 23:05
  • you have ground connected to the red rail and power to the blue – Steve Robillard Dec 10 '15 at 23:06
  • 2
    I think he's referring to the colours along the breadboard power rails. They don't matter but most people would probably put ground to blue and power to red. – joan Dec 10 '15 at 23:07
1

If you consider the circuit diagram I ran up (with gschem - part of the GPLed Electronics Design Automation project): schematic derived from diagram in question

Can you see how the Potentiometer has the two Red wires in the wrong place (swap them to fix it) so that if the wiper (which SHOULD be connected to the Red wire of the Buzzer I believe) is at the bottom of its travel (near the Black wire electrically speaking, then, when the switch is pressed, it SHORTS out the 5V supply to ground.

Also, R4 is redundant as the circuit seems to be - its effects are entirely repeated by R1-3!

Also, this is only going to work so that the buzzer makes a sound when the button is pressed, if the buzzer is a device that accepts a DC voltage as a power supply and uses that to power an internal oscillator to drive the sound producing element inside. Not all "sounders" work like that, some need to be driven with an AC voltage (they do NOT have an internal oscillator circuit, they need an external one). If the buzzer is a device that takes a DC voltage and makes its own sound, then feeding the supply via a variable resistor as a potential divider is a poor design - for a good rule of thumb the amount of current that can be taken out of the middle of the divider (the wiper contact on a potentiometer) should be no more than say a fifth or better no more than a tenth of the current following from top to bottom.

A better arrangement would be to disconnect the black wire from the bottom of the variable resistor altogether and then the existing mis-wiring of the other two connections to the variable resistor is not important, so that the nearer the wiper gets to the connected end the more current/voltage/power gets through into the buzzer (and less gets lost in the variable resistor) and it should get louder as expected, depending on the relative resistances that the buzzer and the variable resistor have, you will only get any sound from the buzzer when the wiper is pretty much towards the connected end.

  • Thanks. It's working with switching the two wires. I guess the tutorial here is faulty. 10K resistor near the button (R4) is not necessary indeed, I tried (I don't yet understand why). The buzzer is a piezo speaker, I believe it's for DC, I don't think it has oscillator, Before this I used oscillating signal from Arduino to drive it, but giving just the signal it's working too, I don't know how. – adtewa Dec 12 '15 at 14:41
  • This suggestion is dead wrong. It still potentially shorts a pi signal or rail (unclear which) to ground when the potentiometer is in the minimum position and the switched depressed. The whole concept of the circuit is mixed up - the poster needs to explain their goals, and then do a clean design to achieve those which does not preserve any of the many mistakes made along the way. – Chris Stratton Dec 12 '15 at 15:07
  • 1
    @ChrisStratton The diagram includes the fault - so it IS wrong - but it also says which wires are wrong and needs fixing! One BIG assumption I have made is that the sound production device which I have labelled U1 is capable of producing a tone when supplied with a DC Voltage. In that circumstance - in the circuit I THINK is intended - its purpose is to make a sound when the button is depressed, AND at the same time a signal that the button is down is sent to the Pi as an INPUT... – SlySven Dec 12 '15 at 20:07
  • 1
    ... This would be if the circuit is intended as a Morse Code trainer and the Pi is then used to attempt to decode what the user/trainee enters by tapping on the button. – SlySven Dec 12 '15 at 20:08
  • 1
    Thanks for the datasheet - I've edited your post to include it (if it is allowed) and it confirms my suspicions that it is "designed to produce a noise" when a constant (DC) supply is sent to it. That "noise" will be a 3.7±0.5 Kilo-hertz tone but it will only be 82dB with a 12V supply at a distance of 30 cm so should not be exactly deafening with the 5V from the Pi's supply - I think you can get away without a volume control after all! – SlySven Dec 14 '15 at 11:15
3

For starters your design is intrinsically flawed, you will have to make another implementation of what you want to do.

The explanation of why it is flawed is two fold.

  • Your potentiometer. The center tap is connected to the piezo, left to 5V and right to GND. A GND connection is unnecessary because a R in series with the piezo is enough to limit the current and make it sound lower. This GND connection is the reason why the pi is shorting out, because there is a direct path from 5V, then thru the button, then GND, this shorts out the supply and the PI browns out.
  • "Listening" on the voltage on the supply of the piezo is not a good idea. There will be voltage drops on both the piezo and the potentiometer so these readings won't be accurate if it even detected.

An easy solution would be for you to listen to your button, then switch the buzzer whenever the button is pressed.

The hardware solution would be the following:

Made using digikey's SchemeIt

The left input pin would be connected to the button. The pullup R2 can be ignored if you configure the input pin to be PULL UP.

The transistor Q1 would be a general purpose 2n2222 or the like, connected to an output pin on the raspberry. DON NOT FORGET THE RESISTANCE R1, a short on an output pin won't be as pretty as the shorts you have experienced.

All left to do is to code the modifications. If you by any means want to listen to the button being pressed, you will need to check another solution.

Working on electronics on a raspberry can be dangerous for the board. Be very careful next time

  • 1
    The "buzzer" is designed to work straight off a 12Vdc supply, no resistor is needed for this device - the 10mA is the maximum it is likely to take at the given voltage (and is what the circuit must be prepared to give it to work properly) - which is why using the three-wire potentiometer circuit (even if correct) is not the best idea. – SlySven Dec 14 '15 at 21:51
  • 1
    If the wiper of potentiometer in THIS circuit is at the top it is indeed a short, but the current still has to flow through the "buzzer" and the transistor (and the latter is what switches the current on and off) - if the buzzer WASN'T there the transistor will be destroyed if the pot. is in the minimum resistance position - but it is, so things are OK if the transistor can pass the 10mA when it is saturated (hard-on) when the voltage across it is probably around 0.5V - power dissipated in transistor then is 0.5V x 0.01A = 0.005 Watts which just about any discrete transistor can take! – SlySven Dec 14 '15 at 21:56
  • 1
    And Vdd for THAT bit could indeed be a 9V battery (for a bit more volume) - just remember to connect the ground of the battery to the emitter (bottom terminal) of the transistor as well. – SlySven Dec 14 '15 at 22:02
  • 1
    R2 can be around 1K but the internal pullup from the raspberry. Usually those buzzers are designed to run from direct voltage but if you are really concerned you can put a resistor on the collector in series with the buzzer. Also check the transistor doesn't get too hot or you may have to both add said resistor or find a higher power NPN transistor. @SlySven I just googled a free online schematic maker because I don't have any installed right now. – DrBomb Dec 15 '15 at 2:37
  • 1
    @DrBomb I wrote an email to SchemeIt, they said that "The designs that you create in Scheme-it are yours so you may publish them if you want." – adtewa Dec 15 '15 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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