Thursday, November 28, 2013

ADC error and Switch debouncing

Now that I have the IO hardware working, I have noticed a couple of issues in the potentiometers and switches inputs to the AVR:

  1. Potentiometers readings in the ADCs are not stable and seem to fluctuate
  2. Switch readings are bouncing on button press.
I found this great site: Newbie Hack where both topics are covered and clearly described. For the ADC stability issue, you can find this way of measuring the error. No info is giving on how to remove this problem, but I suppose a low pass filter should do. As for a way to do switch debouncing, you have it here

Still need to implement this solutions and try.

Update (12/03/2013):
Fixed the switch debouncing by only reporting switch changes after a certain number of unchanged reads, similarly as explained in the links above.
For the Potentiometers, I added some histeresys, I only report potentiometer changes when the read value exceeds the previously sent value by a certain amount, which gets rid of all bouncing issues, althought the cost is high as the potentiometer changes are not as smooth as they could be. still need to work on that.


No comments:

Post a Comment