Monday, February 7, 2011

And software emerges into the physical world

The Hardware
The setup for the each dancer consists of two accelerometers and a button connected to an Arduino FIO with an Xbee module for wireless connection.

The Microcontrollers
Arduino FIO is chosen as microcontroller unit because of the size constraints of the setup and ready made socket for a lithium polymer battery and XBee connection.
The Accelerometers

After a little research, I decided to use ADXL 345 accelerometers because of the i2c support.
The wireless communication constraints of the setup made it impossible to use the SPI protocol for the arduino - accelerometer communication.
The breakout connection for two accelerometers was a bit tricky but after checking the datasheet the connections for assigning different accelerometer addresses.

The difference of two breakout boards is to assign the address of (0x53) the SDO needs to be connected to GND and for the address of (0x1D) the SDO needs to be connected to VCC.

The breakout board circuits can be downloaded for etching (0x1d) (0x53)

Once the connections are made coding is pretty straightforward,

1- Initiate i2c connection
2- Initialize the accelerometers
3- Request the readings from each accelerometer
4- Transmit the values read over XBee through serial connection

In depth information and the original source code on the arduino and adxl345 communication can be found on Live fast - Code Young blog

The source code can be downloaded here

1 comment: