ECE597 Project Adding Sense to Beagle

Revision as of 16:14, 21 July 2014 by Yoder (talk | contribs) (Moved to ECE597Spring2010)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sensory aware applications are becoming more mainstream with the release of the Apple iPhone. This project would combine both hardware and software to add sensory awareness to beagle. First, additional modules such as GPS, 3-axis accelerometers, gyroscopes, temperature sensors, humidity sensors, pressure sensors, etc, would be added to Beagle to compliment the microphone input in order to allow sensing of the real world environment. Then software APIs would need to be layered on top to allow easy access to the sensory data for use by applications.

This project focuses on utilizing the ADXL345 using the breakout board from SparkFun.


• Read data from I2C line -- Complete
• Call our library from another C program -- Complete
• Create clear documentation -- In progress


Week 3: Get accelerometer
Week 4: Hook up sensor to the I2C; See what Beagleboard does automatically with I2C.
Week 5: Learn how ARM I2C C functions work; Start coding.
Week 6: Finish coding.
Week 7: Do documentation.
Week 8: If we are on time, start working on another I2C sensor.
Week 9/10: Padding time.


ADXL345.c -- Code to interact with ADXL345.
ADXL345.h -- Header file.
demo.c -- Demonstration program, requires ncurses. Make sure to run it with colors enabled.
In order to properly link to ncurses, the compilation command should similar to arm-angstrom-linux-gnueabi-gcc demo.c adxl345.c -lncurses -o adxldemo.

Detail of ADXL345.c

According to i2c-tools, SMBus read does not work on the BeagleBoard. For that reason we are using plain I2C commands by reading from and writing to the file handle of the i2c-2 bus. One useful aspect of ADXL345.c is it provides a set of helper functions for working with I2C. For instance, reading from a register requires writing the address of that register before being able to read it. These functions simplify transfers so you do not have to keep calling the read and write commands, but rather call read_byte and pass it the desired register and a pointer to an unsigned char to store the data. Additionally, writing masked data is useful if you only want to change certain bits of the register, and a function is provided for that as well. The only downside is these do not support multibyte commands.
Interfacing with the ADXL345 is based on the specifications in the ADXL345 datasheet.

Working with ADXL345.c

Data collection is started by calling measure_mode(), which puts the ADXL into a process of continuous conversion. Data can then be read from the device using get_data_x (or _y, _z) and passing a pointer to a float. The function will return 0 if not successful (I believe this is a break in Linux convention, my apologies) and 1 if successful, along with the value of the acceleration in that direction in g's placed in the float.

Additional functions are provided for going into low power mode, standby mode, and setting the measured g range.

Team Members

Qiang Jiang
Adam Jesionowski