element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi IoT
  • Challenges & Projects
  • Design Challenges
  • Pi IoT
  • More
  • Cancel
Pi IoT
Forum Sense Hat Environmental Sensors
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 6 replies
  • Answers 2 answers
  • Subscribers 4 subscribers
  • Views 1798 views
  • Users 0 members are here
  • pi 3
  • sense hat
Related

Sense Hat Environmental Sensors

vish
vish over 10 years ago

Hi,

I received my package today and was testing Sense Hat. I wrote a small script to log the values to screen.

# Test for environmental sensors

from sense_hat import SenseHat
from time import sleep

sh = SenseHat()

try:
    while True:
        t = sh.get_temperature()
        p = sh.get_pressure()
        h = sh.get_humidity()

        t = round( t, 1 )
        p = round( p, 1 )
        h = round( h, 1 )

        print( "Temp = %s    Prsr = %s    Hmdt = %s" %(t,p,h) )
        sleep( 1 )

except KeyboardInterrupt:
    print( "Exiting..." );

 

But I am getting negative values for temperature and humidity.

Temp = -422.2
Prsr = 1008.2
Hmdt = -39.8
Temp = -422.6
Prsr = 1008.2
Hmdt = -39.8
Temp = -421.5
Prsr = 1008.2
Hmdt = -39.7
Temp = -422.0
Prsr = 1008.2
Hmdt = -39.8
Temp = -422.1
Prsr = 1008.2
Hmdt = -39.8
Temp = -422.0
Prsr = 1008.2
Hmdt = -39.8
Temp = -422.0
Prsr = 1008.2
Hmdt = -39.8
Temp = -422.1
Prsr = 1008.2
Hmdt = -39.8
Temp = -422.1
Prsr = 1008.2
Hmdt = -39.8
Temp = -422.1
Prsr = 1008.2
Hmdt = -39.8
Temp = -422.1
Prsr = 1008.2
Hmdt = -39.8

 

Can anyone tell me what is it I'm doing wrong?

 

Thanks,

vish

  • Sign in to reply
  • Cancel

Top Replies

  • fvan
    fvan over 10 years ago +1 verified
    According to https://www.raspberrypi.org/forums/viewtopic.php?f=104&t=148103&start=50 it is most likely a HW issue. I'll check mine later today ... Frederick Edit: Quickly plugged it in and copy/pasted…
  • fvan
    fvan over 10 years ago +1 suggested
    Confirmed as HW issue on RPi forums. Some distributors may have stock of faulty units, so that's what we're probably suffering from ... element14Dave https://www.raspberrypi.org/forums/viewtopic.php?f…
  • fvan
    0 fvan over 10 years ago

    According to https://www.raspberrypi.org/forums/viewtopic.php?f=104&t=148103&start=50  it is most likely a HW issue. I'll check mine later today ...

     

    Frederick

     

    Edit: Quickly plugged it in and copy/pasted your code. Results are positive and stable:

     

    pi@raspberrypi:~ $ sudo python sensehat.py
    Temp = 35.3    Prsr = 0.0    Hmdt = 29.4
    Temp = 35.3    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.3    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.5    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.4    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.3    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.3    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.4    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.4    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.5    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.3    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.5    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.4    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.4    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.4    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.4    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.5    Prsr = 1021.9    Hmdt = 29.4
    Temp = 35.4    Prsr = 1021.9    Hmdt = 29.4
    ^CExiting...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • vish
    0 vish over 10 years ago

    Hi element14Dave, it seems like I received a defective sense hat. Is it possible to get a replacement for it?

     

    With Thanks,

    Vishnu Raj

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fvan
    0 fvan over 10 years ago in reply to vish

    For no apparent reason, mine is now also giving negative temperatures ... :s

    Temp = -153.9°C    Prsr = 1023.4mb   Hmdt = 0.8%
    Temp = -154.0°C    Prsr = 1023.5mb   Hmdt = 0.7%
    Temp = -153.8°C    Prsr = 1023.5mb   Hmdt = 0.7%
    Temp = -154.9°C    Prsr = 1023.5mb   Hmdt = 0.6%
    Temp = -155.6°C    Prsr = 1023.5mb   Hmdt = 0.5%
    Temp = -155.4°C    Prsr = 1023.4mb   Hmdt = 0.5%
    Temp = -156.0°C    Prsr = 1023.4mb   Hmdt = 0.4%
    Temp = -155.9°C    Prsr = 1023.4mb   Hmdt = 0.4%
    Temp = -156.1°C    Prsr = 1023.4mb   Hmdt = 0.4%
    Temp = -156.1°C    Prsr = 1023.5mb   Hmdt = 0.4%
    Temp = -156.0°C    Prsr = 1023.4mb   Hmdt = 0.4%
    Temp = -155.7°C    Prsr = 1023.4mb   Hmdt = 0.5%
    Temp = -155.9°C    Prsr = 1023.5mb   Hmdt = 0.3%
    Temp = -155.7°C    Prsr = 1023.5mb   Hmdt = 0.4%

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fvan
    0 fvan over 10 years ago in reply to vish

    vish , I suspect something me be wrong with your humidity sensor (and now mine??).

     

    An alternative way for temperature, is to retrieve it from the pressure sensor:

     

    #t = sh.get_temperature()
    t = sh.get_temperature_from_pressure()

     

    That should help you getting 2 out of 3 values image

     

    Frederick

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • fvan
    0 fvan over 10 years ago

    Confirmed as HW issue on RPi forums. Some distributors may have stock of faulty units, so that's what we're probably suffering from ... element14Dave

    image

     

    https://www.raspberrypi.org/forums/viewtopic.php?f=104&t=148103&start=50

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • carmelito
    0 carmelito over 10 years ago

    element14Dave , fvan and vish - look like the sense hat is behaving erratically for me as well image..

    Here is screenshot, running vish  sample code above..image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube