Implementing sleep modes

A project log for Pulse to Tone Converter

Converts pulse dialing of your POTS telephone to DTMF dialing allowing you to use it with your VOIP's FXS-port.

Christoph TackChristoph Tack 02/06/2018 at 19:500 Comments

The nature of pulse dialing is such, that every pulse interrupts the power supply for 70ms.  The pulse rate is 10pps, which means that during dialing, the MCU only gets power 30ms every 100ms.  During the 70ms power gaps, the MCU has to survive on a 470µF capacitor.

Using sleep modes would allow us to choose a smaller supply voltage to reduce power consumption and to leave more headroom for the pulse dial telephone.  Another option would be to decrease the elco and save cost.

Adding Sleep functionality in main loop

The rotary dial functionality is using Thomas Fredericks's Bounce2 library.  To function properly it requires an update() function to be called regularly.  By adding the update() function in the loop() function of Arduino, it's called every few tens of microseconds.  No mechanical switch is that fast, so a lot of MCU cycles are wasted there.  The following oscilloscope screenshots show VCC (green) and the GPIO connected to the main power entry point before the rectifying diode (blue).

MCU remains in ACTIVE mode, VCC drops down to 3.08V
MCU remains in ACTIVE mode, VCC drops down to 3.08V

The solution lies in adding a sleepNow() functionality in the main loop, which forces the MCU into idle mode when there's nothing to do.  In idle mode, interrupts still wake the MCU.  

Timer0 interrupt is in Arduino standard set up to be called every ms.  So each ms, timer0 fires, which wakes the MCU.  The MCU calls the Bounce2.update() and goes to sleep again.  Simple but effective.

MCU using IDLE mode, VCC drops only downto 3.57V
MCU using IDLE mode, VCC drops only downto 3.57V