In order to detect when the MagicHat is picked up from the docking station, an accelerometer will be installed.

The accelerometer I will install is a quite old model, now out of production: the ADXL210. The reason for this choice is that it was the only available in my lab and I decided to use it even if it reminds me one the most disastrous project of my engineering life: a washing machine dynamic balancing device, which reveals to be a self-destroying device... I hope this project will be a bit more lucky than that one...

 

03 - ADXL Front.jpg

 

Back to technical topics, The ADXL210 is low cost complete 2-axis accelerometers with a measurement range of /±10 g. The ADXL210 can measure both dynamic acceleration (e.g., vibration) and static acceleration (e.g., gravity). The outputs are digital signals whose duty cycles (ratio of pulsewidth to period) are proportional to the acceleration in each of the 2 sensitive axes. These outputs may be measured directly with a microprocessor counter. However, in my case a voltage output is desired since I don't have other input capture timers available (I'm going to use the only input capture available on Arduino Yun for reading the temperature sensor). Fortunately, a voltage output proportional to acceleration is available from the XFILT and YFILT pins, or may be reconstructed by filtering the duty cycle outputs. I chose the first option, since with Arduino it's very easy to read an analog input

 

03 - Accelerometer.png

 

03 - ADXL Back.jpg

 

The board will be mounted so that the X axis measure is vertical

 

03 - Axis.png

03 - ADXL Axis.jpg

 

The output from accelerometer will read using the usual Arduino function analogRead and values will be averaged to filter out a bit of the analog noise.

The filtered values will be then analyzed to determine if the MagicHat is handles without any care for its...age!