6V Buzzers on switches with pull ups ?

Noob Question
As you can see on the diagram
I have 3 switches going to digi pins all works fine :slight_smile:
But I wanted to add a buzzer to each switch (note, switches are 50meters from arduino) and one central buzzer that work for all the switches
I got some nice little 6v buzzers and one double buzzer for the center but it would seem the pull up resistors are effecting my buzzers ??
Im sure there is an obvious answer but I cant see the wood for the trees
its an ADK Mega if that makes any differance ie has build in pull ups I could use if that would help ?

and heres the code incase that helps too:

#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>

AndroidAccessory acc(Blah
"Blah",
"1.0",
"blah",
"0000000010100111");

int t0;
int switchPinI = 2;
int switchPinA = 3;
int switchPinB = 4;
byte msg[7];
unsigned char lastStateA = 0;
unsigned char lastStateB = 0;
unsigned char lastStateI = 0;
unsigned char newStateI = 0;
unsigned char newStateA = 0;
unsigned char newStateB = 0;

void setup()
{
// Serial.begin(115200);
acc.powerOn();
pinMode(switchPinI, INPUT);
pinMode(switchPinA, INPUT);
pinMode(switchPinB, INPUT);
}

void loop()
{
if (acc.isConnected())
{
newStateI = digitalRead(switchPinI);
newStateA = digitalRead(switchPinA);
newStateB = digitalRead(switchPinB);
if(newStateA!=lastStateA || newStateB!=lastStateB || newStateI!=lastStateI)
{
unsigned long int longInt = millis();

msg[0] = (int)((longInt >> 24) & 0xFF) ;
msg[1] = (int)((longInt >> 16) & 0xFF) ;
msg[2] = (int)((longInt >> 8) & 0XFF);
msg[3] = (int)((longInt & 0XFF));

msg[4] = newStateI;
msg[5] = newStateA;
msg[6] = newStateB;

lastStateA = newStateA;
lastStateB = newStateB;
lastStateI = newStateI;
acc.write(msg, 7);
}
delay(50);
}
}

circuit-diagram.jpg

it would seem the pull up resistors are effecting my buzzers ?

What pullup resistors? You do not have the internal ones enabled.
You do not show any external resistors.
Do you have just the 1 external pulldown? Or is that supposed to represent a resistor per pin?
How are the buzzers connected?

Acelliott:
I have 3 switches going to digi pins all works fine :slight_smile:
But I wanted to add a buzzer to each switch (note, switches are 50meters from arduino) and one central buzzer that work for all the switches
I got some nice little 6v buzzers and one double buzzer for the center but it would seem the pull up resistors are effecting my buzzers ??

There are no pullup resistors in your diagram, and you are not enabling the internal ones.
There are no buzzers in your diagram

and heres the code incase that helps too:

Please put your code into code tags. Highlight the code, then click on the # icon above the editor.

Sorry my mistake, yes three pull down resistors one per switch

So, closing the switch is supposed to send 5V to the buzzers as well?

Yes the switch needs to send 5v to the buzzer as well
if I make the resistors pull up I get a delayed weak buzz and if I have them bull down I get nothing,
without the resitors and Arduino the buzzer is fine

Change the 1K to something higher, like 10-20K. You need very little pulldown current for the pin to be read as a Low.

How much current do the buzzers need, and where is it coming from, both when they work and when they don't?

Acelliott:
Yes the switch needs to send 5v to the buzzer as well
if I make the resistors pull up I get a delayed weak buzz and if I have them bull down I get nothing,
without the resitors and Arduino the buzzer is fine

It's incredibly difficult to supply any meaningful help if you don't show us the schematic and tell us the type (or electrical characteristics) of the buzzers.

3x on each switch
Buzzer Specifications:
Type Voltage Impedance Frequency Output at range 30cm
6V 4 to 9V 240? 400Hz 75dB

and 1x in the center

Specifications:
Supply voltage range: 6 to 15Vdc
Recommended operating voltage: 12Vdc
Current consumption at 12V DC: 85mA max.
Sound pressure level (at 1m): 105dB (with 12V supply)
Frequency: 2.5 to 2.8kHz (Preset provided for adjustment)

At the moment the power comes from a 7.4v 5000mAh Lipo through the APK

through the APK

As in connected to the 5V pin on the power header? Or somewhere else?

Yes the 5V pin
of couse this was how it was meant to be without the buzzers

the project works fine without the buzzers. I could go for smaller buzzers in the three switches but I need the twin in the center

Hi, I think at this stage we need an up to date correct wiring diagram. As you say the first one was not accurate at all.
I would have reservations over running a buzzer on the arduino input, how much electrical noise do these buzzers make?
Also are all these buzzers in the one location, why do you need a buzzer that works whenever any button is pushed as well as a buzzer for any specific button?

Tom.... :slight_smile:

This is how it should be without buzzers
but I want a buzzer on each switch an a load one in the center that works for all three switches

Sorry about the dodgy diagram but you get the idea :slight_smile:

The switches are 50 meters away from the main unit. the buzzers are so the person pushing the button knows they have pushed it (without looking) and the main big buzzer at the main unit is so the person in the middle also knows

This is What I was trying to do lol
but still want to add one big buzzer at the unit :slight_smile:

Wired_2.png

Acelliott:
This is What I was trying to do lol
but still want to add one big buzzer at the unit :slight_smile:

Running 5V over a 50 metre wire to run a buzzer is a bit optimistic I think. Your specs on the buzzers did not mention the current draw at 5 V, but the more current it takes, the less likely it is to be loud enough.

You say you are using 7.4 volts. I'm unsure of what you mean by APK, but is the power wired to the barrel-style power connector on the Arduino board? If so, and if you are taling 5V from the Vin pin on the six-pin header, it will make matters even worse You might want to run the buzzers directly off the 7.4 volts instead.

Hi, thanks for the diagram, do you have a spare output on the arduino that you can program to sound the main buzzer when any of the inputs goes HI.

Tom... :slight_smile:

I think all you need is this, no transistors to drop more voltage across.

If I run the direct from the 7.4v power will it be ok to go straight in to a the Arduinos inputs or will I need to bring it back down to 5V ?
And yes I would like to program an output to sound the siren but again need more than 5v

Why not use opto-couplers?

They are cheap, easy to use, will completely isolate the different voltages and also help protect your Arduino from induced spikes and interference that comes with long lines connected to it.

See attached diagram.