# Reed switch power interference?



## Tyco_spud (Sep 19, 2014)

Hello everyone. I’m having a few issues getting my Arduino Uno counting laps correctly.

My setup:
Race Coordinator
Arduino Uno R3
N scale reed switches
Tyco 440 cars/track
Cat5 wiring for the reed switches
No other communication with the track other than lap timing (no relays, call buttons, etc)

Pushing the cars over the sensors by hands works great. However, when I press the trigger over ¼ throttle so a lane (or both lanes) get power, it starts registering laps on both lanes sporadically. I’m guessing it is triggering laps somewhere in the 5-30Hz range by looking at the flashing trigger lights on the “Mangage Arduino” page in RC and the TX light on the Arduino board.

I feel like I am getting interference or the voltage/current in the track is tripping the reed switches. I have tried re-routing cables to the track so my power and sensor cables are as far from each other as I can get them. I'll post a few pictures of my setup once I hit my 5 post limit, but I cut a section of the track out as close to the outside rail as possible so that the reed switches sit flush with the top of the track. The reeds are perpendicular to the track as most recommend. I also have individual ground wires running back to the Arduino.

Add https:// to the beginning of each to see the pictures.
dl.dropboxusercontent.com/u/16145584/Photo%20Sep%2018%2C%207%2058%2051%20PM.jpg
dl.dropboxusercontent.com/u/16145584/Photo%20Sep%2018%2C%207%2059%2005%20PM.jpg
dl.dropboxusercontent.com/u/16145584/Photo%20Sep%2018%2C%208%2000%2052%20PM.jpg

The frustrating part is I had this same track hardware setup (reed switches, wiring, track layout) working with a modified keyboard and Lap Timer 2000 fairly well. It would miss a lap occasionally, but it would never trigger a lap that wasn't a car passing.

Any suggestions other than going the IR sensor route?


----------



## tabcomary (Jun 2, 2010)

*stray signals*

Are your Arduino inputs tied "high" through a resistor before the switch closure takes them to ground (or reversed if the inputs are active "high")? That helps tremendously with my Phidget system. 

Good Luck!


----------



## Tyco_spud (Sep 19, 2014)

The inputs are active as "high" (normally green), but no, I don't have any resistors in the circuit. From what I have read those were only necessary for optical or dead strip setups, but I'm open to any suggestions!

Do you have a particular ohm resistor to use, or just play around with it? I have a few different sizes laying around. 

Then wire it as ground -> resistor -> reed switch -> input?


----------



## tabcomary (Jun 2, 2010)

The old standby for this is 1000 ohms.

Connect the resistor from Vcc (whatever positive voltage you are using, usually 5V) to the digital input. This should keep the input from bouncing when it is not connected. In parallel, connect the input to ground through your reed switch. This will only pull 5mA through your reed switch when it is closed. No problem for most hardware.


----------



## slotking (May 27, 2008)

never used reeds, but what I have read is to use resisters with them.


----------



## Tyco_spud (Sep 19, 2014)

I put a resistor in series with each reed switch and that did the trick. Anything in that 1k-10k ohm works just fine. Thanks for the help guys!


----------

