digital input interference

is it possible to run a switch on the analog pins? im having interference on my digital pin do to relays. i have installed snubbers on the relay but its still interfering with the digital pin.

Yes but if you are having trouble with a digital pin it will not go away when you switch to analogue.

if i switch the digital pin to input pin off i get no interference. so i was wondering if i could do it on a analog pin and see if it still the problem still exists.

if i switch the digital pin to input pin off i get no interference

Run that past me again, I don't get what you are doing. How have you got the switch wired up?
It is best if the switch goes from input to ground, and then a resistor goes from input to +5V. If you get interference make the resistor a lower value. Start off with 10K and go down to about 1K.

right now i have 2 1k resistors in parrallel (500ohm) from 5v to pin 2 and then the switch to pin2 to ground. and for the most part it has reduced the interference. im going to put a cap from vcc and ground to try to decouple the arduino from the relay voltage. i have also placed the arduino in a metal box and attached it to earth ground.

the project is a real traffic light with 120v led modules to replace the incandescent bulbs. from pin 12 11 10 drive a tip120 which drives a 12v relay. which then switches the 120v main lines on and off to the 120v led's. it was working fine then i sandblasted and repainted it when i put it back together it started getting interference. i have rebuilt my relay modules just to be on the safe side.

it seems like its mostly functioning. occasionally when u push button it will get some interference. but once its in a mode it seems to be stable.

im wondering if my power-supply is not powerful enough to drive everything.

it has 3 relays with 12vdc with 400 ohms coil using 360 mW and an arduino.

from pin 12 11 10 drive a tip120 which drives a 12v relay.

What value of base resistor are you using?
Have you got a diode across the relay coil?

the base resistor is 2.2k and yes i have 1n4007 diodes on the relays. i also have diodes on the output pins on the arduino

i also have diodes on the output pins on the arduino

You don't need those, if they are the wrong way round it could cause trouble, just remove them.

im wondering if my power-supply is not powerful enough to drive everything.

It could be what is the power rating of the supply.
Also adding something like a 47uF capacitor (not at all a critical value anything over 22uF will do) across the 12V supply will reduce any disturbance on the power rails.

the diodes on the outputs are in the right direction.

and im not sure what the output of the power supply is. i want to say 1 amp.

the diodes on the outputs are in the right direction

Yes but when the output is off the base has a high impedance in it and so is more prone to interference.

well its better but still occasionally will change modes. i removed the diodes and now im going to put the cap in.

so i put the cap in. and another thing i noticed is the metal traffic light is developing a static charge when it starts to act up. i have the unit earth grounded. could this be the problem?

  1. How long are the wires between the pushbuttons and the Arduino digital input pins?

  2. If they are long, are you using shielded cable for them?

  3. Is the other side of the pushbutton connected to ground or to +5v?

  4. If it's connected to ground:

(a) Where is it connected to ground? It's advisable to dedicate one of the Arduino ground pins to connect the ground side of input sensors, and use a different ground pin for the ground side of output devices and power.

(b) Are you using the internal pullup resistor or an external one? If external, what value?

dc42:

  1. How long are the wires between the pushbuttons and the Arduino digital input pins?
    about 5 inches

  2. If they are long, are you using shielded cable for them?
    i am not using a shielded cable.

  3. Is the other side of the pushbutton connected to ground or to +5v?
    ground

  4. If it's connected to ground:

(a) Where is it connected to ground? It's advisable to dedicate one of the Arduino ground pins to connect the ground side of input sensors, and use a different ground pin for the ground side of output devices and power.
the outputs are not grounded on the arduino they go through the tip120 and then ground at the power supply.

(b) Are you using the internal pullup resistor or an external one? If external, what value?
im using 2 1k resistors in parallel (500ohm)
[/quote]

nicko6113:
the outputs are not grounded on the arduino they go through the tip120 and then ground at the power supply.

My question was where is the pushbutton grounded. If is is grounded at the emitter of the TIP120, that is about the worst possible place to ground it, particularly if the pushbutton is triggering an interrupt.

the push button is grounded to the arduino.

im going to replace all the wire with shielded alarm wire and hope that works.

ok im 99% sure i fixed it. i took the earth ground and connected it to the ground pin on the arduino. and every thing is working fine now.

nicko6113:
ok im 99% sure i fixed it. i took the earth ground and connected it to the ground pin on the arduino. and every thing is working fine now.

The earths weren't connected previously???