Posts Tagged ‘Accelerometer’

Tilt Sensor (Part 8)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 We have now covered most of the required functions to build a state of the art tiltmeter. Some additional general purpose libraries are necessary to build a stand alone device: PlainLCD (LCD driver), PlainENC (Encoder dirver) in addition to the standard math and EEPROM libraries. Please check this page if you are interested in […]

Tilt Sensor (Part 7)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 Calibrating the accelerometer on each boot may be boring! It might be a good idea to store the calibration parameters in some non-volatile memory space so that we could call them back on boot. The ATMEGA has a built in EEPROM memory space which will be perfect for this use. First of all, we […]

Tilt Sensor (Part 6)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 Unless you plan to use the tilt sensor for detecting 90° tilt angles (e.g. dice position), you must calibrate the sensor prior to running accurate tilt angle measurements. There a many ways of achieving this task. The described method is pretty simple and gives very good results. Under these calibration conditions, starting at 0:0 […]

Tilt Sensor (Part 5)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 Once offsets have been subtracted from the raw data, it is time to convert them into scaled data (Gs actually) by applying the sensitivity convertion factor for each axis. Alike offsets, sensistivity factor can be taken straight from the data sheets (300 mV/G), or pre calculated in a calibration routine. /* Compute acceleration in […]

Tilt sensor (Part 4)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 Let’s for coding now. Firstly we need to set the analog reference to Internal as follows analogReference(INTERNAL); and build a simple acquiring / converting routine double analogReadMv(uint8_t channel) { double analogValue = 0; for (uint8_t _sample = 0; _sample < _samples; _sample++) { analogValue += analogRead(vAdcPin[channel]); /* Sum measurements */ } analogValue /= _samples; […]

Tilt Sensor (Part 3)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 It is possible to run the accelerometer “out of the box”, but the results will be difficult to use without some adjustments and interpretation. Here is a flow diagram of how the accelerometer can be used as a tilt sensor, or, in other words, how to convert the chip position versus gravitational force in […]

Tilt sensor (Part 2)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 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 […]

Tilt sensor (Part 1)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 Accelerometers are among the sensors that have experienced the greatest development in the ten past years. From automotive to gaming applications not talking about phones, they are included in many equipements. As a consequence of this massive use, their price is falling down to acceptable prices for the hobbyst! The choice of an accelerometer […]