Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Implausible pysense pressure readings

    Scheduled Pinned Locked Moved Expansion Board
    pysensepressurealtitude
    3 Posts 2 Posters 856 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      tshead
      last edited by

      Using the MPL3115A2 on the PySense, I get sensible altitude readings:

      >>> mpa = MPL3115A2(sensors, mode=ALTITUDE)
      >>> mpa.altitude()
      1493.75 # ~4900ft, which is reasonable for where I live
      

      but very unreasonable pressure:

      >>> mpp = MPL3115A2(sensors, mode=PRESSURE)
      >>> mpp.pressure()
      5969.5 # 6000Pa = 29km, my breathing should be a bit labored!
      

      Any thoughts? I’ve been comparing the pysense library code to the data sheet for the MPL3115A2, but I don’t see anything obviously wrong.

      Thanks in advance,
      Tim

      catalinC 1 Reply Last reply Reply Quote 0
      • catalinC Offline
        catalin @tshead
        last edited by

        Hi @tshead,

        I can't reproduce exactly your scenario, but this is what I think it happens: you see the value 1493 is 4 times smaller than 5969, so the pressure sensor is stuck in altitude mode. Because the pressure and altitude numeric values are stored on the same registers, but the numeric function has a scale of 1:4 between them.
        If I try to instantiate the class MPL3115A2 twice, then I will have a problem; there is only a single sensor. Most likely, the MPL3115A2.py has to be modified to be "static"(as in Java/C++) or to always reset sensor in the right way: Altimeter or Pressure.

        >>> mpp = MPL3115A2(py,mode=PRESSURE)
        >>> mpa = MPL3115A2(py,mode=ALTITUDE) # sensor is set in Altitude mode
        >>> print("Altitude: " +  str(mpa.altitude()))
        Altitude: 62.875
        >>> print("Pressure: " +  str(mpp.pressure())) # careful, sensor is still in Altitude mode 
        Pressure: 248.0
        

        Catalin,

        Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
        Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

        T 1 Reply Last reply Reply Quote 0
        • T Offline
          tshead @catalin
          last edited by

          @catalin - thanks for the quick response. That makes sense, and after instantiating just one instance of MPL3115A2, I’m getting a pressure around 85000 Pa, which is still a bit low (~25 inches of mercury vs 30 according to the national weather service), but might be explained by an unset sea level reference.

          Cheers,
          Tim

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom