Thursday, November 24, 2016

Whadaya mean, "too sensitive?"

Monday I did a long workday, went to the gym, worked on the Holocron, went out for dinner, and still had time for a few minutes of fiddle practice.

Tuesday I was sore, nor did it help that I had to climb the walls of the theater (pretty much literally, using rock-climbing moves up the unistrut to get to the things I needed to adjust). But still got the Holocron work and the fiddle practice in.

But I am so glad Wednesday was a short day and the next four days are off work.



I needed to dial in the sensitivity on the touch sensor before I moved on to the last parts of the software. And that took four days. And the solution is a software cludge. 

The theory is simple. Let current leak through a high-value resistor into the parasitic capacitance around an input pin and associated antenna until it charges and trips the pin. Measure the time; that's the total capacitance. 

A human body in contact with, or even close to, the circuit changes that time and you can thus detect it. I can get the circuit to detect a hand moving six inches away.

But not in a stable way. The values fluctuate too much, including the sensitivity climbing up steadily over time. The touch I'm looking for is getting lost in the noise.

And two other problems. The sensor wire is inside a sealed acrylic cube. So the ground floats when it is used in battery mode. And the sensitivity goes way up when it is tethered via USB. So my software cludge looks at the detect events and if they are way, way above the default threshold it assumes the Holocron is on USB and flips to the higher threshold setting. And I'm forcing auto-calibration at frequent intervals. And I'll probably write in a masking routing to prevent trips from coming too close together.

(That's more RTOS stuff there, of course. The Holocron is constantly feeding illumination level and color updates to the neo-pixels, meaning you have to use counters and/or interrupts instead of relying on delay() to tweak the timing.)

On to a new "Talk" animation, and take at least a weak swing at the user programming buttons. I've got the first six boards soldered up now and I have at least that many orders waiting to be filled. I'm glad I'm smart about this and have refused to accept payment until I'm ready to ship. (Because I still have to run out to the lasers to cut more pieces, too. At least the designing is finally done on that.)


Oh, and I just ran into the cutest hack on Hackaday. I'm already leveraging the fact that you can reboot the Holocron merely by tipping it far enough to activate the tilt sensor. But with a capacitor on an I/O pin, you can detect if the sleep interval was short or long. Meaning different behaviors depending on whether it has just been turned on, or if the user tips and restores.

And, yes, I was tempted to give up on the capacitive sensor and use this to trigger the sound effects on the "Talking" Holocron. But it made it a little too much like a Moo Can.

No comments:

Post a Comment