Arduino Controlled Versatile Timer/controller




About: I am an electronics engineer and electronics is my first love. I have been dismantling all sorts of gadgets right from my childhood just to know "How that thing works ? " and got scolding so many ...

This is a nice and simple versatile on/off timer built around atmel microcontroller Atmega 328 chip.
As the name suggests, it is very versatile timer with N number of applications you can think of.
It can be used to,

  • Switching lights in your house on and off (to deter thieves) when you are away
  • Controlling your garden lights,
    Switching your Air Conditioning on and off Or Room heater On/Off
    It can also be used to control the temperature of electric ovens, irons, barbeque or even your soldering iron...
    I am using it to control my humidifier in the room and the barbeque temperature in the garden.

This circuit does not contain any temperature sensor but still it does the work of maintaining a fairly constant temperature of electrically operated heaters/coolers by switching them on and off at regular intervals which is of course programmable by the individual user.
Once the system is on and programmed and started.. it continuously shows the time remaining (in seconds) in current mode, updated every second.

Max Delay : 12 Hours
Min Delay : 1 second

The timer operates in 3 modes
1) INITIAL -- This is the time for which the relay will be in ON state when you run the timer first time.
2) OFF -- This is the time for which the relay will be in OFF state.
3) ON -- This is the time for which the relay will be in ON state

so the relay always cycles as following sequence

INITIAL --> OFF --> ON --> OFF --> ON --> OFF --> ON --> . . . . . Indefinitely

Are you thinking where is this INITIAL mode useful??
In case of using it for Barbeque ..
When you switch the barbeque grill on.. it does not heat up immediately.. Mine takes around 4 minutes to heat up to full. so I set INITAL to 4 minutes and OFF to 40 Sec ad ON to 15 Sec to get a controlled heat..

PROS: There are no up and down and Plus and Minus buttons as I have tried to keep it very simple to operate. There is only one white knob(Rotary Encoder) on the top of the instrument which does the all work for me.

CONS: I don't see any.. you tell me ;) I am all ears...

What will you need ?

Here you go...

A)The list of the materials/tools needed is as follows:
wooden sheets 2mm thick 12x12 inches -- 2 numbers, Hack saw blade, a ruler, Drilling machine with 3mm , 5mm bits, a pencil, eraser, sand papers (one fine and one medium grit), P.C.B., 25w soldering iron, soldering wire, wire cutter, a plyer, glue, glue stick and gun

B) Components needed for making PCB:
A copper clad, Ferric chloride powder, PCB drill with drill bits 0.8mm and 1mm, a glossy photo paper, monochrome laser printer, a pair of hand gloves, soap water, scrubber

C) Electronic components needed for making circuit:
IC Atmega 328p - 1 no
IC LM7805 - 1 no
Ic Base 28pin - 1 no
Diodes 1N4001 - 3 nos
Resistors 10k, 2.2k all quarter watt - 1 each
Capacitors 1000/35v, 1000/25v - 1 no
Ceramic disk capacitor 22pf - 2 no
Ceramic disk 0.1uf - 1 no
Crystal 16MHz -1no
Rotary Encoder (with integrated push switch) - 1 no
5pin PCB connector male & female - 1 no
40 pin break-away header(Male) - 1 no
Solid state relay rated@ 240VAC 20Amps - 1no
16x2 LCD display module(Oriole) - 1no
Transformer 9-0-9/500mA - 1no
Copper clad (approx. 4x2 inches) - 1 no

Step 1: PCB Layout

Making PCB for the circuit is the first step. I am not going to teach you here about how to make a PCB as you must be knowing it. The PCB layout is attached in the file timer.pcb which is designed using Express PCB software.
Just print the PCB layout on any glossy photo paper using a monochrome laser printer and transfer the layout on to the copper clad using the old trick of hot Iron(used for pressing clothes) and then etch the PCB using Ferric Chloride solution and you are done.

Step 2: Mounting Components on the Board

Now solder the components on the PCB . The completed circuit looks like Figure 3
except Atmega IC.. as it needs to be programmed

Step 3: Programming Your Arduino

Connect your arduino board to the computer , load the attached program into the microcontroller using Arduino IDE 1.6

Step 4: Device Assembly

After uploading the program into the microcontroller, take out the IC and put it into the IC base of the PCB shown aside. Fit the LCD using the break away header pins as shown in the photo. Notice the angle in which pins are bent for the proper fitting of LCD board over the one we made.
Assemble the complete circuit and test it by powering it ON.

Step 5: Fitting LCD in Case

The photos aside shows.. how to fit the LCD in front panel of the box.
I recommend to not to glue it to the box.
The rectangular slot cut in the wooden sheet should be so perfect that the LCD fits very tightly in it.

Step 6: Box Making

Cut the wooden sheets as per your requirement of size of the box.
I have made the box of size wxdxh , 11x12x8 Cms
Keep some holes in the box for heat dissipation due to SSR and transformer.

Step 7: Electrical Connections Inside Box

See how the complete circuit is fitted inside the box with all the electrical connections secured tightly.

Step 8: Ready to Go...

The wooden box is finally brushed thoroughly using a very fine sand paper and then coated with clear varnish spray to give it a good look.
Now the device ready for the operation...

Step 9: Stay Tuned..

Watch this video for detailed operation.... Thanks

Microcontroller Contest 2017

Runner Up in the
Microcontroller Contest 2017



  • Backyard Contest

    Backyard Contest
  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest
  • Frozen Treats Challenge

    Frozen Treats Challenge

22 Discussions


Question 10 months ago on Step 9

you should code it so that its an actual timer


1 year ago

please share exact schematic dia. and pinout connection of input , outputs


1 year ago

when you document elektric were all input/output come etc, arduino uno board, encoder A and B input, relay output, lcd need change i2c lcd if use real good.

were buttond pins come ?

not good documentation you schematic all connection, on to arduino board first need. then adding own pcb and uh,newbie make instructable not good reaad.

1 reply

Reply 1 year ago

Point noted dear...

I hope my next instructable would not disappoint you..


2 years ago

You did not mention but perhaps the 3 legged chip (that looks like transistor) is a voltage regulator of kind.

You got misspelled "Rotory Encoder" perhaps RotAry Encoder.

However perhaps using potentiometer could be much simpler - because Arduino has analog inputs.

Also for having exact time intervals you could use RTC clock module - also that module ca give the timer exact time in the date to tun on - like 17:50 (5:50 PM) .

You could mention that the SSR might be overkill for some projects - if the grid is 220Volts then it is 220*20=4400Wats that is more then a oven in full power - all hotplates and all the heaters in the oven - if 110V then 2200Wats like some powerful hotplates - I would probably use it to switch a blue/red lamp for plant grow which is most of 10-100Wats. However the price of SSRs are drastically low for 1-5Ampers - like 2 dollars or so.

Good job thou. It is not for baginner in Arduino.

3 replies

Reply 1 year ago

Hey, bikerdude,

Before you go cappin' on someone else, maybe you should check your Own self. It's Watts, not Wats. It's a good job though, not thou. It's beginner, not baginner. And, I'm just sayin', your grammer is atrocious.


Reply 2 years ago

Hi dear, Thanks for pointing out the typos.. I will correct those.

I missed out the regulator IC LM7805 added.

Well, potentiometer instead rotary encoder- Nope. It just complicates the design more.. The timer has 3 modes and 9 settings total Initial (Hr, Min and Sec), On(Hr, Min and Sec), and Off(Hr, Min and Sec). and this goes in succession on each press on encoder. So now imagine I am using pot instead of encoder.. Pot can turn to max may be 290 degrees and then it freezes. Consider I have set Initial timer as 0, 0 and 45 Secs. Now for going to next mode I will require one more button to press, even after that I have left the pot somewhere halfway rotated already so now it reaches the next mode i.e. ON time Hour set up. It will not display "0" I would need to rotate it back to starting position to make it read "0" Is it user friendly? I don't think so. Thus encoder adds lots of simplicity here.

Power consumption? it is not a killer... I did not understand your calculation of 220*20 one..Why do you multiply that? what is 20 ? is it Amps ? to get power wastage?? then I am afraid your formula doesn't seem right to me.
SSR uses optocouplers and a zero crossing detectors inside. So basically it requires very low voltage and current to trigger it. maybe in Microamperes..
and furthermore High wattage SSR allows me to use this device to control big current eater monsters like Barbeque grills and room heaters or Air conditioners without any problems.
My main motto here is to reduce current consumption of this device to few mA.
I am going to modify this device later to make it work on a battery backup(Lipo) so when the power is interrupted when it is running... it does not loose the settings..
But anyways... thanks for your reply. cheers..


Reply 2 years ago

So you are using rotary encoder that has an integrated switch - I have none of those and I expected that there is no such encoders.
Sorry about that.
The power formula is Voltage of the grid (i.e. 220V or 110V) * (The current SSR switches) 20A = Wattage of the consumer that can be safely switched on and off.
That is why I pointed it is a overkill for some applications - like switching a LED lamps or activating motors or so...
Thanks for the instructable.


2 years ago

I like to put the controller up in the ceiling to control the exhaust fan. In case of power failure, I have to climb up to the ceiling to reset the controller. Is it possible to save the setting so that the unit start with the same setting every time in case of power failure ?

2 replies

Reply 2 years ago

Hi there..
There are two ways to achieve what you need.

A) Install a battery backup (lipo) with a charger module so that when the power goes out it not just retain your settings but it keeps on running the cycle as programmed.
B) This is easier method which does not need any additional hardware.
You can modify the code and make it work as follows
After switching ON the power to this timer, if there is no attempt made to program it for (say ..2 minutes for e.g.) it should enter the DEFAULT mode where the code will automatically take the defaulted ON and OFF periods and start automatically.

does that solve your problem?


Reply 2 years ago

Hi Temp512 ..
See my another instructable.. "Garden sprinkler controller"

The thing which you needed is added in this program..



2 years ago

That's neat :) We should make one for our humidifier!

4 replies

Reply 2 years ago

Nice, I did a similar project as a part-time alarm clock as I work 3 days a week.


Reply 2 years ago

Hmm.. intetesting TinyT2.. I would love to see your project..send me the link please


2 years ago

Very nice work. There is only one tiny snafu: your LED screen still reads "SYSTEM ON" when it's in the OFF state.

1 reply

Reply 2 years ago

Slight confusion... but that is obvious..
It actually does not show the current state of the connected appliance..
It just means that the "system" meaning the controller is functional now i.e. "on" and it is cycling through on and off as per the program...
I did not put any LED to show the on and off state as I wanted the apparatus to consume as low power as possible.
If you noticed.. I have also taken care that the backlight of LCD is also switched off once it is programmed and started running..
But I liked your observation.. :)


2 years ago

Nice project.

Suggestion: Expand it to produce a full-fledged chess clock.

1 reply

Reply 2 years ago

Thanks dear.. I will consider your suggestion