Accelerometer Sensor
An accelerometer is an electromechanical device used to measure acceleration forces. Such forces may be static, like the continuous force of gravity or, as is the case with many mobile devices, dynamic to sense movement or vibrations.
Working Principle:
Some accelerometers use the piezoelectric effect – they contain microscopic crystal structures that get stressed by accelerative forces, which causes a voltage to be generated

Type of sensors
1.ADXL345
2.ADXL355
ADXL345 interfaces with I2c protocol with 8/16/32 bit microcontrollers
ADXL355 interfaces with SPI protocol with 8/16/32 bit microcontrollers
Technical specifications:
Low power: 350μA (typical) Single-supply operation: 1.8 V to 3.6 V
Link to datasheet:
https://www.sparkfun.com/datasheets/Components/SMD/adxl335.pdf
Advantages:
Excellent, fast and response with 8-bit microcontrollers.
Disadvantages:
It has limited long term stability.
It is sensitive to dewing and certain aggressive substances.
Schematics with controller


SPI Protocol
Internal circuitry:

Interfacing With Arduino

Arduino Code:
/connect 3.3v to AREF
const int ap1 = A5;
const int ap2 = A4;
const int ap3 = A3;
int sv1 = 0;
int ov1 = 0;
int sv2 = 0;
int ov2= 0;
int sv3 = 0;
int ov3= 0;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
analogReference(EXTERNAL); //connect 3.3v to AREF
// read the analog in value:
sv1 = analogRead(ap1);
// map it to the range of the analog out:
ov1 = map(sv1, 0, 1023, 0, 255);
// change the analog out value:
delay(2);
//
sv2 = analogRead(ap2);
ov2 = map(sv2, 0, 1023, 0, 255);
//
delay(2);
//
sv3 = analogRead(ap3);
ov3 = map(sv3, 0, 1023, 0, 255);
// print the results to the serial monitor:
Serial.print(“Xsensor1 = ” );
Serial.print(sv1);
Serial.print(“\t output1 = “);
Serial.println(ov1);
Serial.print(“Ysensor2 = ” );
Serial.print(sv2);
Serial.print(“\t output2 = “);
Serial.println(ov2);
Serial.print(“Zsensor3 = ” );
Serial.print(sv3);
Serial.print(“\t output3 = “);
Serial.println(ov3);
delay(3000);
}
Applications:
1.Inertial measurement of velocity and position.
2.vibrations and shock measurement.
3.Measurement of gravity to determine orientation.
Referral Links:
http://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-an-arduino/
https://www.livescience.com/40102-accelerometers.html
https://en.wikipedia.org/wiki/Accelerometer
https://learn.sparkfun.com/tutorials/accelerometer-basics/all