Pressure sensing questions #366
Replies: 5 comments 2 replies
-
ADS1115 has FSR = 6.144V by default, so 4.5V will be 4.5 / (6.144 / (215)) = 24000. The same way 0.5V will be 2666.7. Now you can subtract the latter from the former and divide it by 12, and this will be the value for 1 bar - 1777.8.
|
Beta Was this translation helpful? Give feedback.
-
ADS1015 FSR is 6.144V as well. What is the voltage range for your 13.8 bar transducer? If it's the same 0.5V-4.5V, then you just take a 12 bit range of 1333.3 and divide it to 13.8. |
Beta Was this translation helpful? Give feedback.
-
Hmmm... I'm editing the code for my 200psi transducer and I think the 12-bit calculation in getPressure() is wrong. The "16bit" calculation (per the comment on the end of the ADS1115 line) is actually 15-bit (right?). The 12-bit calculation should, logically, be 1/8th of the 15-bit value. 1777.8 / 8 is 222.2, not 111.11. As it is, it looks like the 12-bit calculation is assuming the 15-bit value is 16-bit and dividing by 16, to get an incorrect 12-bit value of 111.11. |
Beta Was this translation helpful? Give feedback.
-
If you take a look at the datasheet you'll see that 12bits for ADS101x and 16 bits for ADS111x are for the entire ±FSR range, so for positive range you'll get lower 11 and 15 bits respectively. |
Beta Was this translation helpful? Give feedback.
-
Ah, I see again. Thanks. All the math works if I use 11 for the bit resolution of ADS1015. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Love this project! First off, let me say that I'm still sourcing parts. I don't even have this installed yet. I have at least done the first test start-up to be sure the stm32, Nextion display, and thermocouple are working. I feel like I'm probably too much of a noob to be starting a discussion on the GitHub already, but here I am. Sorry. I also checked in the discord for a possibly better place to bring this up, but I couldn't find a nice fit in there.
Anyway, I'll get to it: I was unable to source the 1.2Mpa transducer. I ended up with a 200psi transducer. Google says that's 1.38Mpa. Pretty close, but I figured I better have a look at pressure_sensor.cpp to see what I need to fiddle with to make my transducer give correct data.
To make sense of the hard-coded values, I decided to make the compiler do all the math, using constant values for bit resolution and transducer details:
This is all completely untested code, btw. To check for correctness, I did the above calculations on a calculator for 8, 10, and 15-bit resolutions. Looking at the comments for the hard-coded values in pressure_sensor.cpp, the above works correctly (on my calculator) for 8-bit and 10-bit, but 15-bit is off.
Using the above to calculate kRawOneBar...
8-bit yields: 17.1 (hard-coded value in comments is the same)
10-bit yields: 68.27 (again, hard-coded value in comments is the same)
15-bit yields: 2184.5 (hard-coded value is 1777.8)
If I use the 15-bit raw max or min from the comments (24000 or 2666.7) and reverse calculate to get bit resolution, I get something BETWEEN 14 and 15 bits.
I'm thinking perhaps the 15-bit numbers were measured, rather than calculated (like a calibration). That seems better than just assuming values, but how can I do the same thing with my setup? I guess my question is, what numbers do I use for my transducer? Should I calculate as above, or use the hard-coded 15-bit numbers and then, at the end, divide by 13.8 bar instead of 12 bar? I guess I'm wondering where the 15-bit numbers come from.
Just thinking about it now, I suppose I can measure the transducer's output when the pump isn't running and also when it is running to get a range from ambient pressure (pump off) to 12 bar (pump on - the little spring ensures the max is 12 bar, right?).
Any guidance would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions