Store it Quickly 2.0 Schematic Circuit Diagram
Importance of Instant EEPROM Storage in Microcontroller Applications
Certain microcontroller applications demand immediate storage of critical information, ensuring it’s saved to EEPROM the moment power to the equipment is either turned off or fails. Upon power restoration, this store data becomes readily available for necessary operations. Addressing this requirement, Rainer Reusch devised a circuit (depicted in Figure 1) that was featured in Elektor magazine as a Design Tip.
Ingenious Circuit Design for Immediate Data Storage
The fundamental concept behind this innovative circuit lies in the voltage dynamics at the anode of D1, which drops faster than the voltage across the reservoir capacitor C2. A comparator assesses these voltage levels and generates a signal for the microcontroller, indicating the swift decline in input voltage. Thanks to the configuration involving D1 and the voltage at the non-inverting input of IC1.A from C2, the voltage falls faster than the one at the inverting input. Consequently, this causes a Low level at the comparator output, initiating an interrupt.
Ensuring Timely Data Preservation
With adequate energy stored in the reservoir capacitor, the microcontroller gains valuable time to efficiently store all essential data to EEPROM before the supply rail voltage depletes to critical levels. This clever solution guarantees the preservation of crucial information even in the face of abrupt power interruptions or failures.
Enhancements and Challenges in the Original Circuit
In straightforward scenarios, the circuit operates effectively. However, a notable issue arises during EEPROM data writing, a process that takes a few milliseconds. Consequently, the capacitance value of C2 must exceed strict requirements, serving as both a data reservoir and regulator power source during voltage drops. Calculating C1 for ripple voltage proves challenging. Additionally, complications arise when the power source is a wall wart adapter with built-in voltage regulation or a switch-mode supply. In such instances, the circuit falters because the input voltage doesn’t drop rapidly enough due to integrated capacitors in the adapter. These limitations prompted the author to refine the original design, resulting in the improved and simplified Figure 2 solution.
Revamped Circuit Design for Stability
In the updated design, the comparator is relocated after the voltage regulator. This alteration involves comparing the input voltage with the regulator’s output voltage. The diode in series with the voltage regulator becomes unnecessary. Consequently, the reservoir capacitor C1 can be smaller. The most significant enhancement lies in the circuit’s independence from the speed of input voltage decline. When the power adapter’s voltage drops, the regulator output remains stable due to regulatory mechanisms. Properly dimensioned, the voltage divider at the comparator’s non-inverting input generates a lower input voltage than the inverting input, triggering a low output for a microcomputer interrupt.
Optimized Circuit Parameters
The circuit parameters are computed assuming a 9 V output from the mains adapter and a voltage regulator generating 5 V. D1 safeguards the regulator from reverse current flow. With C1 set at 100 µF and a load current of 5 mA, the microcontroller has a minimum of 17 ms to store data in EEPROM. This setup employs an edge-triggered interrupt. Additional time for data storage can be gained by disabling power-intensive microcontroller features like A/D converters.