The Best Little Delay Timer in Arduinoville

Introduction: The Best Little Delay Timer in Arduinoville

About: Old dog still learning new tricks.

Okay, so maybe the title is a bit of hyperbole but then “best” is always in the eye of the beholder. As a bit of background, I have done a whole bunch of projects using the PIC microcontroller and one of the features I really like is the built-in capability to do very long time delays while the processor is in low power sleep mode. The Atmel chips used for Arduino projects don’t support that capability so I went looking for a relatively painless method to accomplish that task.

At first I tried doing it without an external module or chip but that didn’t really cut it. I did online research of solutions like the LTC6994 and the TPL5110 delay timer chips but they are a bit pricey. Then I remembered that I had a few oddball delay timer modules in my junk box simply labeled as “C005”. They appear to have been originally made as plug-in modules for some unknown device and my guess is an appliance of some sort given the loose precision involved. Apparently there were a lot of these surplus or else someone just realized how useful they might be in other applications. In any case, you can buy them from Chinese sellers on eBay if you search for “delay trigger timing chip”.

If you’ve run across these modules before you already know that the available documentation is a bit sketchy and the meaning sometimes gets lost in the translation. Part of what I provide in this Instructable are clarified specs and usage information. I also provide some very useful specs and applications that you won’t find documented anywhere else. While this module may not be “best” for all delay applications, it does provide small size, low power consumption, low cost, and a range of delays from about 5 seconds to over 40 days.

Step 1: C005 Basics

The C005 module is pretty small at about ½ inch square. The power supply can run from 2 VDC to 5 VDC. The specified current capability of the output is 5ma when it is high and 30ma when it is low. The current consumption of the module is only about 1uA when it isn’t doing a time delay. The current consumption spec during the time delay period is listed as being less than 100uA but that is incomplete information. In reality, the current consumption is directly related to both the power supply voltage and the timing resistor value. I did some measurements and determined the following values:

10k resistor: 86uA at 2VDC; 185uA at 3VDC; 315uA at 4VDC; 440uA at 5VDC

100k resistor: 18uA at 2VDC; 34uA at 3VDC; 62uA at 4VDC; 100uA at 5VDC

1M resistor: 2uA at 2VDC; 8uA at 3VDC; 25uA at 4VDC; 52uA at 5VDC

Note that the current consumption goes down dramatically as the timing resistor value increases. The reason for that is discussed in a later paragraph.

The basic board connections can be seen in the diagram above. The single timing resistor gets soldered to the tabs on the top edge and the bottom edge has connections for power, the output, and the trigger input. The bottom tabs are spaced at a standard 0.1 inch so you can solder a pin header to make it easier to attach to a larger PC board. There is also a pair of small solder tabs on the side which allow for adding one or two postscalers to the timing function. The timing values (without the postscalers) are shown in the table above.

The P1 postscaler increases the timeout by x8 and the P2 postscaler increases the timeout by x64. If both are used then the total timeout is increased by x512. Just solder across the desired P1 and/or P2 pads to select the desired level of postscaling. The postscalers don’t require any extra current but the numbers shown above prove that using a larger resistor for a given delay will save power over the use of a smaller resistor with a postscaler to achieve the same delay.

There isn’t a schematic available for the circuitry inside of the black epoxy glob but basically it acts somewhat like a monostable version of the 555 timer. The timing resistor table shows the nominal delay times based on both the timing resistor and power supply voltage but it also has some mysterious frequencies associated with each entry. Those numbers provide a clue as to what is actually going on inside the module. Unlike the 555 which uses simple RC time constant circuitry, the C005 acts like a voltage controlled oscillator (VCO) with the timing resistor providing the feedback loop. The VCO frequency is divided down internally to provide the delay output. As can be seen in the oscilloscope pictures above, there is actually a detectable frequency on the timing resistor that roughly relates to the numbers in the timing table. The 10k resistor shows about 1.3 MHz and the 100k resistor shows about 275 kHz. As noted earlier, a larger timing resistor means lower power consumption. That’s a result of the reduction in the oscillating frequency - much like an ATtiny85 uses less power running at 1-MHz than it does when running at 8-MHz.

Like the 555, a low level/pulse on the trigger input starts the timer. The low level must be removed before the timer can be triggered again and the next trigger can’t happen until after the current delay has completed. The trigger input has an internal pull-up resistor so an external one may not be needed. I used a resistor to ground on the trigger pin to estimate that the pull-up resistor value is about 60k ohms. Unlike the 555, the C005 output is normally high and goes low during the timeout.

An interesting feature of the delay module is that the trigger input can be tied to ground if an immediate timeout is desired when power is applied to the module. The obvious disadvantage is that the module can’t be retriggered in this configuration. One method I found to achieve the immediate timeout and still allow retriggering is to connect a small capacitor between the trigger input and ground. The trigger will see a momentary low level until the capacitor charges and that causes the immediate timeout to occur. The trigger input can then be brought low at a later point (e.g.: with a momentary switch) to trigger another timeout. In my experiments I found that a value as low as 0.001uf worked. A higher value is more reliable because it provides a longer low level on the trigger pin but I don’t recommend anything greater than 0.1uf. If a semiconductor is used to retrigger the timer when a capacitor is connected then it’s best to add a 100 ohm resistor between the semiconductor and the capacitor to minimize the initial current surge when the capacitor discharges.

Step 2: Basic Applications

The first schematic above shows a standalone C005 module hookup. If the trigger pin is grounded through a momentary switch press then the LED will light during the delay timeout. As noted above, a small capacitor on the trigger input will cause the first delay timeout to happen at power up.

I found that it is possible to both automatically start and automatically retrigger the C005 by adding a small transistor and resistor to the output. That configuration is shown in the second schematic above. The output of the module is normally high which drives the transistor output low, thus triggering the module. The low output then turns off the transistor. When the delay finishes, the output goes back high, turns on the transistor, which then retriggers the module. The retriggering pulse is at a low level for only a few microseconds but that is sufficient for the module to run again.

When the timer module is used with an Arduino it can be used to periodically interrupt the processor. This is often a necessary application for battery operated projects where a short activity period may be followed by a long sleep period. For instance, periodically taking a sensor reading and transmitting the results to a base station. For this type of application there are two methods available for using the C005 delay timer. Both methods require an external interrupt input to wake the processor. If the self-starting and self-retriggering configuration of the C005 module is used, then no further pins are required. If, however, you want the processor to control the starting and retriggering, then a second pin is required for the trigger output pulse. The third schematic above shows a double throw switch to illustrate the difference in the connections. The switch itself is not actually needed - just wire the C005 trigger pin to the appropriate processor pin. The LED in the schematic is shown just to provide a visual indication for the provided software which toggles the LED on/off for each timer interrupt.

Step 3: Software

A simple software sketch is provided for interfacing an ATtiny85 to the C005. It can be easily modified for any Arduino or for other common Atmel chips like the ATtiny84 or the ATmega328. At power-up the processor is initialized and then put into a power down sleep mode while waiting for the delay timeout to finish. A define near the top of the software is used to determine if the processor will manually trigger and retrigger the C005. If the processor is in control of the C005, then it needs to send a trigger pulse prior to going to sleep. As noted in the previous section the basic function of the software is to toggle the LED on/off with each timer interrupt. This simulates control of an external device such as a sensor.

The hardware/software makes use of the INT0 external interrupt. The default configuration for this interrupt is to activate when a low level is seen on the input pin. That is what is needed for the timer hookup to function properly because edge triggered interrupts require that the I/O clock be running. The I/O clock is turned off in all sleep modes except IDLE.

When the timeout finishes, the processor wakes from sleep but it takes from 4ms to over 64ms to fully restart. That timing puts a requirement on the interrupt signal to still be at a low level following the wake-up cycle in order for the interrupt handler itself to be called. The C005 automatic retrigger configuration produces a trigger pulse of only a few microseconds so the interrupt handler is not called. Because the interrupt handler is not called it could actually be left out of the software.

The bulk of the main loop is performed with interrupts disabled so that section could be used as a de facto interrupt handler. Most applications probably won’t require that capability so a call to “do_something” following wakeup is shown immediately after the sleep command in the software. Upon completion of “do_something” the main loop starts over and puts the processor back to sleep.

Anything Goes Contest 2021

Participated in the
Anything Goes Contest 2021

Be the First to Share


    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • For the Home Contest

      For the Home Contest
    • Big and Small Contest

      Big and Small Contest



    1 year ago on Step 3

    Corrected the Arduino schematic