Odd analog readings [SOLVED]

Ok, looks like I’m collecting the Glory … lol

After reviewing the Firmware source files. It appears the ADC sampling time is set too fast, as I expected based on my testing observations.

Based on the datasheet:

The ADC_SAMPLING_TIME is set to Ts = 1.5 cycles and should probably be something more like 13.5 to 41.5. Looks like it was originally set to 239.5 but was found to take too long and was cranked full tilt in the opposite direction.
https://github.com/spark/core-firmware/blob/master/inc/spark_wiring.h#L118

And because of this, any input impedance over 600 ohms is going to result in the ADC’s sample and hold capacitor not reaching a full charge. This should mean the readings always come in too low, but regardless it’s probably not a good idea to require such a low input impedance.

Most PIC uC’s have an input impedance requirement of max 10k ohms.

I would think 10k to 50k is probably a good range, lower would be faster conversion times. Higher would allow more flexibility at the expense of conversion time.

7 Likes