I recently got this sensor ADXL345, a digital accelerometer. I immediately set out on doing something with this sensor, simple yet not pointless.

The first thing to do is to read the accelerometer values. The sensor supports I2C and SPI. I decided to go with SPI. On reading the sensor values, I classify the sensor reading into three different categories. Sensor pointing along the X, Y or the Z axis. Once this is done, the microcontroller sends either 1, 2 or 3 to the serial port of the PC. On the PC a Processing code is running which receives the value from the serial port. Depending on the received value, the orientation of a cuboid is varied such that the orientation of the cuboid is same as the sensor.

The code running on the Arduino and the Processing code are both available on my GitHub repo.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s