MPL3115A2 Troubleshooting

Posted on
  • Hello there!

    I posted something similar on this a while back, but I abandoned the project then. Arrogant as I am, I am back at the project again, which is going (slightly) better. I am building a weatherstation using:

    • DHT22 for Temp and RH,
      -TSL2561 for Light Measurements
      -MPL3115A2 for Pressure

    Basically, I have the light sensor and Temp sensor working, but I can't get the pressure board to go

    The configuration is:

    • DHT22 @ B5,
      -TSL @ B6 + B7,
      -MPL @ B4,A8

    I keep getting TIMEOUT errors, but the power and ground work for the TSL

    Can someone help me!



  • Pico or Standard board? Did you try the devices separately using the examples provided by

  • This is almost certainly because you need pullup resistors on the SDA and SCL data wires. Pretty much all I2C devices need it. Some modules have them pre-installed, but some don't

    • Pico
    • I tried them all separately, using the modules provided on the website
    • I purchased all my gear from adafruit, on the breakout boards (which come with resistors?)
    • Not sure what's going wrong here..
      // Here's the error message:
      "Uncaught InternalError: Timeout on I2C Write Transmit Mode 2
      at line 1 col 41
      ...eTo(C.MPL3115A2_ADDRESS,reg);var d=this.i2c.readFrom(C.MPL31...
      in function "readS16" called from line 1 col 67
      in function "MPL3115A2" called from line 1 col 19
      new MPL3115A2(_i2c)
      in function "connect" called from line 1 col 38
      var mpl = require("mpl").connect(I2C3);
      Uncaught Error: Field or method "getAltitude" does not already exist, and can't create it on undefined
      at line 1 col 4
      mpl.getAltitude(function(x) {
      > "
  • The I2C timeout is when it's not able to communicate with the module over I2C.


    • Did you set up I2C3 with I2C3.setup(...)?
    • Is it powered properly? Looks like it needs connecting up with Vin not 3.3v.

    Finally, try adding some 10k pull-up resistors. the Adafruit page doesn't mention that it has them and I think some Arduino boards to have them on so they may have left them off of the adaptor board?

  • Also, are SDA and SCL actually connected up to the right places? They could have got crossed over.

    • SDA and SCL are hooked up in the right spots,

    • It's running on 5v to Vin

    • I don't have any resistors, so I'll run to the store and pick some up. Would the DHT22 also require those? (It works for me...sometimes, but it's finnicky)

  • When boards have the resistors, then they usually have a pin or solder jumper to enable them, because only on resistor is needed for each line... (otherwise, the behavior would be dependent on the number of connected devices to a point where either drivers could not fan the load anymore and signals become useless.... like: if too many people hold the rope down or up, no single individual would be able to raise or lower it! Espruino (STM MC) has a pull-down/pull-up option on the pins, but in this case it is too weak for I2C: 30..40K vs 4K7 (even though 4K7 works for most cases, the answer for 'What value the resistor should have?' is not that simple). --- How to get something tested right away until you get your resistors? Do you have some unused GPIO ports left? Configure 2..4 of them as pinMode(,"input_pullup") and connect them to SCL and SDA - of course for each individually - that gives you at least some pulling and may already help... ;-) --- This is not the 'production' solution... but Apollo13 parents still a lot of creativity!

    Some error messages get a bit convoluted on bubbling up, especially the uncaught / unexpected ones, because it is expected that under normal circumstances the hardware is properly setup - no offense here, the culprit could just be the well known faulty breadboard contact - and wasting space to bubble up all variations is a waste of space... especially when there is a stack trace available as in Espruino (thank you @Gordon... robust and concise software design and implementation).

  • I think the DHT22 should be ok without them - it's not I2C. The DHT22 module got updated this week though, so it might be a bit better?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

MPL3115A2 Troubleshooting

Posted by Avatar for scottKing @scottKing