Pages: [1]   Go Down
Author Topic: How to Detect voltage Noise in the analog pins.  (Read 569 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using the analog pin (A0) to control a relay using a power supply and a battery.  The reading is perfect until I remove the battery.  I get noise and numbers are all over the place. 

I want to know what code can I write to detect that the reading has gone berserk so I can notify myself?

Here is the reading below coming out of the serial monitor
498
410
355
969
1023
1023
897
539
438
373
980
1023
1023
719
500
411
356
986
1023
1023
792
516
422
363
967
1023
1023
712
500
409
355
Logged

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Compute the difference between the current reading and the last reading.  If it is ten times greater than anything you'd normally see in your software, then assume that the battery was disconnected.  You could possible install a 100k pulldown down resistor to ground on the analog pin, and then readings would just drop to zero when the battery is disconnected.  100k shouldn't interfere with the pin's ability to drive the pin high on a digitalWrite().
Logged

Experience, it's what you get when you were expecting something else.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12430
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you post a picture of your schema?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: