Long distance button blink

So I wrote a code to use a button to blink an LED. Verified that it operated correctly on an Arduino Uno.
However, I needed 15 buttons and 15 LED's. So I bought a Mega 2560.
My buttons and LED's span a distance of up to 60 feet. I designed a shield and some terminal boards to allow Cat5 cable to be run with simplicity over the long distance.

Problem now is, it seems the buttons/LEDs are on the fritz. The blinking is erratic or the LED may be constantly ON, regardless of the status of the button.

I removed the shield and verfied that button/LED work straight off the Mega. And when the shield-Cat5-terminal board were connected I verified all connections were good with an Ohm meter. Only one exception, my resistance from LED pin to LED pin was only 40 Ohm's. I don't know what to make of this.

So I'm wondering if the 6 foot Cat5 cable may be causing the issue of too much resistance (or capacitance? as I read somewhere).

Any help is greatly appreciated.

Can you draw a schematic and provide the code you are using? From what I can gather, it seems like you might have a short between the LED wires, but I can’t say for sure since I don’t have a schematic. About length of the cable, resistance shouldn’t be a problem with LEDs, but too much capacitance could possibly cause the Arduino to fry due to the large current spikes.

Yes, help us to help you by giving us code an a schematic for your project.

Are these N.C. or N.O. switches?

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Have you got bypass capacitors on your input pins, do you have pullup or pull down resistors.
With your cable length, bypassing is essential with 0.1uF capacitors.
If you have the internal pullups turned on, they way be to high in value,

But a circuit diagram first please..... Tom.... :slight_smile:
What is the application that needs so many individual LED circuits?

So I’m wondering if the 6 foot Cat5 cable may be causing the issue of too much resistance (or capacitance? as I read somewhere).

Could be. Cat5 wire consist of twisted pairs of wires when connected to certain devices in a specific way, can reduce wire interference. Connected in an inappropriate way, the issue may actually be worse. Have you tried straight untwisted cat3 phone wire?

Here is some pics. There are 3 boards. 1 shield over the Mega2560, only purpose is to route the 2560 to RJ45 jacks. Another board is only meant to switch the RJ45 back into a pin header for connecting the LEDs. I did not attach pictures of that board. The 3rd board is what I termed the “terminal” and is connecting 3 buttons (latching) and the 3 LEDs contained within those buttons.

I have not supplied separate power sources to the terminals (maybe that was a mistake?).

Sorry the shield schematic is pretty messy, not sure how to make that more legible…

Terminal_pcb.png

Arduino Code:
Sorry, I tried to make it neat with an array, but I couldn’t figure it out.
The purpose was to have 3 sets of 5 lights. Button pressed (latched in this case) = light on. But the oldest button pressed would blink. No matter the order of pressing, only the oldest would blink and the others would remain solid. When the blinking button is turned off, the next oldest begins to blink. And so on. The use of this is a doctor’s office light system. Essentially the blinking light indicates which room to go to next.

If there’s a better way to put this into a reply without using a file, let me know. I was over the 9000 character limit.

OfficeLightSystem2560.ino (16.9 KB)

Some points:

If your variables are < 256 use byte type.
const int can be const byte to save RAM.

If you use arrays, you can cut down a lot of your code.

With this code you will need an external pull-resistor on each input and then have that input connected to a switch, then the switch to GND.
Is the above correct?

Always debounce switch inputs.
You should also have decoupling on each input.

Those diagrams leave a lot to be desired.
.

Thanks for your input, Larry.
I tried to use an array, but kept screwing things up. I am an amateur at this.

I have 222Ohm resistors connected from one button pin to ground and the same button pin is connected to the analog input. The other button pin is connected to the 5v pin.

I tried to clean up the schematic of the shield. But the Fritzing software is having trouble auto-routing with that many connections.

I attached a cleaned up schematic of the terminal, which is where the resistors are located. Like I said, the shield is really just a re-router.

On the Terminal diagram, the header pins 1,2,3 are ground and pins 7,8,9 are +5v. Pins 4,5,6 are LEDs and pins 10,11,12 are buttons. You can see the button pins have the resistors attached and connected to GND

Where are the led resistors?

2016-01-26_12-47-01.png

60 feet is a very long distance for direct connection.
You may want to look at SWC on inputs too.
.

Before anybody puts any more time into this, I may have resolved the situation. I will try to update tomorrow.

Problem solved. There was an error in the code and some pins were incorrectly numbered. I think I got tripped up when I hooked up one terminal board to test it and I was getting some intermittent signals. I'm supposing those signals were actually interference from not having all 5 boards w/ their resistors connected at one time.

Thanks everyone for the effort.

PS: Larry, you asked about the resistors for LEDs. They have always worked without any resistors attached on the LED side. They still work, no resistors. ???

There was an error in the code and some pins were incorrectly numbered.

The last thing you did is where you should start looking.
Always blame yourself
:wink:

PS: Larry, you asked about the resistors for LEDs. They have always worked without any resistors attached on the LED side. They still work, no resistors. ???

They need series resistors else you will be buying a new controller(s).

http://electronicsclub.info/leds.htm

Never connect an LED directly to a battery or power supply because the LED is likely to be destroyed by excessive current passing through it.

.

They need series resistors else you will be buying a new controller(s).

Pull-down on that cathode side? 1 per LED?

1 per LED

In series with the LED

-------------|<I-----/////-------

Did you read the link I gave?

http://electronicsclub.info/leds.htm

.

The resistor can be connected to either the anode or the cathode of the LED. It just needs to be in series as shown by LarryD.

There are lots of things which appear to "work" but are slowly destroying the hardware. Lots of people use LEDs without resistors but these people are slowly (and often quickly) destroying their hardware.