The mcu I am using is a ESP32. The sensors gets 4.75volt power and the ESP32 gets 3.3v
The sensors read out fine but the results are very unstable.
Analog value - voltage - pascal - bar:
This is in my room, so 0.47 voltage seems to be the best result, 0.00.
But when I blow in the pressure sensor the voltage goes up and so does the bar.
I don't know what I do wrong but would like to fix the unstable results.
Does anyone have an idea what could go wrong?
This is the code:
Looking at the video/guide I followed theres something wrong with my voltage or my code.
Because the results seem really stable at the video. Blowing in the sensor does give a higher result so it does work. But overall the results are just really unstable
It is a bad idea to use a 5V ratiometric pressure sensor with a 3.3V ESP32 and a different ADC reference voltage. Expect unstable results.
A much better idea is to use a 5V Arduino, even a $2 Pro Mini. You can increase the effective ADC effective resolution to be the same (12 bits) by oversampling and averaging -- add up 64 samples and divide by 16.
here is the thing about gages: the bottom 4 or 5 percent of a gage are untrustworthy. they are not linear down where you are overcoming inertia. most gages are still linear up to 20 percent over, and will survive a 100% overload.
if you need to test a gage, give it 10% rated pressure. if you need to characterize a gage - calibrate is not the right word - step it up 10% at a time from 0 to 120%
I think the biggest problem here is that the ESP32 (and the ESP8266) doesn't have a ratiometric A/D.
That makes them unsuitable to directly read ratiometric sensors like thermistors, pots, hall current and pressure sensors.
Leo..
As far as I know the ESP32's ADC takes 0-1V as input. Maybe 1.1V. So at 20% of the scale you are saturating the input already. You'll have to add a 4:1 voltage divider on the sensor output.
Then the ratiometric problem... that can be overcome by a dedicated well regulated power supply for the sensor. If that's stable, the output is stable. Not the optimal solution but it will do.
The sensor output is said to be 0.5-4.5V meaning you're at the bottom of the limit. Instability can be expected. Apply a pressure to it (20-50 psi would be a good start) and you're likely to see more stability.
I assume that the ESP32 has a single ADC, just as the Uno has. With the Uno, it's common practice to read from the ADC twice per pin when you're reading from multiple pins so that the results for this channel aren't impacted by the last one you read.
Wawa:
I think the biggest problem here is that the ESP32 (and the ESP8266) doesn't have a ratiometric A/D.
That makes them unsuitable to directly read ratiometric sensors like thermistors, pots, hall current and pressure sensors.
Leo..
Didn't realize this. . You mean logryhthmic? It's linear ADC... 12Bit so 4000 levels
Ratiometric = referenced to Vcc, making it good for ratiometric sensors such as thermistors and other voltage divider based sensors.
Absolute (like the ESP) = fixed reference voltage, making it great for voltage inputs such as from a 4-20mA loop or other current sensors.
The ATMega processors as used on most Arduino boards allow you to choose - the default reference is Vcc, but it also has a fixed 1.1V built-in reference, and it can take a voltage on the AREF pin as reference.