After reading a lot and a few questions answered in this forum, I managed to make my sensor working. It's a pressure transmitter (piezometer) which output 4-20mA (corresponds to 0-10m).
I did it this way:
My only issue now is that the signal is not super stable. It's not a big deal but during my tests, I'm not moving the sensor but the results can vary by 1 to 3 cm between each measurement. For each of them, I read the analog 10 times (with 200ms delay) and average them.
I would like to know if there's a way to make the signal more stable.
Hi,
What is the sensor?
Link to data/specs please.
results can vary by 1 to 3 cm between each measurement
With respect to what maximum value?
Have you tried lowering the 10K series input resistor?
If the voltage across the shunt resistor doesn't go above the Node MCU Vcc, you may not need it at all.
So 16mA = 10m i.e. 1.6mA/meter. At 250R this is 400mV per meter or 4mV per cm. You say you have an error of 1 ~ 3cm per measurement; this is 4 ~ 12mV. I congratulate you; that's a very good achievement for this simple setup!!
@Idahowalker Thanks for these interesting links. My goal here is to find a way, if possible, to stabilize the signal in my scheme before using these filters. I didn't know these libraries exist and I will definitely use them.
I should have write it more explicitly: 4mA is 0 m and 20mA is 10 m. I was measuring 1.8 m at that time. 3cm doesn't seem to be a lot but I'm just trying to be as stable possible.
Will try that and will let you know if anything good happened.