I’m a new user of Photon and I have a question regarding the ADC measurement accuracy. I’m getting erroneous measurement from my ADC conversion. My circuit is shown below, with A5 connected to a diode and A3 is at GND.
A5 is expected to be around 0.7V (which is confirmed by DMM) and A3 should be at 0V. However, my cloud measurement shows that A5 is 1.204V and A3 is at 1.670V. I’ve included a test variable to check if web publishing is done.
Per the docs you’d need to add a 4sec “cooldown phase” after a burst of 4 events to keep the average publish rate below 1 per second.
My comment about precision was not actually meant for the ADC issue but just as a general coding rule.
I don’t see how it’s possible to get those results unless something is wrong with your Photon (or your actual setup is not what your post shows). Have you tried different pins instead of A3 and A5 or a different Photon? I tested your code and setup with a 220 ohm resistor and a 1N4001 diode, and I got nearly identical readings on A5 between my DMM and what’s reported on the console. I get 0.002V for A3 Measurement and 0.693V for A5 Measurement.
You can also try other A pins. If one or two are dead, you may still find some working ones. Just make sure never to put more than 3.3V on a pin in ADC mode (or on A3 & A6/DAC at any time)!
If your diode is dead or was used in reverse polarity, you will have the full 5V on A5 inevitably frying the ADC.
To be on the safe side, rather use 3V3 instead of Vin and adjust your resistor accoridingly.
Another possibility that has not been mentioned yet is if your breadboard is high quality or not. A low quality or damaged breadboard may add some resistance to your connections and cause a difference in readings.
In your photo, you have your meter leads connected at the diode. If you move the leads to connect to the Photon pins and the meter reading changes, then your breadboard may be the issue.
Good day guys! Thanks a lot for all the inputs that you have given. It is confirmed, my old Photon unit is defective. It doesn’t convert the expected levels at all it’s analog inputs and it also is pretty hot, reaching as high as 61°C.