Interface ADXL345 Accelerometer with Arduino & Processing Animation

Interface ADXL345 Accelerometer with Arduino & Processing Animation (Last Updated On: January 28, 2019)

Interface ADXL345 Accelerometer with Arduino & Processing Animation:

In this tutorial we will learn how to Interface ADXL345 Accelerometer with Arduino & Processing Animation with 3D Animation view.We will also learn how does the Accelerometer ADXL345 works and also about some practical applications using this sensors.


You can also visit our few tutorials that are related to accelerometer:
1. Acceleration Measurement with Accelerometer ADXL335 & Arduino
2. Arduino Earthquake Detector Alarm with Seismic Graph using Accelerometer


What is MEMS Accelerometer?

Most accelerometers are Micro-Electro-Mechanical Sensors (MEMS).

An accelerometer is an electromechanical device that measures both static (gravity) and dynamic (motion or vibration) accelerations. An accelerometer measures proper acceleration, which is the acceleration it experiences relative to freefall and is the acceleration felt by people and objects. For example, an accelerometer at rest on the surface of the Earth will measure an acceleration due to Earth’s gravity, straight upwards (by definition) of g ≈ 9.81 m/s2. By contrast, accelerometers in free fall (falling toward the center of the Earth at a rate of about 9.81 m/s2) will measure zero.




Structure of Accelerometer:

Conceptually, an accelerometer behaves as a damped mass on a spring. When the accelerometer experiences an acceleration, the mass is displaced to the point that the spring is able to accelerate the mass at the same rate as the casing. The displacement is then measured to give the acceleration.

Interface ADXL345 Accelerometer with Arduino & Processing Animation

In commercial devices, piezoelectric, piezoresistive and capacitive components are commonly used to convert the mechanical motion into an electrical signal. Modern accelerometers are often small micro electro-mechanical systems (MEMS), and are indeed the simplest MEMS devices possible, consisting of little more than a cantilever beam with a proof mass (also known as seismic mass).


Working of Accelerometer:

There are many different ways to make an accelerometer! Some accelerometers use the piezoelectric effect – they contain microscopic crystal structures that get stressed by accelerative forces, which causes a voltage to be generated.

Interface ADXL345 Accelerometer with Arduino & Processing Animation

Another way to do it is by sensing changes in capacitance. If you have two microstructures next to each other, they have a certain capacitance between them. If an accelerative force moves one of the structures, then the capacitance will change. Add some circuitry to convert from capacitance to voltage, and you will get an accelerometer. There are even more methods, including use of the piezoresistive effect, hot air bubbles, and light.


ADXL345 3 Axis Accelerometer:

ADXL345 3 Axis Accelerometer:

You can buy this product from Amazon: Click Here:

ADXL345 is a 3-axis accelerometer with high-resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either an SPI (3- or 4-wire) or I2C digital interface.

Interface ADXL345 Accelerometer with Arduino & Processing Animation

The ADXL345 is well suited to measures the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes less than 1.0 degrees.

Pins Description & Function:

Interface ADXL345 Accelerometer with Arduino & Processing Animation

ADXL345 Working with I2C Communication:

The I2C bus is a shared bus that consists of only two signals, a clock line (SCL) and a data line (SDA). A single I2C bus can connect two or more devices and any device can be a master or a slave (the same device can even assume both roles at different times). Only masters can initiate communication. Slave devices are assigned unique 7-bit or 10-bit device addresses through hardware configuration and monitor the bus for their address to be called, responding to any master device that begins a transaction. That means that you have to ensure that each slave device on your I2C bus has a unique address.



Interface ADXL345 Accelerometer with Arduino & Processing Animation

An I2C bus requires pull-ups on the SDA and SCL lines to keep the bus at a high voltage level when neither the master nor slave device is driving the bus. The pull-ups are created by attaching each of the interface wires to the supply voltage through an appropriately-sized resistor. The size of the resistor is chosen by the length of trace that will be used, which impacts the capacitance of the trace, and the speed of the I2C bus. Long traces create higher capacitance and require a lower value resistor to return the wire to a high voltage level after an I2C device has stopped driving the wire to a low voltage level.


How to Interface ADXL345 Accelerometer with Arduino & Processing ?

To Interface ADXL345 Accelerometer with Arduino & Processing IDE you need Breadboard, Connecting Wires, Arduino UNO Board, ADXL345 accelerometer and 16*2 LCD (optional). Assemble the circuit as shown in the figure below.

Interface ADXL345 Accelerometer with Arduino & Processing Animation


Source Code/Program:





Processing IDE 3D Animation Code


Video Tutorial & Explanation:

Apart from all this you can see our project with the application of ADXL345: Earthquake Detector Using Accelerometer and Arduino with Seismic Graph

Recommended For You

Ask A Question .......

Close