Tilt sensor (Part 2)
Prior to writting any code, we must care about the interface to the Arduino Board. The output from the ADXL335 accelerometer depends on the strength of the acceleration force and may vary in a linear way between 0 and VSS. The mid point (VSS/2) corresponds to a “no force” condition. By default, Arduino analog to digital converters (adc) will convert signals ranging from 0 to 5 V in 1024 steps. If we keep this option, we will never use the 3 to 5 Volt range, which is sad. The idea now is to adjust the level of the output to make it compatible with the 0 to 1.1 V measuring range from the adc when they are set in INTERNAL mode. Looking carefully at the diagram one will notice that the output is buffered and sent out of the chip through a 32 KOhms resistor.
Simply adding a 15 KOhm resistor between the output and ground will create a divider bridge so that the output voltage is now compatible with the 0 to 1.1 V range!
Warning !The ADXL335 must be fed with VSS
Most of the hardwork is done, next step will describe the minimal code for reading adc values and converting them in usable information.