Why Hardware Gotta Make Me Love It So Hard?

Often when working on an electronics project I experience a problem that takes me way too long to debug. I don’t mind iterative debugging, it’s where I’m partially hanging my hat these days professionally, but it’s painful how often my lack of experience leads me up a dead end. The last time I got so angry I felt the need to write a post about it was an hour lost to software debugging when I had just crossed a couple of wires.

My more recent experience was with my EtchASketch project. I rewrote the code several months ago so that it would draw persistent pixels on the display, then put it away over the holidays. I got it back out a couple of nights ago and instantly remembered the last problem I had. When drawing, the cursor was all over the place (so, for instance, drawing a horizontal line would have a lot of vertical jitter even if the vertical pot wasn’t moving). I tried lengthening my sample time from 10ms to 100ms with no effect (other than missing pixels in my drawing from the overly-long sample time). I started designing (software) dampening systems in my head. I redesigned the project to display positional debug on the display as well as have a clear button to make debugging this issue easier.

Right before I started writing code, I realized the behavior I was seeing was actually really strange. I could see having a little jitter when you’re moving the pot, but I was seeing jitter even when I wasn’t moving the pot controlling the direction I was seeing jitter. After a bit of experimentation I found that all the jitter was being caused by the vertical-control pot, and the horizontal pot didn’t show the same behavior.

This video shows the behavior pretty well. It starts with me doing horizontal sweeps with my hand completely off of the vertical trimmer and they look pretty good. Then, starting at around 00:42, I clear the screen and do a horizontal wipe with my finger just resting on top of the vertical trimmer and it goes nuts and a big blob shows up on the screen. After that, right around 00:56, after a last vertical adjustment the horizontal wipe results in a diagonal line, even though I’m not touching the vertical trimmer.

So, since I happened to have an identical contrast-control trimmer on the LCD (upper left, next to the display), I swapped them to see if it would help. And it did. Replacing the vertical trimmer made the problem disappear (the trimmer swap was the only thing that happened between these videos):

Such a simple solution, but it’s still unnatural for me to suspect that hardware might be at fault. Really happy to have solved the problem as easily as I did though.

The one outstanding issue for me is what’s wrong with that trimmer. Is it bad luck? Do trimmer pots have a known life cycle? Maybe trimmers (as the name implies) are supposed to be set-and-forget and my use of them as primary input devices was too much abuse? Dunno yet, just happy not to be writing dampening logic for this silly little project…

Leave a Reply

Your email address will not be published. Required fields are marked *