LSM303 Accelerometer Interrupts?

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
richlangston007
 
Posts: 2
Joined: Mon Jun 09, 2014 4:05 pm

LSM303 Accelerometer Interrupts?

Post by richlangston007 »

I want to use this accelerometer in one of my projects. The datasheet says it supports two programmable interrupts, and there seem to be two pins for that externally on the breakout board. I'm a bit of a noob, though. How do I program these interrupts? It doesn't look like the library supports this.

All I want to do is have one go high if there's motion so that I can wake up my arduino.

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: LSM303 Accelerometer Interrupts?

Post by adafruit_support_bill »

The interrupt capabilities of the LSM303 are pretty powerful. But I'm not aware of any libraries that support it.

The documentation of the interrupt registers starts on page 29:
http://www.adafruit.com/datasheets/LSM303DLHC.PDF
It looks like you need to enable one or more of the various interrupt modes in the configuration register, specify one or more sources in the source register then set the threshold and duration in their respective registers.

User avatar
richlangston007
 
Posts: 2
Joined: Mon Jun 09, 2014 4:05 pm

Re: LSM303 Accelerometer Interrupts?

Post by richlangston007 »

Yeah, my reading is I need program a 0, and then all 1's, into INT1_CFG_A (30h).

I guess I need to use this library function, with the appropriate register values...
void Adafruit_LSM303::write8(byte address, byte reg, byte value)
{
Wire.beginTransmission(address);
Wire.write(reg);
Wire.write(value);
Wire.endTransmission();
}

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: LSM303 Accelerometer Interrupts?

Post by adafruit_support_bill »

That would be the function to use to write the registers.

I believe you would also need to set the source, threshold and duration registers to generate interrupts based on detected motion.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”