1. Pre-reading
Before class starts, chew on this idea of a 4th generation of the Internet (socially-connected devices, the 3rd is social networks): http://drmarty.blogspot.com/2010/04/socially-connected-machines.html
2. Review
2.1. Rotary incremental encoders
The Wikipedia page about incremental encoders is a good review of
Jason Sachs: How to Estimate Encoder Velocity Without Making Stupid Mistakes: Part 1. This article focuses more on velocity instead of position, but he includes lots of tips, tricks, and gotchas interleaved with his entertaining writing style.
2.2. Bouncing contacts
Our EN12
encoders are just contacts, so all things about what happens when two metal surfaces touch each other with non-zero velocity applies.
A classic Jack Ganssle set of articles:
-
http://www.ganssle.com/debouncing-pt2.htm
-
Figure 2 is common but has well-known issues (if you’d rather not re-discover them)
-
Do not skip the "Other Thoughts" section. Each sentence / paragraph is advice from real problems.
-
"Try to avoid sampling the switch input at …"
-
But how fast is fast enough? I didn’t know so I wired a switch to [a devboard and did the experiment]
Take 30 seconds and imagine what that experiment’s code would look like on your MSP430.
Max Mayfield for EE Journal:
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-1/
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-2/
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-3/
-
(may I remind of the old saying that “Eagles may soar, but weasels rarely get sucked into jet engines”) — LOL
-
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-4/
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-5/
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-6/
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-7/
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-8/
-
https://www.eejournal.com/article/ultimate-guide-to-switch-debounce-part-9/ (May 2020)
More!:
3. Project 3
HOW DO YOU READ THE FINE ENCODER so that your code can make sense of the input signals?
Your observations from watching the signals on the AD2 scope + digital input are critical to addressing this problem. There are lots of good resources
-
When there is scraping / bouncing / gnastiness at an edge, the other signal is constant.
Notice this behavior in the following captures. Also see howthe real(ity) waveform captured by the 'scope is interpreted by the LVCMOS 3V3 type logic inputs of the AD2.





Repeatedly reading the A,B signals needs to be done quick enough to not miss an edge.
How fast of rotation do you want to support?
then compute the (shortest) time between edges.
4. Bonus
The other articles in the series are also good.
Notice how I link to EmbeddedRelated.com quite often? The site doesn’t waste your time.
ok, can’t stop:
More of an electronics and signal processing thing, but we frequently have RC low-pass filters in embedded systems: R1C1R2C2: The Two-Pole Passive RC Filter