There are a lot of very smart people out here in the Particle community I'm hoping I can get some insight or ideas on what I'm doing wrong. It's a bit unclear if this is a board design issue, sensor issue, firmware issue on the P2, ground loop, some impedance issue or maybe I'm doing something dumb in the user application code.
I am using the P2 and a Hydrostatic Sensor to detect the level of a liquid in a tank. It displays this liquid level locally on a 16x2 LCD display as well as animates it via an LED strip. I call it a LED sight glass.
The first 1 hour, 12 hour or even 24 hours it works great. It's very accurate and overall I am very happy with it. However, some seemingly random duration of time from being first turned on, the analog input will "jump" up by ~ 0.15 Volts. If I leave it all hooked up and powered on over night, I'll walk in in the morning and instead of saying the tank is 0", it'll say there is 7" of liquid in the tank.
The hydrostatic sensor itself is just a basic ratiometric sensor.
VCC: 3.3V
Vout: 0-2.5V
Range: 0-39"
At 0" of liquid level (i.e. no liquid in the tank) Vout = 0.005 V.
At ~7" of liquid level Vout = ~0.15V
In this case, Vout is tied to A0 on a Particle P2. What I can not explain is the following behavior:
-
If I power off/on the P2, the behavior "resets" and then it reads correctly again both via multimeter and the Particle P2. https://www.youtube.com/watch?v=hkf9VJS24ws
-
If I disconnect and re-connect the entire sensor (VCC, Gnd, Vout) it then it reads correctly again both via multimeter and the Particle P2.
https://www.youtube.com/watch?v=WZAdF-hgJoc&feature=youtu.be -
If I disconnect ONLY Vout, Vout immediately starts reading correctly again and when I connect it back up to the P2 it also reads correctly again. https://www.youtube.com/watch?v=ArhmbRwmSsg
A few other unproven general observations:
- One person indicated simply powering it off and back on does not fix the issue.
- I am using this same sensor on Boron's and I've yet to observe the issue there although not adequately tested side by side.
A few hypothesis I need to test:
- Can I repeat the issue on a different Analog input pin on the P2?
- Can I repeat the issue on a different Particle Device (Boron or otherwise)?
- Can I repeat the issue using just a simple voltage divider circuit on pin A0 of the P2?
- Do I need to add some large resister value or a Capacitor from Vout of the sensor to GND?
- The sensor cable has a shield as well. Can I reproduce it if the shield is tied to GND?
- Does it still happen if I turn off VCC to the sensor when not taking a reading? I.e. turn it on ONLY when i need to take a reading and then turn it off. I need to take readings near real time but maybe I'd turn it off for 1 second every 60 seconds or something like that. I currently have a transistor I control from a GPIO pin to turn power on/off to the sensor. Currently I leave it on all the time. But maybe I need to cycle it occasionally. This seems like a "hack" vs fixing the root cause though.
I've already been in contact with the hydrostatic sensor supplier. They've indicated they have never seen this behavior before as well. Any idea what this could be? Or what additional tests should I consider to help identify this issue?
Any help or suggestions would be greatly appreciated. @bko - If I recall, you have some special expertise and background in the analog signals and filtering space, Any thoughts.