So this is interesting. I’m reading temperatures with two TMP sensors and a Photon. I was using analog pins A1 and A3. I noticed on one Photon that my readings from each TMP varied considerably (10 to 15 degrees F) even though the TMPs were on the same breadboard. A1 was reading correctly, A3 was reading low.
To troubleshoot, I switched the TMP sensors between each other. Same thing: A1 normal, A3 low. I then switched locations on the breadboard. Same result. Switched out all the wiring. Same result.
I then started moving each pair to various analog pins. Long story short, it appears there is something wrong with pin A1 but it results in an erroneous reading on the OTHER pin, not A1.
I emailed Sparkfun (it’s a Photon mounted on their Redboard) and they said this is a known problem. I can’t find any documentation about that and I also haven’t seen the same behavior on three of my other Photons.
Because of the way the ADC works on the ST Micro chips used on Photon, the TMP sensors are not a good choice for accuracy. The input of the ADC is not buffered on these chips and that can lead to error prone results with sensors that have relatively high output impedance like the TMP sensor. If you buffer the analog signal with an op-amp, the results will be much better when using this sensor.
Thanks, @bko. My issue doesn’t seem to be with the TMP sensors. I’m using the same setup on three (3) other devices and they correlate well, even though I’m using analog pin A1 as one (1) of my two (2) pins on those devices. The discrepancy seems to only be on this one device and I was told that it’s a known issue with the Photon. I can’t seem to find anything that confirms that.
For now, it’s easy enough to workaround by skipping pin A1. My question really is whether it’s a known issue with the Photon or if it’s actually an issue with the Sparkfun Redboard. My other devices don’t use the Redboard.
As a side note, I do use a 0.1 µF bypass capacitor with each TMP, per the recommendations in the datasheet. I don’t profess to understand most of what you said nor if using the capacitor addresses the issue you describe. Thanks for the help!
What I described above is the only issue I know about with ADC accuracy on Photon. I do not believe there are any known problems specific to A1 or any other analog pin. I checked github issues too and did not find anything.
You may or may not get good readings from TMP sensors on any device that uses the ST Micro chips. The 0.1uF cap trick is just that-a trick that sometimes helps, but the real solution is to buffer the sensor with an op-amp.
If you can switch to a digital sensor like the DS18B20, that will work better.
Good to know, @bko. I wish I would have had that information earlier.
I’m going to throw the issue with A1 back to Sparkfun to see what they come up with. It’s not clear to me if they are claiming it’s a “known issue” with the Photon in general or their own Redboard.