Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

ADXL362 triple axis accelerometer driver


  • Please log in to reply
5 replies to this topic

#1 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 07 May 2014 - 06:33 PM

Hi guys, 

I've written a driver for the ADXL362 chip. I bought mine from Sparkfun.

 

Here is an example of how to set it up to raise events when it is moved, and again when it is put back to rest.

ADXL362Accelerometer accelerometer = new ADXL362Accelerometer(Pins.GPIO_PIN_D10, Pins.GPIO_PIN_D1, Pins.GPIO_NONE);
accelerometer.OnInt1Changed += accelerometer_OnInt1Changed;
accelerometer.ConfigureMotionActivatedSleep();

I've included predefined configurations for the examples used in the datasheet and the Arduino driver. The others are:

accelerometer.ConfigureAutoMotionSwitch();
accelerometer.ConfigureFreeFall();
accelerometer.ConfigureSimpleRead();
accelerometer.ConfigureTiltOnOff();

The chip also has a temperaturesensor, and you can read the current XYZ values.

 

The class is attached - hope someone finds it useful :)

Attached Files



#2 Esben

Esben

    Member

  • Members
  • PipPip
  • 13 posts

Posted 14 May 2014 - 10:24 AM

Hi Frode,

 

Great work on the driver :)

 

I'm trying to convert your driver for use with my ADXL345 (http://www.adafruit.com/products/1231), and I want to use it with I2C instead of SPI.

From what I can see I need to rewrite all the SPI methods and the ADXL362Accelerometer method, for use with I2C.

 

Would I be so lucky that you have some experience in creating I2C drivers?



#3 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 14 May 2014 - 10:14 PM

Hi Esben, you should take a look at the SSD1306 driver (for an OLED display). It was originally written for SPI, and then expanded to I2C. If you look at that driver you'll get a sense of what you need to change from SPI to I2C.

 

The code in that thread has become a little garbled, I believe the forum broke a lot of the code examples a few weeks back :/

 

I took a quick look at the ADXL345 datasheet, and seems like the registeres are pretty different, so converting the ADXL362 driver will take some time and effort.



#4 Esben

Esben

    Member

  • Members
  • PipPip
  • 13 posts

Posted 15 May 2014 - 06:46 AM

Hi Frode,

 

Thank you for the quick reply.

 

I have will have a look at the SSD1306 driver, you wouldn't happen to have a source file that isn't garbled?



#5 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 15 May 2014 - 07:01 AM

Sure, you can download it from here.



#6 Esben

Esben

    Member

  • Members
  • PipPip
  • 13 posts

Posted 15 May 2014 - 07:10 AM

Sure, you can download it from here.

 

Great, thank you!  :D






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.