ADC Readings Change with hardware.lightlevel()

I’m using the IMP004m board and have noticed that my ADC readings seem to change with the lightlevel. I began to notice the effect on my Losant dashboard showing some of my analog channels against the lightlevel.

When I would turn out the light and leave my lab I noticed the levels would all drop down, and when I returned and turned on the light the levels would go up as shown in the attached plot.

Interesting; what are your analog sources? (ie, what impedance are they)

This implies when there’s charge sharing on internal ADC buffer when the ADC switches input between the phototransistor and your pins; generally instability here can be solved with a small capacitor on each ADC input.

Hi Hugo,
The “Battery V” is from a voltage divider (2 100k resistors) connected to the LiPoly battery connected to Pin D. The “Temp” channel is from a TMP36 temperature sensor connected to Pin L. These are obviously very slow moving signals.

I put 1nF caps between the analog signals and ground, and it seems much more stable. Thanks for the tip! I don’t remember cross coupling like this on other systems I’ve worked on. If I put a delay between channel reads, would that also help?

A delay may help when blinkup is off, but when blinkup is enabled it’s sampling at about 1kHz so delays in your code won’t change anything.

If the signals are that slow moving maybe 10nF or even 100nF would be better. TMP36 is max ~50uA current output so not awfully strong. Do you see any deviation at all now with light level?

Hi Hugo,

You can see from the graph that the light level isn’t affecting the battery or temperature data like it used to. I didn’t have to change the software, I only added the caps as you suggested.


  • Beautiful discharge curve for a LiPoly battery, by the way.