Close

Minimalist experimentation.

A project log for SMidi - Soft MIDI Pedals

Full function, class compliant MIDI pedals you can roll up.

daren-schwenkeDaren Schwenke 06/21/2017 at 17:270 Comments

This could be a really, really simple project with no external components beyond my FSRs.

To do that, I'd need to eliminate the bank of pull-up/pull-down resistors needed to get a voltage for the ADC from my resistors.

Let the experimenting begin.

I read many places that using INPUT_PULLUP and INPUT_PULLDOWN on the ADC was a bad idea. So I started my experiments in the realm of touch sensors.

Touch sensors work by applying a voltage to a pin, then switching to input mode and timing the decay of the voltage. This happens thousands of times a second. A capacitive load will change the decay time and you can detect this change.

I tried something similar, but using the internal capacitance of the Teensy against my FSR for a simple RC circuit.

I discharged a pin using digitalWrite(pin,LOW), switched pinmode to INPUT, then after a short delay do an analogRead(). The pin is pulled high via the FSR. So the lower the FSR resistance, the faster the RC circuit would be pulled high, and the higher the voltage when I did my analogRead(). Sounds good in theory.

It worked, but the readings were pretty bouncy due to my high FSR impedance, and was sensitive to touch as well. Of course it would be... Duh..

The short explanation of why it was so bouncy, is the Teensy is just too fast. It has enough spare cycles that it does oversampling and averaging on the ADC inputs by default. This also means the small internal capacitance of the ADC is particularly tiny as well. I tried making it do single samples with a little improvement, but it's just too erratic and sensitive to environmental changes to be useful.

Ah well, was a cool idea.

Next up, I ignored the collective intelligence of the internet, and tried using INPUT_PULLUP and INPUT_PULLDOWN on the ADC inputs. It worked... well. Much more stable than the RC circuit was, and I can use the oversampling without issues.

Two issues:

The former I can live with. The latter is explained by the fact A10-A13 are not digital capable input pins, so the internal pullup resistors don't exist. Doh.

I tried removing the resistor-less inputs from my loop, but it seems reading above A9 at all makes the upper inputs unstable. No idea why yet.

More testing needed.

Discussions