0

MPL3115A2 not working
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MPL3115A2 not working

by kmhughes on Mon May 04, 2015 11:11 pm

Hi folks,

I bought the MPL3115A2 breakout board and connected it to the first I2C bus on an Arduino DUE.

I have +3.3 connected to Vin, Gnd to Gnd, SDA to SDA and SCL to SCL. I have triple checked the wiring.

I am using the standard Adafruit library.

I am not getting anything from the board. The begin() function is returning false every time and the program just prints "Couldnt find sensor".

I then wired the board to an Aduino UNO and it worked just fine.

I also tried connecting the +3.3 to the 3V pin on the MPL3115A2 breakout hoping it was just something about power.

I did attach the AM2315 to the same I2C pins and it worked just fine. I removed the AM2315 from the bus so that only the MPL3115A2 was on it.

Thoughts why it isn't being seen on the DUE?

kmhughes
 
Posts: 14
Joined: Sun Apr 26, 2015 6:53 pm

Re: MPL3115A2 not working

by adafruit_support_rick on Tue May 05, 2015 12:07 pm

Try wiring it to the I2C bus at pins 20 and 21. That's the "first" bus.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPL3115A2 not working

by kmhughes on Tue May 05, 2015 12:17 pm

Pins 20 and 21 are the pins it is wired to.

I know the I2C works for both buses on the DUE as I have had AM2315s attached to both, so it isn't the Arduino libraries. And at the moment I have nothing else attached to pins 20 and 21, so I know there is nothing from having the AM2315 there, though that is what I want eventually.

Just to confirm, I can wire +3.3V to the Vin (leftmost pin on the breakout of the MPL3115A if the pins are at the bottom), and not the 3rd pin, and everything will be OK?

And perhaps is there a need for pullups on the SDA and SCL lines, same as the AM2315? The board worked without pullups on the UNO, but perhaps the lower voltage is an issue?

Thanks!

kmhughes
 
Posts: 14
Joined: Sun Apr 26, 2015 6:53 pm

Re: MPL3115A2 not working

by adafruit_support_rick on Tue May 05, 2015 4:54 pm

The module already has pullups.
Connecting 3.3v to Vin is correct.

It works on a Uno but not a Due? That is odd. Let me investigate a little.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPL3115A2 not working

by adafruit2 on Thu May 07, 2015 12:07 pm

The MPL3115A2 does have pullups, can you try running the i2c scanner? it will help you determine if the sensor address is found on the I2C bus

Code: Select all | TOGGLE FULL SIZE
/**
 * I2CScanner.pde -- I2C bus scanner for Arduino
 *
 * 2009, Tod E. Kurt, http://todbot.com/blog/
 *
 */

#include "Wire.h"
extern "C" {
#include "utility/twi.h"  // from Wire library, so we can do bus scanning
}

byte start_address = 0;
byte end_address = 127;

// standard Arduino setup()
void setup()
{

    while (!Serial);
    delay(1000);

    Wire.begin();

    Serial.begin(9600);
    Serial.println("\nI2CScanner ready!");

    Serial.print("starting scanning of I2C bus from ");
    Serial.print(start_address,DEC);
    Serial.print(" to ");
    Serial.print(end_address,DEC);
    Serial.println("...");

    // start the scan, will call "scanFunc()" on result from each address
    //scanI2CBus( start_address, end_address, scanFunc );
    uint8_t data;
    for (uint8_t addr = start_address; addr<=end_address; addr++) {
      Serial.print("addr: 0x");
      Serial.print(addr,HEX);
      if (! twi_writeTo(addr, &data, 0, 1, 1)) {
        Serial.print(": found!");
      } else {
        Serial.print("\t");
      }
      Serial.print( (addr%4 == 3) ? "\n":"\t");
 
    }
    Serial.println("\ndone");
}

// standard Arduino loop()
void loop()
{
    // Nothing to do here, so we'll just blink the built-in LED
    digitalWrite(13,HIGH);
    delay(300);
    digitalWrite(13,LOW);
    delay(300);
}

adafruit2
Site Admin
 
Posts: 20283
Joined: Fri Mar 11, 2005 7:36 pm

Re: MPL3115A2 not working

by kmhughes on Fri May 08, 2015 3:59 pm

Cool, I will give that a try ASAP.

Thanks.

kmhughes
 
Posts: 14
Joined: Sun Apr 26, 2015 6:53 pm

Re: MPL3115A2 not working

by kmhughes on Sun May 10, 2015 3:43 pm

OK, I ran an I2C scanner on the bus. I couldn't run the one you sent, the twi.h library is not available for the Due, so I used this one.

http://playground.arduino.cc/Main/I2cScanner

It found the device on address 0x60, which, as you know, is the correct one.

I also ran the scanner on the Uno, it found it at the same address and I was able to get results from the sensor. Still no results on the Due.

kmhughes
 
Posts: 14
Joined: Sun Apr 26, 2015 6:53 pm

Re: MPL3115A2 not working

by adafruit_support_rick on Mon May 11, 2015 8:51 am

I will order one of these and see if I can get it to work on the Due. It will take a few days... Thanks for your patience!

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPL3115A2 not working

by kmhughes on Mon May 11, 2015 9:57 am

Many thanks!

kmhughes
 
Posts: 14
Joined: Sun Apr 26, 2015 6:53 pm

Re: MPL3115A2 not working

by adafruit_support_rick on Tue May 12, 2015 4:20 pm

Well, I'm getting nowhere with this. I haven't been able to make it work, and I can't find anything wrong with the library. It may simply be incompatible with the Due. Sorry.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPL3115A2 not working

by kmhughes on Tue May 12, 2015 4:30 pm

OK, many thanks for trying, I appreciate it

I will order the SparkFun board that doesn't have the pullups and level shifters on it, it is a pure 3.3v part. It may still not work, but I want to give it a try.

kmhughes
 
Posts: 14
Joined: Sun Apr 26, 2015 6:53 pm

Re: MPL3115A2 not working

by adafruit_support_rick on Tue May 12, 2015 5:16 pm

I think it must be something in the Wire library for the Due. Either that, or there's some strange timing thing with the part itself.
Good luck!

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: MPL3115A2 not working

by kmhughes on Sun May 17, 2015 5:06 pm

It must be some strange timing something or other. I got the Sparkfun part and could not communicate with it as well. Oh well, so much for using the Due, I think I will try the Teensy since it has 2 I2C ports on it.

Many thanks for your help!

kmhughes
 
Posts: 14
Joined: Sun Apr 26, 2015 6:53 pm

Re: MPL3115A2 not working

by kmhughes on Sun May 17, 2015 8:13 pm

OK, it worked on both I2C buses on the Teensy. I had to switch from using Wire.h to i2c_t3.h and using the class Wire to using the class i2c_t3, but I can get the barometer readings from both buses.

I will put mods to the Adafruit library on my github acct. I also now need tpo modify my AM2315 libraries and confirm they work on the Teensy.

Sad that the DUE never worked. Oh well, at least the Teensy is... smaller.

kmhughes
 
Posts: 14
Joined: Sun Apr 26, 2015 6:53 pm

Re: MPL3115A2 not working

by adafruit_support_rick on Mon May 18, 2015 10:34 am

Yeah. I'm going to chalk it up to a bug in the Due I2C library. The Due itself is not a bad little processor.

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.


cron