False triggering
nohab
Posts: 96
Hi,
My first project is very close to be completed, it's controlling the signals around a railway/road-crossing.
By pressing a switch the following sequence is started:
The cars gets red
5s wait
The trains gets white (=go·in Sweden)
15s wait
The trains gets red again
5s wait
The red cars signal goes out (=go in old Swedish road signal systems)
In lab everything works fine but when attached to the model railway, when the sequence reaches it end, it starts over again, without any keypressing.
The switch is a momentary one, attached between pin 16 and Vss. Pin 16 is also pulled-up with a 10K resistor to Vdd.
With very short wires to the switch, it's no problem.
With medium wires, the curcuit is faulty trigger occasionally.
With long wires (about 2 meters), the curcuit is faulty triggered all the time.
So, I guess the wires pick up some interference.
How to supress this?
Regards
Niclas
My first project is very close to be completed, it's controlling the signals around a railway/road-crossing.
By pressing a switch the following sequence is started:
The cars gets red
5s wait
The trains gets white (=go·in Sweden)
15s wait
The trains gets red again
5s wait
The red cars signal goes out (=go in old Swedish road signal systems)
In lab everything works fine but when attached to the model railway, when the sequence reaches it end, it starts over again, without any keypressing.
The switch is a momentary one, attached between pin 16 and Vss. Pin 16 is also pulled-up with a 10K resistor to Vdd.
With very short wires to the switch, it's no problem.
With medium wires, the curcuit is faulty trigger occasionally.
With long wires (about 2 meters), the curcuit is faulty triggered all the time.
So, I guess the wires pick up some interference.
How to supress this?
Regards
Niclas
Comments
So you don't think any filtering capacitors are needed?
I think the software debounce should get you going without any changes in hardware. Basically you check the switch state like you are already going then wait 200ms and check it again. If its still pressed then its considered "vaild" and you move onto your button routine.
/Nicke