I am using an Arduino Uno to light up the LED buttons for an arcade machine console. There are about 18 Buttons in total. 9 red and 9 blue.
i am using digitalWrite(ledButtonPin, HIGH); to turn the buttons on and off.
whats happening is that only the blue buttons are turning on.
when I remove the wire from pin 13 and place it in 5v then all the buttons turn on.
I'm guessing the different color buttons have slightly different voltage requirements.
here is the problem though. when the buttons are connected to pin 13, the output voltage is only 3.5 volts. The arduino is plugged into power outlet. The connections for ground and power for the buttons are daisy chained together and plugged directly into gnd and pin 13. The wire length is about 4 feet between the arduino and the leds
I'm defining the pins as output.
void setup() {
pinMode(ledButtonPin, OUTPUT); //* declare LED as output
pinMode(ledMarqueePin, OUTPUT); //* declare LED as output
pinMode(inputPin, INPUT); //* declare sensor as input
Serial.begin(9600);
}
and then using digitalwrite to set pin 13 to high, but it isn't providing enough voltage.
Are you missing something? YES. LEDs are current operated, not voltage. Each needs about 20 ma. What are you using for series current limiting resistors? 220 ohms are normally used. Each color actually needs a different current, but not really critical.
If you are trying to run more than 1 LED from an Arduino pin, no wonder you have problems.
Two pins are the switch. You can wire the switch between an input pin and ground.
But you must enable the internal pull up on the pin if you don't use an external pull up/down resistor.
pinMode(inputPin, INPUT_PULLUP);
The other two are the LED. You NEED a current limiting resistor in series with the LED.
Failing to do so could damage the pin and/or the LED.
The CL resistor can be between 220ohm and 1k.
=470ohm is better if you are using more than one LED/button.
Leo..
Paul_KD7HB:
Daisy chained means they are all in series between pin 13 and ground. Is this what you mean? How many connections on the base of a switch button?
Paul
I have power running from pin 13 to button 1, then from button 1 to button 2, then from button 2 to button 3, etc.
I have ground connected from GND to button 1, then from button 1 to button 2, then from button 2 to button 3, etc.
Should I seperate them out and only have 6 buttons per pin maybe? Then set 3 pins high and 3 pins low.
Two pins are the switch. You can wire the switch between an input pin and ground.
But you must enable the internal pull up on the pin if you don't use an external pull up/down resistor.
pinMode(inputPin, INPUT_PULLUP);
The other two are the LED. You NEED a current limiting resistor in series with the LED.
Failing to do so could damage the pin and/or the LED.
The CL resistor can be between 220ohm and 1k.
=470ohm is better if you are using more than one LED/button.
Leo..
In all my tests, I never used a resistor and it seemed to work perfectly fine. I have 2 buttons connected in daisy chain directly to gnd and pin 13 and it worked perfectly.
An Arduino pin can power 1 LED, but not 18 at the same time. You need a transistor to operate so many LEDs, or one pin for each button. As pin 13 already powers the on-board LED, you also should use a different pin for your buttons.
MageDKTarill:
In all my tests, I never used a resistor and it seemed to work perfectly fine.
That it seems to work doesn't mean you're doing it correctly. The voltage on the pin is a clear indication of drawing way too much current (they're rated 20 mA, absolute maximum 40 mA).
LEDs need a current limiting resistor or special LED drivers.
So they can be put in parallel but more than 2 will overload a single Arduino pin. (And exactly 2 is stressing the pin too much for long-term reliability.)
spycatcher2k:
Disconnect the LEDs and measure the voltage! I almost guarantee you're 'crow-barring' the pin, pulling to much current. You should drive the LEDs from a separate power source and switch them with a transistor.
I'm still new when it comes to electronics. Can you provide more details on how I could do that?