It has been a while since my last post (that was last year), but now I have pictures to show you of the new and much improved Gyro’clock. The key reason for the success this time around is using the transient detection function of the MMA8452Q. This is an embedded function of the accelerometer, which can be programmed to detect a change in accelerometer readings that exceeds a given threshold. That means the microcontroller does not need to constantly poll acceleration data. Instead it can let the accelerometer figure out when the threshold value is exceeded, and wait for it to send a signal. This improves accuracy significantly and saves a load off of the microcontroller.
I have also made a few modifications to the circuitry, mainly to reduce current consumption:
- Added a bi-directional I2C level shifter to protect the MMA8452Q from the output voltage of ATmega328p, which can go above the maximum 3.6 V on a full charge of battery.
- Added a 32.768 kHz crystal to improve clock accuracy. ATmega328p has a built in real time clock module (RTC), which uses this crystal as an asynchronous clock source. This also means that now I can put the microcontroller to sleep without losing time. Saves power!
The MMA8452Q accelerometer now has power only during the display mode and time set mode. The accel is disabled during idle mode bringing current consumption down from 2.2 mA to just 115 uA. At this rate, with a full charge of battery it will last for almost 40 days! (under testing)
I have also made major changes to the code. But that has to be the subject of another post. There is still a bit more work to be done with the Gyro’clock. To reduce current consumption further, I want to make it go to sleep in between displaying the image. This is a bit tricky because waking up from an external interrupt seems to also trigger the timer overflow interrupt making the clock inaccurate. In the meantime here’s a video with the Gyro’clock in action: