Difference between revisions of "ECE597 Project Adding Sense to Beagle"

From eLinux.org
Jump to: navigation, search
m (Moved to ECE597Spring2010)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Description of Project ==
+
[[category:ECE597Spring2010 |P]]
Sensory aware applications are becoming more mainstream with the release of the Apple iPhone. This project would combine both HW and SW 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.
+
 
 +
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 [http://www.sparkfun.com/commerce/product_info.php?products_id=9045 breakout board from SparkFun.]
 +
 
 +
== Milestones ==
 +
• Read data from I2C line -- Complete<br>
 +
• Call our library from another C program -- Complete<br>
 +
• Create clear documentation -- In progress
  
 
== Timeline ==
 
== Timeline ==
Line 11: Line 19:
 
Week 9/10: Padding time.
 
Week 9/10: Padding time.
  
== Milestones ==
+
== Code ==
• Read data from I2C line.<br>
+
[http://pastebin.com/ktdbMFpa ADXL345.c] -- Code to interact with ADXL345.<br>
• Call our library from another C program.<br>
+
[http://pastebin.com/9bBb9RJV ADXL345.h] -- Header file.<br>
• Create clear documentation.
+
[http://pastebin.com/CyfSu0PU demo.c] -- Demonstration program, requires ncurses. Make sure to run it with colors enabled.<br>
[[category:ECE597]]
+
In order to properly link to ncurses, the compilation command should similar to <tt>arm-angstrom-linux-gnueabi-gcc demo.c adxl345.c -lncurses -o adxldemo</tt>.
 +
 
 +
=== 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.<br>
 +
Interfacing with the ADXL345 is based on the specifications in the [http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf 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.<br>
 +
<br>
 +
Additional functions are provided for going into low power mode, standby mode, and setting the measured g range.
 +
 
 +
== Team Members ==
 +
[[user:jiangq | Qiang Jiang]]<br>
 +
[[User:Jesionaj | Adam Jesionowski]]

Latest revision as of 16:14, 21 July 2014


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.

Milestones

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

Timeline

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.

Code

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