Sweech is for switching on systems to perform certain tasks at specific time in a day, week, month or year. It performs this incredible task while ensuring the whole system remains completely off during this downtime. It helps to use very little power to control much larger power in electronic systems. It is a much flexible and efficient way of powersaving than deep sleeping of MCUs since all peripheral are off most times.
Sweech is a very simple system. It uses the DS3231 for it's incredibly useful Alarm feature and extremely low power for to keeping. Sweech is basically the combination of the DS3231 and a soft switch / latch.
The device can be communicated with using I2C. This is used for setting certain parameters such as time and alarms for the system to switch on. The whole setup runs on a coin cell. This serves as the primary source of power for Sweech during it's downtime. The output of the board is a 5V(1A) and 3.3V(1A) pin for powering the external system. The board also contains a Vout terminal for much larger voltage(up to 30V/4A).
The plan is to make a generic board that serves most use case. Another interesting upgrade is a version of the board that charges the battery while also taking care of the alarm feature.
Design Decision
The primary schematic is as shown below and might undergo certain changes in the future.
I intend to use the interesting AP2114-3.3 instead of the shown AMS1117. Both have the same footprint and is a drop-in substitute (Thanks to @Arsenijs for the great help).
The concept of the system is as simple as it seems. The INT pin of the DS3231 is open drain and is pulled up externally to the battery input (labelled VCCQ). The RTC chip pulls down the pin during an Alarm and will remain low until the Alarm bit is cleared by the host MCU by I2C. The gate of PFET Q2 is connected to the pin to ensure that it is controlled by the Alarm.
As seen in the schematic, there is a simple latch implemented in the schematic. This is for when users wish to switch on the system at times when it's not during an alarm. This implementation is simply a NFET Q2 and a push button to pull down the gate of Q2 after which the host MCU holds the state of Q1 by asserting the hold pin (also exposed via headers).
The PCB layout was made and I as shown below.
BTW, Kicad is awesome.
The final rendering of the device is shown below. Notice the absence of the 3d model of the terminal block. I am working on fixing that.
I will work on a version that includes a battery charger and (possibly) a boost converter. Maybe one in Arduino and Adafruit Feather form factor will be made. Watch out on this medium for more info.
If anyone has any questions or observation that will help with this project, comment below or message me.
I will also post quite a number of things on my Twitter feed (@HW_Kage).
How do you prevent current from flowing from the coin cell, though the i2c pull-ups, and into the protection diodes of the host pins these are connected to? Depending on the host MCU, this can quickly drain the coin cell when the output is powered down.
This is hard to fix. One way might be to add low leakage buffer transistors on the i2c lines where they go to the host MCU IO pins. These gates of transistors could be connected to the ~INT pin so no current could flow out these lines when the host is powered down. You would then also need a way to keep these gates from floating since ~INT is open collector and VCCQ could potentially be lower than the threshold of these new buffer transistors.
Maybe better to add buffer transistors on the i2c lines where the gates are connected to the MCU pins, and these lines are pulled low by external resistors connected to the DS3231's ground net? Then for the MCU to make an i2c line go low, it would switch to output mode and drive the pin high. This would requrie inverting the normal i2c signals, but some MCU have this ability built in, and others could just use an inverted bitbanged i2c implementation.
Is there a better way to make sure there is no leakage though the i2c lines when the host is powered off?