KokoMcNeal
Posts: 14
Joined: Wed Mar 04, 2015 2:25 pm

First reading of pressure sensor always 0

Wed Sep 23, 2015 5:34 pm

Dear all,
does anybody of you experience the same problem?
When I query the pressure and the temperature from the pressure sensor of the Sense Hat, the first reading is always 0 for both values. The code is very simple and directly from the API site:

Code: Select all

from sense_hat import SenseHat
sense = SenseHat()

tempFromPressure = sense.get_temperature_from_pressure()
print("Temperature from pressure: %s C" % tempFromPressure)

pressure = sense.get_pressure()
print("Pressure: %s Millibars" % pressure)
When I run this for the first time I get:
Temperature from pressure: 0 C
Pressure: 0 Millibars

All subsequent readings work well - I get useful values. When I reboot the Pi wihout removing power, the first reading after the reboot is also fine. If I power down the Pi, remove power and start it up again, it has troubles with the first reading again: it reads Zero.

This happens only with the pressure sensor. When I query temperature and air humidity from the humidity sensor, I get useful values already from the first reading.

Does anyone have any idea what could be the cause? I assume this behaviour is not intendet. Does the pressure/temperature sensor need a wake up signal for the first measurement? :-)

User avatar
Kratos
Posts: 395
Joined: Sun Apr 12, 2015 12:41 pm

Re: First reading of pressure sensor always 0

Fri Sep 25, 2015 3:52 pm

My situation is the same except, if I run the code again, it works just fine. Just the pressure sensor does this. For me, I don't need to reboot for it to work correctly, just run it again. My personal theory is this: I think the pressure sensor just needs "to wake up". (we all know this can be difficult :lol: )

Hope this helps.
Kratos

PS: I noticed I can't fit a jumper wire into the pass through connector. Any thoughts?
I have posted mostly with a Pi 2 running either Ubuntu MATE, or Raspbian.

KokoMcNeal
Posts: 14
Joined: Wed Mar 04, 2015 2:25 pm

Re: First reading of pressure sensor always 0

Fri Sep 25, 2015 3:55 pm

Hi Kratos, thanks for sharing.
When I run the code a second time, it also works for me.

I only described the reboot thing to make clear, that after a "cold" start the first reading is 0.
Whereas after a "warm" reboot, the first reading works.

I also suspect the sensor needing a wakeup call ;-)

Return to “Astro Pi”