3

members

Easy Basics: Project 031a ADXL335 (GY-61) three-axis accelerometer module

of Lex C in UNO

Basics: Project 031a

Project name: ADXL335 (GY-61) three-axis accelerometer module

Attachments: Calibration sketch and example sketch

In this project, you needed these parts (you can check the parts which we used for this projects by clicking the links) :

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. ADXL335 module 1pc

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, M-M

5. Small breadboard 1 pc

6. Resistor 1 pc 10 KOhm

7. Momentary switch(button) 1 pc

General

We will learn how to connect ADXL335 to Arduino board, calibrate and use it.

Understanding the ADXL335 module

An accelerometer is used to measure the force generated during the acceleration. The most fundamental is the commonly-known acceleration of gravity which is 1g. By measuring the acceleration caused by gravity, you can calculate the tilt angle of the device to the level surface. Through analyzing the dynamic acceleration, you can tell the way how the device is moving. For example, self-balancing board or hoverboard applies the acceleration sensor and gyroscope for Kalman filter and posture correction.

The sensor consists of a micro-machined structure on a silicon wafer. The structure is suspended by polysilicon springs which allow it to deflect in the when subject to acceleration in the X, Y and/or Z axis. Deflection causes a change in capacitance between fixed plates and plates attached to the suspended structure. This change in capacitance on each axis is converted to an output voltage proportional to the acceleration on that axis. 

The ADXL335 is a small, thin, low power, complete 3-axis accelerometer with signal-conditioned voltage outputs. The ADXL335 can measure at least +/- 3G in the X, Y and Z axis. It is perfect for high resolution static acceleration measurements such as tiltsensing, as well as for moderate dynamic accelerations from motion, shock or vibration.

Ratiometric output means that the output voltage increases linearly with acceleration over the range. For the ADXL335, that is approximately 0v at -3G to 3.3v at +3G. Note that the specified device ranges are guaranteed minimum ranges. Most actual devices will have a somewhat wider usable range. Also, due to manufacturing variations the zero point may be slightly offset from exactly 1/2 scale. We will discuss how to calibrate the range and offset in the Calibration and Programming section of this project.

ADXL335 is  an accelerometer module that uses a 5x5x2 mm LCC packaging when the ambient temperature ranges from -55 degrees C to 125 degrees C. The operating voltage of ADXL335 ranges from 1.8V to 3.6V. It’s quite convenient for embedding hardware in engineering projects. 
The ADXL335 takes a supply voltage (Vs) of 1.8-3.6 V. The analog outputs are scaled proportionally to the supply voltage; at Vs = 3.6 V, the output will change by 2x for the same acceleration as compared to Vs = 1.8 V. Although the output sensitivity is scaled proportionally to the input voltage, noise is not, so higher supply voltages are advisable to reduce the impact of noise.
At all supply voltages, 0 g acceleration corresponds to an output voltage of Vs/2. At Vs = 3.6 V, the datasheet specs the typical sensitivity at 360 mV / g, with g as standard gravitational acceleration.

The ADXL335 takes a supply voltage (Vs) of 1.8-3.6 V. The analog outputs are scaled proportionally to the supply voltage; at Vs = 3.6 V, the output will change by 2x for the same acceleration as compared to Vs = 1.8 V. Although the output sensitivity is scaled proportionally to the input voltage, noise is not, so higher supply voltages are advisable to reduce the impact of noise.
At all supply voltages, 0 g acceleration corresponds to an output voltage of Vs/2. At Vs = 3.6 V, the datasheet specs the typical sensitivity at 360 mV / g, with g as standard gravitational acceleration.

Using an Accelerometer for Inclination Sensing. See more info here.

Specification of the module attached here.

Calibration and Programming 

As with all sensors, there is some variation in output between samples of these accelerometers. For non-critical applications such as game controllers, or simple motion or tilt sensors, these variations are not important. But for applications requiring precise measurements, calibration to a reliable reference is a good idea.

Acceleration is measured in units of gravitational force or "G", where 1G represents the gravitational pull at the surface of the earth. Gravity is a pretty stable force and makes a convenient and reliable calibration reference if you happen to be a surface-dwelling earthling.
To calibrate the sensor to the gravitational reference, you need to determine the sensor output for each axis when it is precisely aligned with the axis of gravitational pull. Laboratory quality calibration uses precision positioning jigs. The method described here is simple and gives surprisingly good results.

Signals and connections of ADXL335 module

There is a 3.3V voltage regulator chip on some modules, so you can power them with 5V or 3.3V. But there are some with 3.3V power connection only. Check specification of the module before connecting it to the Arduino board 5V otherwise you will burn it. 

The accelerometer ADXL335 module can have different pins:

GND-to be connected to Arduino board GND

VCC-to be connected to Arduino board 5V

X or Xout - X Channel Output,  to be connected to Arduino board analog pin

Y or Yout - Y Channel Output, to be connected to Arduino board analog pin

Z  or Zout, Z Channel Output, to be connected to Arduino board analog pin

ST or Test - This pin controls the self-test feature. When this pin is set to VS, an electrostatic force is exerted on the accelerometer beam. The resulting movement of the beam allows the user to test if the accelerometer is functional. The typical change in output is −1.08 g (corresponding to −325 mV) in the X-axis, +1.08 g (or +325 mV) on the Y-axis, and +1.83 g (or +550 mV) on the Z-axis. This ST pin can be left open-circuit or connected to common (COM) in normal use. Never expose the ST pin to voltages greater than VS + 0.3 V. If this cannot be guaranteed due to the system design (for instance, if there are multiple supply voltages), then a low VF clamping diode between ST and VS is recommended.  

Vin - connect to Arduino board 5V (Adafruit module)

3Vo- for 3.3v microprocessors, connect the pin marked 3Vo to the 3.3v supply. For the best possible accuracy and precision, you can use the output of the accelerometer boards voltage regulator as the analog reference for the Arduino. Connect the 3Vo pin on the accelerometer board to the AREF pin on the Arduino. If you connect an external voltage reference to the AREF pin, you must set the analog reference to EXTERNAL before calling analogRead() (e.g. in your setup() function). Otherwise, you will short the internal reference with the external reference, possibly damaging your Arduino board. (Adafruit module)

V+ or Vs or Vss - Supply Voltage (1.8 V to 3.6 V).  At VS = 3.6 V, the output sensitivity is typically 360 mV/g. At VS = 2 V, the output sensitivity is typically 195 mV/g. 

VDD - power supply 3.3V

Com-Common (Ground)

Wiring

The ADXL335 outputs analog voltage values. Therefore, connect its pin X, Y, and Z to analog pins A1, A2, and A3 of the Arduino Uno board. Read the analog values of X, Y, and Z by programming, convert them into digital ones via the AD converter in the Arduino Uno board. With some calculation, you can get the acceleration at X, Y, and Z axes when moving the ADXL335.

You’ll also need to add a 10k-ohm resistor from ground to the momentary switch pin that connects to the Arduino board. That pull-down resistor connects the pin to ground when the switch is open, so it reads LOW when there is no voltage coming in through the switch.

The following picture shows the needed connections with the Arduino Uno 

Step by Step instruction

  1. Assembly the ADXL335 (GY-61) module. These accelerometer boards come with all surface-mount components pre-soldered. The included header strip can be soldered on for convenient use on a breadboard or with 0.1" connectors. However, for applications subject to extreme accelerations, shock or vibration, locking connectors or direct soldering plus strain relief is advised (Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down. Place the breakout board over the pins. Be sure to solder all pins for reliable electrical contact).
  2. Mount the ADXL335 (GY-61) module to a small breadboard. The back and squared edges of the breadboard make a reasonably accurate set of reference planes to orient the sensor for calibration.
  3. Do wiring.
  4. Open Arduino IDE.
  5. Plug your Adruino Uno board into your PC and select the correct board and com port
  6. Open up serial monitor and set your baud to 9600 baud
  7. Verify and upload the the calibration sketch to your Adruino Uno
  8. Open the Serial Monitor.
  9. Lay the breadboard with the sensor on a flat surface.
  10. Press and hold the button until you see "Calibrate" in the serial monitor.
  11. This will calibrate the minimum value for the Z axis.
  12. Stand the breadboard on the front edge and press the button again. to calibrate +y.
  13. Repeat this for the three other edges to calibrate +x, -y and -x.
  14. Turn the breadboard upside down and press the button again to calibrate +z. (Hint, the underside of a table works well to steady it.)
  15. Once calibrated, the output will show the calibrated raw range for each axis, followed by the measured "G" forces. The raw ranges can be used as constants in sketches: "Raw Ranges: X: 408-616, Y: 398-610, Z: 422-625 511, 511, 625 :: -0.01G, 0.07G, 1.00G"
  16. You can also check the example sketch. You can see the readings in Serial Monitor when upload it.

Summary

We have learnt how to connect ADXL335 to Arduino board, calibrate and use it.

Libraries:

  • No libraries required for this project

Sketch:

  • See attachment on the begining of this project description.


Other projects of Lex C
Easy Basics: Project 057a ACR122U NFC Reader of Lex C, Not selected 17-01-2018

Published at 15-09-2017
Viewed: 11167 times