Published: 11.05.2021 | Edited: 11.05.2021 | Tags: 100daystooffload,arduino
Wakeup Pro Micro 3.3V with DS3132 module
After a previous few days of struggling to get the Arduino Pro Micro 3.3V version to get to sleep and wakeup I've finally had an epiphany and got the desired result to surface up. It was made possible by the massive amount of documented work I have finally stumbled upon. Links are at the end of the post, as always. They also prove that I am not the only one trying to build the battery powered data logging devices. Also, both my academic theses were related to power management and data logging, albeit years ago. They are public in the git section if anyone is interested.
The connection table and a neat Frtzing visualization of the connection can be seen below:
|Pro Micro pin||DS3132 module pin|
The setup phase starts with driving the pin D4 high, powering the DS3132 chip. This starts its internal TXO oscillator if not started already and sets the time and date. Then it enables the Alarm 1 (seconds resolution) to provide the interrupt on the SQW/INT in on the module, which is connected to the D7. D7 is in turn the only non-communication pin on ATmega32u4 that has the external interrupt, as discussed in the post I made yesterday.
The loop part then again powers the DS3132 Real-Time Clock (RTC) chip via D4, sets an alarm by
secondsTillNextWakup seconds in the future and proceeds by powering the Micro down to conserve as much power as possible. When the alarm is reached, the interrupt is generated, waking up the Micro again, which in turn configures another alarm more into the future and gets back to sleep. The cycle repeats.
There are a few points to consider still:
- I have to make actual measurements of the consumed current and do some more evaluation under the oscilloscope. I'll do that as soon as I am back in the lab.
- The resistor network RP1 on the DS3132 module was removed due to possibility of leakage current through the pullup it provides for SDA ans SCL lines. The
Wirelibrary appears to be enabling Micro's internall pullups for I2C communicaiton anyway, but they are probably an order of magnitude weaker than recommended (50k vs 5k). It appears to be working anyway, despite the warnings. There are some suggestions this modification might not even be needed for the 3.3V boards.
- The I2C on DS3132 appears to be working even without driving the VCC pin high via D4 after RTC is already running on the backup battery power. This probably needs some further investigation. The datasheet says the I2C can be running of the battery as well and would want to understand the ways the current consumption can be optimized, since I have invested time and effort in this topic already.
This is a 62th post of #100daystooffload.