Particle Photon flapping analog reader

I’m using particle photon with an analog gas pressure sensor, this gas pressure sensor outputs an analog reading that can be translated to pressure. I’ve connected the sensor’s ground to the photon’s ground and the data to A0 which is set to analog read mode.

The readings are very inconsistent and is constantly changing even though when I connect the same leads to a voltmeter its perfectly stable, however the photon analog reading is changing rapidly around the correct reading.

based on the discussion read in Odd analog readings [SOLVED] I connected a 220 ohm resistor between the GND and A0 and that relatively stabilized the reading, yet if the voltage used with the pressure sensor (it can be powered by anything between 12V -> 24 V) is changed the flapping is back and the reading is useless.

I’d appreciate your help with the following :slight_smile:

  1. why did the resistor stabilize the reading ?
  2. How can I stabilize it with different voltages? I know that it has to do with the impedance but I’m not quite sure about the relationship or how I can use that information for a permanent fix.

Thanks a lot for your support.

You’d need to provide more background on the sensor you are using.
The ADC on these controlers has a relatively low input impedance, so your signal needs to be strong enough to “withstand” that influence (aka low output impedance).

The sensor used is BD Sensor type 18.689, I think it has been discontinued because I cant find its data sheet. However I have taken some photos of the sensor in question.

If I manage to locate the data sheet i’ll add it to the post

Voltmeters are usually not fast enough to be a reliable tool for such issues.
You may rather use a oscillograph to properly check the output of your sensor.
One word of caution: The sensor label indicates a max output of 4.5V which would be too much for the ADC pins on the Photon, potentially damaging it.

I guess the 18.605 datasheet should not be too far off

2 Likes

You can also get more reliable readings by adjusting how frequently you read the pin, and / or adjust your ADC simple time. If you were say, reading the pin hundreds or thousands of times a second, you might be getting wrong results.

https://docs.particle.io/reference/firmware/photon/#setadcsampletime-

Thanks,
David

1 Like