This week I decided to experiment with the DPS368 Pressure Shield2Go module.
The module was installed onto one of two available sites for Platform2Go modules.
I used DAVE to assign SCL and SDA to P3.0 and P2.5 respectively.
The DPS368 device that is used for the air pressure measurements is fairly complicated in terms of the calculations and post processing that need to be performed to the raw pressure and temperature readings.
First it is necessary to convert the raw pressure reading (Praw) to a scaled format (Praw_sc).
For the low precision, manual measurement mode I am using this works out to:
Praw_sc = Praw / 524,288
From there, calculating pressure requires a number of coefficients. The formula for this, which appears below, is from Infineon's DPS368 datasheet.
If you aren't interested in temperature compensation, I believe the formula's first 3 terms are sufficient.
The last two terms in the formula apply temperature compensation for increased accuracy.
The coefficients in the equation above, C00, C10, etc., are unique for each device and are stored in registers 0x10 through 0x21.
When I read back from these registers on my device this is what I got....
Currently I am not using temperature compensation. The code below shows the function I use to calculate air pressure in (Pa) units.
So, just how accurate are the readings from the DPS368?
At 9:00AM the official reading for my town was 102.30kPa.
The value I read back from the DPS368 was 102,255Pa.
Greater accuracy can be achieved through temperature compensation and oversampling (i.e. programming the device to perform multiple measurements).
These techniques are more involved than what I am currently doing... so I may press ahead and only come back to improve accuracy if time permits.
In Closing
So, yeah... the DPS368 pressure formula is pretty complicated by microcontroller standards and this is the first time I used floats in a microcontroller application in like... forever....
.But it was really rewarding to see pressure readings that closely match those that are officially reported for my town.






