3 new photons all have voltage reading on analog pins with nothing connected

Hi, after some help please. I have been trying to build a PM2.5 monitor which requires reading between 0 and 800mV and for the life of me was getting bizarre readings. I have tacked it down to the ‘A’ pins all read 100 - 200 mV when nothing is connected to the Photon apart from the usb power in. The readings fluctuate and are different between the pins. Its the same on all the 3 photons I have, all purchased at the same time, even tested a fresh one straight from the box without any setup. Picture of measurement setup attached, i have a capacitor between A1 and ground to stabilize reading otherwise it bounces between 200 and 400 mV. Can anyone shed light as to why the A pins are seeing voltage leakage on them. Do i have a bad batch of Photons?

I believe the pins are in a high impedance state at startup, so they are floating. When a pin is floating, you should expect to see random voltage on it, that doesn’t mean there’s anything wrong with it.

Thanks for the quick reply. The challenge then becomes if there is a varying ‘base’ voltage on the pin i am going to struggle to measure the 0 - 800mv signal from the dust sensor. Am i expecting too much or is there a smart way to isolate this floating voltage. I have have been measuring Analog pin for several hours now and it is still reading 90 - 110 mV

There shouldn’t be a varying ‘base’ voltage once you connect the sensor; connecting the sensor should fix the problem. That being said, 0-800 mv is a fairly small signal, so you might want to consider using an op-amp to boost that signal up to 3 volts or so.

The analog pin voltage is normal for the ST micro analog pins. On difference between the AVR and St micro MCUs is that the ST parts do not have buffered analog inputs so you may need an op-amp.

It depends on the impedance that your sensor drives the 800mV output with. Can you link to the exact sensor you are using? The ones I found are TTL serial, not analog.

this is the sensor, its a sharp DN7c3a006

im trying to build this
dust sensor
but with a different sensor

Hi @rx8rated

Thanks for the data sheet pointer! That data sheet says that the output voltage range is 3.4V with RL=4.7k ohm leading me to think that the sensor needs an external resistor in order to get a good measurement. Do you have a 4.7k ohm resistor from Vo to ground? If the output is a current source, the resistor would be required in order to get a voltage measurement.

What happens when you drive the sensor LED with your program and do not connect the Vo pin of the sensor to the Photon but just connect it to your voltmeter? Do your readings make any sense then? How about with a 4.7k ohm to ground?

I have written elsewhere in the forum extensively about the switched-capacitor nature of the ADC on the ST Micro parts. If you are not driving it with a low-impedance source, the reading will be random. Since there is no internal op-amp to isolate the inputs from the switched-capacitor, a voltage will appear on the ADC input pin that can see when it is not driven. This is all OK, as long as you are driving the input and not letting it float.