# Program loops need help

**URL:** <https://community.sparkfun.com/t/program-loops-need-help/25162>\
**Category:** Arduino\
**Created:** [October 11, 2012, 2:46am UTC](https://community.sparkfun.com/t/program-loops-need-help/25162 "2012-10-11T02:46:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deltadawg01](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@Deltadawg01](https://community.sparkfun.com/u/Deltadawg01)\
**Post date:** [October 11, 2012, 2:46am UTC](https://community.sparkfun.com/t/program-loops-need-help/25162/1 "2012-10-11T02:46:15Z")

</div>

Basically I have an arduino uno switching 8 relays controlling 8 120v outlets. I am confident with the code but with the high voltage hooked up to the relays witch control 8 air bags under a room. We have the high voltage in the same control box as the low with the uno. We are using the internal pull up resistors. We have even tried external pull down resistors. Could having the uno in the same box with the switching 120 volts be causing the program to loop? Causing a false signal to the input pin?

---

<div class="post-metadata">

**Author:** ![Mee\_n\_Mac](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Mee\_n\_Mac](https://community.sparkfun.com/u/Mee_n_Mac)\
**Post date:** [October 11, 2012, 3:43am UTC](https://community.sparkfun.com/t/program-loops-need-help/25162/2 "2012-10-11T03:43:15Z")

</div>

We don’t know the connections btw the Arduino and the relay nor any possible path to the HV. We don’t know what the error condition is, other that some loop gets executed when it shouldn’t. We don’t know the code or the input triggers that are supposed to make some loop execute (or not).

Relays cause voltage spikes when turned off, what have you done to damp these ? What kind of current are you switching on the HV side when whatever problem you’re seeing occurs ?

---

<div class="post-metadata">

**Author:** ![Mee\_n\_Mac](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Mee\_n\_Mac](https://community.sparkfun.com/u/Mee_n_Mac)\
**Post date:** [October 11, 2012, 3:43am UTC](https://community.sparkfun.com/t/program-loops-need-help/25162/3 "2012-10-11T03:43:15Z")

</div>

We don’t know the connections btw the Arduino and the relay nor any possible path to the HV. We don’t know what the error condition is, other that some loop gets executed when it shouldn’t. We don’t know the code or the input triggers that are supposed to make some loop execute (or not).

Relays cause voltage spikes when turned off, what have you done to damp these ? What kind of current are you switching on the HV side when whatever problem you’re seeing occurs ?

---

<div class="post-metadata">

**Author:** ![KeithB](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@KeithB](https://community.sparkfun.com/u/KeithB)\
**Post date:** [October 11, 2012, 2:10pm UTC](https://community.sparkfun.com/t/program-loops-need-help/25162/4 "2012-10-11T14:10:13Z")

</div>

How are you switching the relays? I strongly suggest at the least, free-wheeling diodes at the relay, or at the best opto-isolation.

---

<div class="post-metadata">

**Author:** ![Deltadawg01](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@Deltadawg01](https://community.sparkfun.com/u/Deltadawg01)\
**Post date:** [October 11, 2012, 2:59pm UTC](https://community.sparkfun.com/t/program-loops-need-help/25162/5 "2012-10-11T14:59:47Z")

</div>

The relays are a sain smart board and they are opto iso. I would put up the code if I could. It runs great outside of the control box we have it in.
