unstable inputs

Hi,

I've got a problem with inputs being very unstable.

i defined the inputs as INPUT_PULLUP.
at 3 of my arduino's there is no problem (Wire length < 1m)

but at one of my arduino the wire length is +/- 5m and all 6 of the inputs are constantly switching.
(at this arduino i've got also 6 inputs with wirelenght < 1m also no problem)

When i connect them to 0v all the switches are closed and stable.

the cable isn't shielded..
when the cable isnt connected to anything; how can it switch??

do i have to place resistors at the end of the cable?

is there someone who can help me?

thanks

Reinald

The internal pullup resistors are very weak due to there high value.
Try pulling the line up to VCC using an external resistor of a lower value (try 10K) and see if that cures your noise problem.
Also consider you may need to switch to screened cable for such a long run.

Add a 0.01uF cap to filter the noise pick up.

Weedpharma

Just wondering what devices you have connected because from another thread you mention home automation, freezing I2C bus, 7 Arduino nanos with I2C extenders. Is this a new problem with the home automation project?

It would be helpful if you could provide links to your devices, schematic diagram and code. That way, it would make it very easy for others to identify problems.

hi,

i've changed to external pullup; the problem seems to be solved now!
it's not an option to replace the unshielded cable. there is a lot of cable i have to replace then

thanks a lot everyone!!

@dlloyd; this is still the same project, i've rebuild everything; the first version gave a lot of trouble with the freezing I2C.
I Changed all of the boards to Arduino MEGAs; so all the in&outputs are on the board now; i don't need shift registers anymore and have more Serial ports

I got rid of the I2C and now using RS485 so i can handle all the data by myself (it doesn't freeze anymore)

All the switches are handled by single ATMega328 chips which handles the push buttons;
because when using the serial interface, it sometimes don't detect all the double or tripple clicks of a button.

changed the configuration of all the switches in the house using LM339 IC's to let them operate on a higher voltage (because nowhere in the house except for the RS485 is shielded cable)

I still have some little trouble but step by step things are getting better :slight_smile:

Reinald

With long runs of unshielded wire inputs, you will continue to have problems.

They will just become less frequent with external pullup resistors.

That's why i'm using the LM339
it's a voltage comparer; when pushing a button; the voltage rises from 16v to 24v and the IC returns a digital output to the arduino. Since i'm using that, no button problems appears..

A simple 100n capacitor from input to ground (on the Arduino side) also fixes most problems.
Leo..

but at one of my arduino the wire length is +/- 5m

I'm just amazed you found wire that's of negative length!

I faced the same problem , i fix it by using 10uf Cap between INPUT_Pullup & GND

weedpharma & Wawa Completely Right but use 10uf

Way to resurrect a necro thread... Still impressed by all those first posters even finding this old stuff!

10 uF can destroy your switches amongst other problems (current surge upon closing), unless you place a small resistor in series with the switch as well.