Digital timer switches are used to control the operation of electrical devices based on a programmed schedule. This project describes a programmable digital timer based on a PIC16F628A microcontroller that can be programmed to schedule the on and off operation of an electrical appliance. The appliance is controlled through a relay switch. This timer switch allows you to set both on and off time. That means, you can program when do you want to turn the device on and for how long you want it to be remained on. The maximum time interval that you can set for on and off operation is 99 hours and 59 minutes. The project uses a 16×2 character LCD with 4 push buttons to interact with the user.
Circuit Design
The circuit diagram of this project is shown below. A 5 V relay is driven by a PN2222 transistor that is controlled by RB3 pin of PIC16F628A. Digital inputs from the 4 push buttons are read through port pins RA2, RA3, RA4, and RB0. The functions of these push buttons are discussed in the operation section below. A standard 16×2 character LCD is used in the project to display the the device status, program menu and time. The LCD is operated in 4-bit mode, therefore, only 6 I/O pins of PIC16F628A are required to drive it. A piezoelectric buzzer provides audible tone when the timer is started and stopped. It also beeps when the device is turned on or off. The + 5V power supply for the circuit is derived from a LM7805 regulator IC. The input to the regulator is given from a 9V DC wall adapter.

In the circuit diagram, the pins 15 and 16 of the LCD are shown open. These pins are available only in those LCDs that have a back light illumination LED. The pins 15 and 16 are the anode and the cathode of the LED. If your LCD has the back light LED, you can connect these pins to the power supply terminals with a 39 Ω resistor in series. The backlight LED enhances the readability of the LCD display in low illumination condition.
The complete circuit soldered on a general purpose prototyping circuit board is shown below.
Operation of the timer
The timer gets inputs from the 4 push buttons. Their functions are described as follows:
- ON/OFF TIME : This timer device allows you to set both on and off time. When the timer is initially powered on, the device is in off condition and both on and off times are 0. Pressing this button, you can switch between the on and off time on the display.
- SELECT : This allows you to select between the on and off time settings as well as hour and minute digits. The selected digit is incremented by pressing the ON/OFF TIME button.
- ENTER : When the appropriate hour and minutes are selected, pressing ENTER finalize the corresponding on or off time.
- START/STOP is to start or stop the timer. If the timer is already on, you can stop it at anytime during its operation by pressing this button.
Now lets see how it works. Suppose, the device connected to the relay switch is needed to be turned on after 2 minutes. Further, once it is turned on, it is required to be on for next 20 minutes. In this case, the off time is 00:02 and the on time is 00:20, in hh:mm format. Once the timer is started, the device will be turned on after 2 minutes and remained on for 20 minutes. After that it will be turned off again. The following video shows how to do this.
Software
The firmware is developed using the MikroC Pro for PIC compiler.
Download the Source Code
Update (04/12/2013)
Mark Weir from Australia sent us his revision of our Programmable digital timer switch project. He modified the original code, which was written for PIC16F628A, to incorporate it with PIC18F4620 microcontroller, while hardware and overall functionality remain the same.
Here is a link to download his modified version of the firmware written in MikroC compiler.
Related Posts | |














[...] Programmable Timer Switch – [Link] Tags: PIC16F628A, Timer Filed in Mcu | 1 views No Comments [...]
Dear sir,
program does not work .
please help me
thanks
Would you please give more details about what you are experiencing? Do you see anything on the LCD screen when you power the circuit? Are you using exactly the same circuit or what?
Dear sir
I made the circuit , but the hex program does not work .
Please be kind enough to show me to the correct hex file.
reguards!!!
I am using exactly the same circuit shown on your pweb page. when the circuit is switch on LCD screen some letters are displayed. ams when the 3 switch are pushed it start to show more lettrs.
PICsimulator also shows the same as my circuit.
I have updated the HEX file, please see if it works.
Thanks.
Dear Sir,
New Hex file works!!!
thank you very much.
If you are interested I will be happy to give you my program of a 12/24 clock based on pic16f84/628.
hope to see more of your projects in the future.
reguards !!!
hi, I’m new for PIC. Firstly, I really want to know the source code for this project for more understanding. I’m very appreciate if you could give the source code. Thanks very much!!!
Dear sir, you could send to me by email: mt_bar@yahoo.com. On more time, thanks!!
Hi,
I tried to simulate your schematic and it’s working but not the buzzer..it never buzz..:P
anyway can you modify the code so that it will cycle again and again based on ON/OFF setting?
for example…i will set the ON time in 5 minutes and the OFF time in 10 minutes..so it will turn ON for 5 minutes OFF in 10 then ON again for 5 minutes then OFF for 10 and so on…
Regards
Rhonn
I will post the source code here soon. And you guys can modify the way you want.
Thanks.
sir i very much appreciate your blog about digital timer switch.. may i know what are the materials and equipment to be use in creating this project.. I’m also new in PIC programming and embedded systems.. that’s why your guidance will be great help to me. please send to my email the list of material and equipment and their specs.. my email ekahbelista@yahoo.com.. Thank you so much sir..
All the things that are required in the project are shown in the circuit diagram. Besides, you need a PIC programmer to load the firmware into the PIC16F628A microcontroller.
hi,
If you can modify the firmware so that it will cycle based on ON/OFF setting instead of returning to standby will be highly appreciated..
TIA
pic 16f628a
SIR I WANT THE ORIGINAL SOURCE CODE SO THAT I CAN MAKE CHANGES PLXX SEND ME AS SOON AS POSSIBLE I WILL BE THANK FULL TO U …!!!
SIR MA ID IS ali_meraj123@hotmail.com
sir awaiting for ur reply
Hi,
Any news about this project??
Sorry, I was on vacation so could not post the source code earlier. It is available now. You can now modify as per your requirements. Have fun!
thanx very much sir for the source code.
Thanks for uploading the CODE…
BR…
Dr sir, Thanks a lot for publishing the excellent timer project and it is working fine with me. Dr.Rajasekhar. Nellore. India
Haii… i am new with PIC, can this project used to control more than 1 relay and the relay ON or OFF based on real time?
This project is specifically designed for controlling just 1 relay. But the technique can be extended to control multiple relays. If you are looking for a timer switch with a built-in digital clock, it does not fulfill your requirement. Since the source code is available for free, you can modify it (at your own risk) whatever way you want.
Dear sir,
I shall be thankful if you lindly
provide me the the source code in assembly (asm file ).
Thanking you.
Dr sir, as I said earlier the PIC timer is working fine. If last programmed timing can stored in the pic, one can use the same timing just by pressing Start/ Stop button. If it is possible please do necessary modification in the program and make available the source code in your web site. Dr.Rajasekhar VU2HMY. Nellore India
sir,
i am interested in this project and seen the source code attached with this but there is no header file attached with in the program also function declaration for Lcd_Cmd , Lcd_Out have not been done in the program …
please help me out…
LCD routines are included in MikroC compiler. Please read Getting ready for the first lab and Lab 1: Flashing an LED with the MikroC user’s manual for further detail on programming in MikroC.
@ J.K.Sharma :
dear the code in assembly could be easily obtained by the following program- mikroC PRO for PIC
download the software and the convert the c code into assembly code easily…
@admin – is there any process to convert the asm file into .c file ?
Gaurav,
I am not aware of any such program that converts asm in to C. Thank you.
[...] Now lets see how it works. Assume that the device connected to the relay switch is required to be turned on after 2 minutes. In addition, once activated, it must be the next 20 minutes. In this case, off time is 00: 02 and the time is 00: 20, in the format HH: mm once that the timer is started, the device will be activated after 2 minutes and stayed on during 20 minutes. After that it will be deactivated again. This video shows how to do this. original article: Programmable digital timer switch using a PIC Microcontroller :Embedded Lab. [...]
fantastic circuit.
unfortuneately im stuck, it shows 2, 22uf capacitors on the schematic but not on the layout. and also it shows 1 transistor on the schematic,
and 2 on the layout. no crystal in the layout, plus what diodes are they i presume the small one is 1n4148.
any help or information would be greatly appreciated.
thank you andrew—-
Andrew,
22 uF was a typo, it is actually 22 pF. You will not see the crystal and caps on my board as I have used a 4.0 MHz resonator with/Cap, but I suggested to use crystal because it is more accurate. There is an additional transistor on my board because I didn’t have a piezo buzzer and so replaced it with a small coil speaker. But I recommended a piezo buzzer on my article because it can be driven directly through the microcontroller pin. The diodes are general purpose ones, you can use 1N4148.
Thank you.
CONGRATULATIONS by Design! Assembled and is working perfectly. I would like to ask a question!
I would like to convert to cirucito seconds and minutes rather than hours. Can anyone help me in that part of the program should I change, I do not know much about MikroC!
i have tried this circuit simulation in proteus the circuit and the program works properly but the problem is the microcontroller provides only some small power to the relay and that is why relay part is not working can any one help me ???
Relay is not driven directly from the microcontroller, it has a transistor amplifier for doing that. What are your relay specs? Make sure it is +5 V.
hi there thank you very much for your reply it is very helpfull im going to have a go tommorow once i get the 16×2 lcd. i have downloaded the hex file from this page. i know some people have seid it does not work. so is it the right one i have downloaded.
thank you so much. andrew
Congratulations for your project! Could someone please tell me how to change the software to count seconds. Thanks
You got the right one.
i am planning to work on this project..can you please specify what are the devices that this circuit can handle…hoping to get the reply soon..
sir, what are the electrical appliances that the following circuit can handle? and if the device gets turned off after the desired time will the power supply for the adapter will still be on?
Vandana,
This device controls an electrical appliance through a relay switch. So the capacity of load is determined by the specification of the relay used. I didn’t quite understand the second part of your question. The appliance is turned off as the relay disconnect the power to it, but the device (microcontroller) will still be on as it is powered through a wall adapter.
can we replace piezo Buzzer with another relay?
so that we can use to drive two appliances in total.
There’s an extra RB1 pin to drive another relay, if you want. You need to modify the code accordingly.
Thank you sir.
What’s the relay name which is used in the circuit?
what are the specifications of that relay?
please mail the modified code & hex file.
My mail ID is jeprakash.ece@gmail.com
how to dump hex file in the PIC 16F628A ?
which programmer has to be used?
@jeprakash : their are many softwares available for programming of the pic16f628a like-
WinPic – PIC programmer, mikroC PRO for PIC….
available free of charge…
Thank you sir.
I am using WIN PIC programmer for dumping hex file into PIC16F628A.
But, when I chosen the option PIC16F628A in the list, it is showing a message like this.
“conflicting VPP/VDD switching sequence on the options tab”.
please tell me how I have to proceed further.
hi i am tired!!! i exactly make this circuit and run this program in micro c an burn this hex file in 16F628A but in LCD there is no output. plz give me suggestion….
Jepraksh,
I would search on internet about the problem you are having with WIN PIC. I have no experience with this software.
Divyesh,
This should work. Check your configuration bit settings. Make sure you have selected external clock at 4.0 MHz, MCLR enabled, and WDT Off.
please suggest the software which is helpful for dumping hex file into PIC16F628A.
i cheak all is correct..
hi Divyesh.
please tell me which software used for dumping hex file into PIC16F628A.
Thank you in advance.
JEPRAKASH
i give u link in this page go SOFTWARE AND RESOURSE and download winpicgm v1013.zip.
http://robokits.co.in/shop/index.php?main_page=page&id=1&zenid=c5ckp4rrrr4b7hifdndhkjibe4
Hi Sir
Can you please send me the working HEX file, i would use this circuit as a timer for my SLA Fast Charger to automatically switch it off at a given amount of charging time. Please my email is rene_kenshin@yahoo.com Thanks
The source code and hex files are downloadable in the software section.
Dear Sir.
Excellant project . I already design the pcb and solder all components. it works well . many thanks very helpful for the beginners. I like to repeat this operation, by pressing the on/off switch. How I do it please help any hex code please send my mail .
My wishes and regards,
Lakshman
Sri – lanka
e mail – luckyallc@yahoo.com
[...] up is a Programmable digital timer switch. Based around a PIC15f628A micro controller this handy little device allows you to set both on and [...]
[...] up is a Programmable digital timer switch. Based around a PIC15f628A micro controller this handy little device allows you to set both on and [...]
hi divyesh.
I opened the web page which u posted. when I clicked on the zip file, a new web page is opened, in that showing products.
I am unable to download the software.
please tell the information.
thank u.
Howmany crystal pulses does PIC16f628A takes to execute one instruction cycle?
How the real time is compared with the entered on time & off time?
Please tell me the timer operation in the code.
What is the operators function which are used in the timer program?
Thank you.
Jeprakash,
It seems like you need to study some basics of PIC microcontrollers and learn MikroC programming. Describing them here was not the intention of this project.
When I compiled the program in MikroC Pro for PIC compiler, it is showing one error “Main function is not defined”. please tell me the modification in the code.
please mail the timer operation in this code to jeprakash.ece@gmail.com
Thank you.
Congratulations to you R-B! Great project!
I am using Pickit2 right now to load the HEX file into the chip. Everything works perfectly!
Since i want to modify the code a little bit, i will need to use the C source code. I have downloaded the mikroC PRO for PIC but I cannot get this software to work with pickit2. Do i have to use another programmer (like PRG-017 USB PIC programmer) in order to succesfully build and load the program or there is a way to compile the source C program using Pickit2?
Any help will be appreciated
Thanks
Dupont,
Although the programming language is C, the library functions are different in different compilers. This program can be compiled with MikroC. You can download the trial version of the compiler (that’s what I am using) from Mikroelektronika. And while compiling it with MikroC, you have to create a new project and then copy/paste this source code in the editor window. Please read http://embedded-lab.com/blog/?p=1750 and MikroC user’s manual for further details. I would appreciate if you will share your modified version with us in this blog, so that others may use it. Thank you.
Jeprakash,
You have to start with creating a new project in MikroC and then copy/paste the code. Read http://embedded-lab.com/blog/?p=1750 .
R-B,
I will try to do what you are suggesting: compile the C source code with MikroC in order to get the HEX file and then use pickit2 to load that HEX file generated from MikroC into the chip as i did earlier.I will let you know about that.
Thanks
Hi R-B,
Everything works perfectly!!!!
I am working on the change in the program now.
I ll post it later.
Thanks a lot.
Thank u sir.
Micro C compiler is working.
sir,
how to give the 230V to the relay output.
please tell the relay connections clearly.
I would like to use two relays in this project.
how to set the 2 devices on time, off time?
im new to PIC microcontroller. Please correct me for this:
1. MPLAB and MikroC Pro are kinds source code. I can choose either one of them.
2. MPLAB and MikroC Pro have features to compile the source code file.
If the source code is done in MPLAB it can only be compiled using MPLAB, same thing with MIkroC Pro.
3. If source code and hex file are both available for free for a particular project in the internet, then no need to download the source file (unless I need to modify the code) because the microcontroller to be programmed needs only the hex file.
4. A compiled code cannot be hacked or pirated for modification. Hackers can only modify if they have the original source code either made by MPLAB or MikroC Pro.
5. MPLAB uses programming language different from MIkroC Pro.
Can somebody please correct me with the above statement I have made. I’m new to this tutorial. As an electronic enthuasiast , I’m also interested to learn this nice stuff.
By the way, what particular textbook should I study to be able to learn how to make a program or source/code. I want to learn how to make a program, wherein the PIC microcontroller will display time, will sense a temperature above 30 degrees and trigger a relay, log (tru EEPROM, but retrievable to PC tru USB port) temperature every 5 minutes.
thank you.
@ aron: –
1. YES WE CAN USE BOTH MPLAB AS WELL AS MIKRO C PRO FOR SOURCE CODE BUT HERE ABOVE GIVEN PROGRAMME WRITTEN HAVE BEEN WRITTEN ACCORDING TO MIKROC, HERE THE LIBRARY FILES ARE IN BUILD FOR THE PROGRAMMER SO it is better to use mikroC pro programmer.
2. yes the source code written in MPLAB AS WELL AS MIKROC Pro are only be compiled in only that perticular software only as the library functions are defined accroding to software.
3. yes microcontroller only needs the hex file but the changes like the names and some other changes in the programme could only be done using source file..
4. yes you are correct A compiled code cannot be hacked or pirated for modification. Hackers can only modify if they have the original source code either made by MPLAB or MikroC Pro.
5. no, MPLAB doesn’t uses programming language different from MIkroC Pro.both uses the basic C language or we can also call it Embedded C….
” all the answers given above are according to my knowledge”…
one can use the Mazidi book…
I would like to use two relays.
So for controlling on/off time of another relay, Is it necessary to use another timer? or single Timer0 is enough for two relays?
please tell the code modification & how to set another timer & which registers I have to use?
please mail push buttons data sheet to jeprakash.ece@gmail.com
Goodday sir
im new in using a microcontroller.but project looks every interesting and i would like to carry out such a project myself. but their things i would like to know since this my first project ever.
1. I can it be using a key pad(having buttons from 0-9,start/stop and left and right),would i still be able to use this same micrcontroller?
2. Can i get the name of the parts used? So i can get the exact one’s
Thanks.
Nicholas
My email is nickakpan@yahoo.com
Thanks
nicholas
can u explain what do parameter mean…unsigned short HHMM_Pos[] = {6, 7, 8, 9, 10};
HHMM_Pos defines the cursor position for HH:MM digits in second row. For example, the first H is at 6 th position on second row of LCD and : is at 8th position.
Thanks!
Which prodecure event to move column to right? It is void cursor_left()?
Why do u say left when u pressed button and the cursor moving to right. But i don’t c moving cursor to left.
Bonsoir !
Monsieur je tiens à vous remerciez de votre minuterie mis en ligne, je voulais dire que j’ai réalisé un typon de votre horloge cela dit que je vous joins mon adresse mail si éventuellement si par la suite si vous désirez de voir les photo de votre minuterie clifordop@msn.com
je me présente Constant passionner de l’électronique, à bientot
If you can my stejletaj the right code hex
Programmable digital timer switch using a PIC Microcontroller 16f628A
thank……..
Would you please add comments in your MikroC source code, so that beginner like me can understand the code.Thanks in advance.
Hi, Thanks for the circuit. I made the circuit and programmed the pic with MPlab. But the problem I face is that the LCD is blank and no letters are shown in it. When i simulated the circuit with Proteus circuit simulator it runs fine. I double checked all the circuit and everything looks fine. Please Help me..Thanks and regards
Make sure you are setting the configuration bits correctly. If it’s ok, I would say check the circuit and all the connections again. May be the PIC is not running at all, connect a LED to any port pin and write a simple LED flashing program and see if it works.
Hi, The circuit is OK, but when I set the configuration bits like X’tal=XT, master clear= enabled, and all others either off or disabled and the device=16f628A, using MP-lab and import the hex file it Programs and fails in the end and the message displayed is :
Configuration Memory Errors
Field : Code Protect
Expected: Off
Received: On
although I kept Code Protect OFF, and when i again try by changing code protect to ON, it writes the files and when i place the IC to work nothing happens and the LCD is still blank. Please help me in this…Thanks and regards
Hi, I’m happy to say that I rectified the problem and the circuit is now working perfectly. The trouble was I used one preset 10k between Pin#2and 3 of LCD and it was a faulty one. I removed it and replaced it with a low value resistor 10R between Pin#3 to ground, and the circuit is now working. But still MPlab shows Config: memory errors when I write hex files to it. Anyways the circuit works. Thanks a lot and thanks for the time.
Is it possible to give a time delay for the LCD to switch off say for 5 minutes after the timer is set and switch on again when any of the four switches are pressed.If so help me with the code…Thanks
I like your work. Can you help me to loop the ON time and OFF time continuously… is there any command to loop the ON/OFF cycle? I want to use it 8hrs OFF and 1min ON but with LOOP action. so please help me out for my project. Thanks
din51074@gmail.com
Is it possible to give loop action to the set ON time and OFF time. Plz replay as soon as possible. Thanks
The C-code is provided to you, you can make whatever changes you want. Please don’t ask me to customize the code for your individual need.
hello,
can i know the relay connection for the circuit…
project is working perfectly on LCD display and buzzer but relay is not working…
i am not getting the relay connection according to above diagram…
can you send me relay connection diagram please..
or just explain it here….
mail- jnvarora@gmail.com
wow..looking for this kind so long
Hello,
Can u pls send me the detailed circuit of the project withe the code
my id:albinvadakkekara@gmail.com
pls send the source program to mail
All the details of the project (including source program) is available in the article, read it again.
But the program have error when i’m burn to ic
What kind of error are you getting? And which programmer are you using?
i got the right program
Congratulations for your project! Could someone please tell me how to change the software to count seconds. Thanks . I only need seconds in “on” mode.
I was searching for a switching timer, to use with LED signage,
fed 120 V , 60 Hz
The LED load is different from the resistive type load, and
may be closer in requirements to an induductive type load, such
a small display motor or transformer.
The RELAY makes all simpler.
I looked for various switches made by Leviton, Swylite or others.
Can I buy two of your switches, ready-assembled?
I may need more later.
Regards,
George
Sorry George, I don’t sell any ready-made products. You can use the information on my website to make the timer switch that you want.
dear sir first of all thanx!
circuit is working well without any problem!
now i want to add some extra working in the same circuit!
additional working is that a want to Run circuit to complete counter given to it e.g
i want to make an electric appliance off for 1 minute and then on for 5 minutes and this task goes on repeating for a specified number let for 4Hours of for 100 times!
now plz help me to make changes in the circuit and also for code….
Best Regards!
M.SAIF-ULLAH
Will the ON and OFF time settings will be saved on EEPROM or it will be erased whenever power is removed. what is to be done for the default on off time setting which is read from EEPROM whenever power is switched on.kindly mail me sir. Thankyou for the nice work.
Hi,
I was looking for multi-channel timer. Also if we can modify the circuit with the RTC, then we can take the time from the rtc. This will help even if there is a power shutdown, the time will still function.
Do you have the program for multi-channel.
Will be nice if we can set time and hour, and program when relay will be on and when relay will be is off, in time programmed . If we can add more relays and more schedules will be nice too.
Hi, i am new in PIC, can anyone send me an ASM code for this device that will make the device cycle again and again based on ON/OFF setting. i need this to control for my A/C unit. instead of a thermostat i will use this timer to control it. I know little in ASM and i want also to make expirement. please send to cris.lastima@yahoo.com
Thanks a lot,
Cris
Sir i am looking for such circuit; but with a real time clock which need to turn on and off the device next day automatically
i hope that u can help me
Regards
Prijith
Dear friend, we have collected the device (Programmable digital timer switch using a PIC Microcontroller . On yours
of schemes, but after inclusion on the display your emajl-address was displayed. You could not give us an insertion
for work of this device.
Dear friend, I made a device in your circuit “Programmable digital timer switch using a PIC microcontroller,” but it does not work in timer mode – on the LSD screen displays your email address. please send me a possible firmware for this device (timer)to ru6jw@rambler.ru
Best regards
Wasiliy.
Dear Friend , can i use PIC 16F628 instead of PIC 16F628A ?
Please i am waiting for your answer as soon as possible …thanks
@Riad,
You can use it but you have to recompile the source code for PIC16F628.
Thanks very much R-B for your quick answer
Please for fast recompiling, can u tell me what are the changes that i should do change in the source code ?
Please can u recompile it & give me the Hex.file ? because my experience in programing is moderate not professional like u …..thanks for advance
Sorry to forget to give u my email : riad_abed@hotmail (to send the Hex.file for PIC 16F628, sure if u have time because i don’t want to bother u ) ….thanks for advance
OK i recompile it & it’s working………..thanks R-B for your Help….
can i have the list of components that used in this project ? you can email to me fairy_bella1991@yahoo.com .. thank you
if u don’t mind can i have a list of component that have we used in this project.. can u email the list to me sir..or anyone can also email me if know the list of the component..my email is carm234@gmail.com..i really appreciated that..thnk you..
carm234,
All the components used in this project are shown in the circuit diagram. The diode used in the relay circuit is any general purpose rectifying diode, other components are labeled.
thnks for the answer sir..if u dont mind can i know how many of the volt in the light blue resistor under the LCD.. because i cannot see properly the line in that diagram..when i see at the circuit diagram it make me confuse which one in that diagram..
i need help building this circuit (programmable timer switch). i have constructed the hardware but not working. the lcd is showing some dots on the lower part of the screen. i simulated with proteus and it works fine. please kindly assist me. olaibilade@yahoo.com.
can i know the value of diode that u use near the voltage regulator (in diagram)..please tell me,i’m stuck doing this. or somebody else please help me..
@carm234,
It is any general purpose diode, say 1N4004.
thanks sir for your reply..very appreciate that..
hye sir is me again..u not answer my 1st question.. i wanna know how much volt for the light blue resistor near the LCD..i cant see properly the line in that resistor..
I am sorry I didn’t understand that part. Explain in more detail. Don’t look at the color of the components in the board, rather refer the circuit diagram to ask question.
sorry sir to making u confuse..when i look at circuit diagram i get bit confuse which one of the light blue resistor..i just see it only at the board diagram..i just only wanna know how much volt in this resistor..below i have a image which 1 the resistor..
http://img268.imageshack.us/img268/627/captureegf.jpg
You can ignore this resistor as it is not shown in the circuit diagram. I added it later for LCD backlight (pins 15 and 16 of LCD). It is 47 Ohm.
ok sir..thank you so much sir..
Thanks for this project, But hex file doesn’t work. Also I had tried to my level this program in C MPlab for 16F84A IC. but it does not work or compile.
so If u have solution for 16F84A IC, can u send me hex file, I am trying from last 8 days continuously, but I didn’t get success.
Thank again..
In order to compile the program you need to download mikroC Pro for PIC compiler, not MPLAB C.
sir , i have designed the circuit in the same manner but the code is not working , kindly mail me the code
Please check your circuit. The code should word as it worked for me and others.
Dear R-B,
Thank you for this excellent project.
I make a circuit and it works just fine. But everytime I have to setup push buttons for desired time. Is there any ability to circuit makes it automaticaly circular? I want one device to be turned on for desired time and turned off some time , then go again. Thanks in andvance.
Is there a way to modify the source code to run in a continuous loop. if so, this is just what I need to run my Well to fill my storage tank without burning out my pump or running it dry. I’m not so great with programming (more hardware oriented). Thanks =)And one more thing. Can you use a Micrel MM5450BN instead of the LCD? I’m Cheap =p
This is a very nice project which I would like to incorporate into a UV Light box for exposing PC boards. Can you help me to modify the code to either include :SS or use just MM:SS? Also it would be nice to pause the count whilst the lid were open (a high on one of the input pins) and to control a p mosfet which would switch on the UV LED panels.
Thank you.
Kevin
[...] For a more advanced digital timer switch, read my another project: Programmable digital timer. [...]
I can see after reading ALL of the comments that you are asked to redo code, send hex files, send two assembled programmable switches (Really?), et. al. I will not bother you again with asking for new code. I can figure it out well enough to use a different C compiler as you don’t seem to use any proprietary functions and I am not able to use MikroC on my older mac. Thank you once again for placing this in the public domain so that everyone may benefit. I will be using the LCD panel that is sold on piclist.org. It is very nice and already has the switches and LEDs. I will send you more information once it is complete if you would like. Thanks again,
Kevin.
Hi Kevin,
I liked your idea of using this project to control the UV exposure for PCBs. I am sorry to say that I don’t have enough time to modify this code for you. I hope you understand. Thanks.
I would like to ask if we can use pic16f84a in this circuit?tnx
i didn’t try this but i would like to ask if its sound could prolong?
i would like to ask if pic16f84a can replace pic16f628a to this circuit?tanx
@nevs,
Probably not, the PIC16F84A has got only 1KB of program memory which may not be enough for this application.
@maneva,
No, the PIC16F84A doesn’t have enough program memory for this application.
is the sound adjustable and could prolong longer?
It could but you have to modify the code for that.
i want to do this project for my college program.bt it seems diggicult to understand.can any one make me easy about this project?can give me details from the begening?plz email me.i will be very grateful.plz help me…..
16F628A has only 3.5kb flash how can you program given hex file having 11684byte information, isn’t it contradiction? also Mikro C can generate upto 2kbyte program word in trial version then why it is generating 11484byte hex file.please ans if somebody know
Jagdish,
There’s no contradiction. I think you are measuring the size of the HEX output file which is an ASCII file. The size of an ASCII file is different than the actual bytes of data inside. While you compile a program in mikroC, you can see the actual number of bytes used in the Messages window at the bottom.
What software can we use in PIC16f628a?can we used mplab as its software and picstart as its device programmer of this pic?
sir may i know if mikroc is suitable for picstart as its device programmer?thanks,,
sir i would like to ask if this kit is available to store?or if we can buy this kit?for some of the material are not available here,,thanks,,and if for sale how much will it cost?thanks again,,
sir i would like to ask if this kit is available to store or is this for sale?because some the material are not available here,,thanks,and i would like to ask if how much is this for sale?
No, there is no kit available for this.
what is the spec of the relay, potentiometer, the diode in voltage regulator?can you give us?this my email ad mylloyd_121@yahoo.com
In this project, is it possible to change the lcd with 7 segment? can you help us to modify the program using 7 segment?
Dear sir its very nice project .
if possible can u or any body modified it with CCS C. Because MIkroC Pro teak more RAM ROM & CCS C teak near 20% less than MIkroC Pro.
my email add shivendrakumarsahu77@yahoo.com
Dear sir
I made the circuit , but the hex program does not work .
Please be kind enough to show me to the correct hex file.
reguards!!!
@Vipula Virajith
The hex file that is linked works great for me. I had to change the config word so that it didn’t code protect the data and code but it worked the first time for me.
Dear sir
the hex program does not work .
Please be kind enough to show me to the correct hex file.
Please help me
Thank You
24 hour digital timer i will making. i want to correct Hex file. Please help me. Thank you
Dear sir,
I made a 24 hour programmable timer. but the hex file isn’t work properly. please can I get a updated and correct hex file.
@Vipula,
The HEX file should work just like it did for others. You can also compile the source code by yourself using mikroC if you want to make any changes.
Dear sir,
I’m so sorry. The circuit and HEX file are work correctly. When I programming the PIC 16F628A, I disabled all fuses. After that It worked. the on process of the timer was worked correctly. But The relay isn’t work in the off process of the timer. but Buzzer(horn) is beeping. Can you please inform me how to setting IC fuses for this timer.
[...] Murphy from New Boston, Michigan is a regular reader of Embedded Lab. He adapted our digital timer project to fulfill his need of a programmable timer switch for his darkroom. Here are some pictures that he [...]
Hi
R-B is it possible to modify your program such that when any of the
inputs RA2-RO6 are triggered(Hi or Low) it displays words like
“Low Batt” or ” fault” at the output
thanks
Hello my name is Todd I a currently trying to build a 24/7 timer to turn on at 4:15pm m-f for about 3 sec for a project I am working on. I have some electronical experience I think I can build It with some help but I don’t know where to start.
If anyone can help me please contact me. Thank you.
Sir, is it cyclic timer?
please send me the code for heart rate monitor from finger using pic 16f84 micro controller that should be programmable in top view simulator
please give the code as soon as possible…….IT’S VERY URGENT
please send me the code for heart rate monitor from finger using pic 16f84 micro controller that should be programmable in top view simulator…please give the code as soon as possible…….IT’S VERY URGENT
please send me the code for heart rate monitor from finger using pic 16f84 micro controller that should be programmable in top view simulator…please give the code as soon as possible…….IT’S VERY URGENT
naaz,
Sorry I don’t have one that you are looking for.
[...] Programmable digital timer switch using a PIC Microcontroller [...]
good day sir ..i am in direly need about this project you have i want to make it by my self also….can you give me whats the material i used to program the pic controller i really appreciate for your response thank you very much…
SIR, I MAKE THIS PROJECT PROPERLY BUT DISPLAY NOT APPEAR. I BURN HEX IN MICRO CONTROLLER BY PICPGM .PLEASE SOLVE BY PROBLEM………MY ID IS KANLYSEN@YAHOO.COM..SIR PLEASE HELP ME………… .
what is the clock frequency that I should put to simulate this first??
sir, please upload the hex file for cyclic. as soon as possible.
Sir please reply me.
thank you sir, I am successes this project. but can you help me about the cyclic hex file? thank you.
please send me the code for heart rate monitor from finger using pic 16f84 micro controller that should be programmable in top view simulator…please give the code as soon as possible…….IT’S VERY URGENT SIR…
I don’t have a code for cyclic timer.
if i use this code(hex) in mplab to embed it to the pic,,,what configuration bit will i use in:
oscillator:
watchdog timer:
powerup timer:
masterclear enable:
brownout detect:
low voltage program:
data eeread protect:
code protect:
thx in adv!
btw..may i ask the model name of the LCD you used (ex. LM016L)???
thx in advance
Any HD44780 based LCD will work.
Sir,
I have tried to program the PIC but the code memory was programmed but at the time of verification it showing errors!What might be the problem sir? please help me…!
the error message was “verification failed at 0000h” Sir, though such message comes is my Micro controller programmed? And will I get output? Please reply me as soon as possible sir! Its urgent!
This is working as it is…great project thank you…
We can’t find a 5v relay in our place. We tried the following relay circuit but it doesn’t work properly. What do we need to modify if our relay is 6v instead of 5v?
I m waiting for your response sir..
sir I know that you have helped many people for this post please sir this is last help please help me!
What programmer are you using?
Thankyou for your response sir. Programmer I used is IC Prog and next time(tried with different programmer) Winpic800 and other time Ponyprog200 and moreover PICkit and the source is not getting compiled in MikroCpro.The hardware I used is JDM2 programmer.
Hi! On the schematic there’s no connection on the relay, can you indicate where the 3 pins are connected to? It appears that it is not connected. It would be very usefull. thank you so much!
marc : nodoubtman@hotmail.com
congradulation for your beautiful project and i encourage you to continue making such beautiful projects
a best of luck!
marC:)
Dear sir i like ur project and i want to make this project just for my hobby plz send me details at my mail hemantbansal22@gmail.com
hi .. sir ..
if we want to operate relays up to five then how it will possible…please reply
Congratulations! Works fine.
Forgive me if I insist on the same question of other beginners:
what part of the code to change to have minutes and seconds instead hh:mm?
Thank you.
Hi RB ALL need a cyclic timer,pls modify the code help us is a exellent timer but i want to use on my aquarium ligths.
Come on friend help us whit the cyclic code!!!
[...] Programmable digital timer switch using a PIC Microcontroller …Jan 5, 2011 … This project describes a programmable digital timer based on a … A piezoelectric buzzer provides audible tone when the timer is started and … [...]
Dear sir i like ur project and i want to make this project just for my hobby plz send me details at my mail dino446@hotmail.com
Sir, pls. upload the cyclic source code. its help to all of us.
Please help me because when I simulate it in proteus not I get anything on the lcd in pc WDH I get compile error code Error 128 A # DEVICE required beforehand line.gracias Before This
Hi
A very nice project, but why do you require that diode before the voltage regulator? Is it because you want to cut off any negative voltage? but then we are already using a wall adaptor, please elborate on the use of this diode.
Thank you
piko.electronics@gmail.com
I think the base resistance of 2.2K is too high to make the transistor on and therefore to drive the relay, What do you say?
@elmer, which version of Proteus are u using? If its a demo version, it will not work.
Dear sir,
Can I use a DC battery with 4.8v instead of the AC supply with regulator circuit? I’m planning to use it in a remote area.
Thank You sir.
Yes, you can!
thank you sir for your fast response.
I checked the market but couldn’t find 5v battery. so, can I use 6v battery or going for less voltage battery is also possible?
thank you again for your ice project.
You can’t use 6V supply with a 5V PIC microcontroller. That will damage the PIC. Two diodes placed in series will reduce 6V to 4.6V, which is safe to use.
I am kind of novice in the area of electronics, but alwasy feel cracy abt it. I would like to build this one but I need to buy a USB programmer to trafer the .hex file to the programme the IC. My question is Where I can buy this kind of USB IC Programmer(dont know the term is correct or not)? I would prefer online in India or any part of Kochi, Kerala. Can anyone help me out to buy it?
Dear sir
I made the circuit , but the hex program does not work .
Please be kindly send the perfect HEX file as soon as possible (kanthtpriya@gmail.com)
Regards
Sri
hi Mr. Nigil George, you can buy online usb programmer from this site- http://robokits.co.in/shop/index.php?main_page=index&cPath=12
sir, everybody wants the timer to recycle. why not help us ’cause if we know it nobody will bother you. please do it for us. thanks.
Dear Sir your device is working perfectly but require setting the time every time actually i need when i have to set the time that time fix the permanently so what i have to do Please tell me this is possible Please give me the reply as soon as possible
ID- kanthtpriya@gmail.com
[...] Post added at 00:30 ———- Previous post was at 00:25 ———- Project location address : http://embedded-lab.com/blog/?p=1378 ———- Post added at 00:31 ———- Previous post was at 00:30 ———- This is counter [...]
thank you so much sir/mam
Dear Sir,
what is the potentiometer used for? What are the specification?
Will the relay be working for DC application (1.2v solar cell connected to LEDs)?
Thank you again
dear sir
pleas help me
i want small timer
sir pleas tell me how to program timer use pic16f84a
i want 0-99 second timer
sir i want tow 7 segment display this timer
sir this timer off time 10s or 20s (i can set the time in one touch switch and time up down touch switch,start stop touch switch)
out put is 10A relay
sir pleas tell me how to program it in mikro c
sir can you get me mikro c source code
sir plz reply to me
thank you very mutch.
dear sir..
i’m beginner using PIC…
based on this project..can we change the chip from PIC16F628A to PIC16F77A?
If we can change..what the properties needed to change it?
Hi Raj! The lamp is supposed to be connect to the NO or NC of the relay??
thanks!
marC:)
Hello
I’ve got the same question as Guru on July 22nd, above, which you have not answered yet:
Will the ON and OFF time settings be saved on EEPROM or will it be lost whenever power is removed?
What is to be done for the default on off time settings get read from EEPROM whenever power is switched on?
Thanks a lot!!
Daniel
you want to disable the comparator not to able it?
CMCON = 0×07; // Disable comparators
not
CMCON = 7; // Disable Comparators
right?
thanks!
marC:)
@Marc: Hex 0×07 is exactly the same value as Decimal 7, both of them are binary 0000 0111 !
@R-B: Sir, can we expect an answer regarding the EEPROM question? See Post #108!
And: How to modify code to count MM:SS instead of HH:MM ? See posts #35 and #39!
Thanks
Daniel
Hi! Firstly, i tried it to connect the relay to NO, then didnt work, and now NC, didnt work too… the relay is never activated, i start the project, and my device is always on … can’t put it off… i don’t know what’s happening?… doesnt seems to trigger the relay…
thank you for helping me!
can we have your mplab settings please?
thanks!
marC:)
Dan? does it works for you?.. the relay doesnt want to active on my part..?
Error in the schematics: LCD-pins 7 to 10 *must* be tied to GND! This is *first learning lessons of electronics*: never leave inputs open!
@Marc: I’ve not yet built this project. It’s a pitty, the author R-B doesn’t answer to our questions anymore!
Also note that the LCD-routines are built into library-files of MikroC Compiler. If you use this brand, you’ll never know how the source code looks like. No chance to get the source code. So if you want to be independent: write your own library, or much better yet: write it in assembler code, there’s many many examples out in the internet.
Dan
Dan,
The time settings are not stored in EEPROM, and as such they must be entered every time the circuit is reset. But you can modify the code to store the set time into EEPROM. Please read my EEPROM tutorial (http://embedded-lab.com/blog/?p=2547) to learn how to do that. I am sorry to say that it’s not possible for me to write/modify the code to fulfill everyone’s need.
Dan, pin 7 to 10 also works without connecting to ground, i have tested it!
thanks!
marC:)
WORK 100% ATT 4 MHZ CRYSTAL
whatthe function of your “cur_pos” and ” case 0: if(temp > 9) ON_time[Cur_Pos]=0; ” in your C code.
sounds like an interesting project, i will give you feedback when i have complete the solder
thankss again!!
have a great success!
marC:)
The chip still have space to store the set time into EEPROM or not ?
Can i get the LCD module name which you used to implement this circuit?
You can use any HD44780 compatible character LCD.
Hi Johnson,
It’s been a while since I worked on this project, but I believe there should be some memory bytes left for that.
Gud day. Pls wht is connection to load like from the relay. I need explanation on hw to get 220V to the appliances. My mail is sunda4god@yahoo.com. Regards
The relay work like a switch, you most to put one 220v output to your device and the other to the relay in series . One works at normal open and the other at normal clossed. You should input 220v in the middle point of the relay (diagram) and the output in the other (top o bottom point).
Thank you very much Sr. for the proyect. It work excelent. I will try to change de source code, for use “on” in minutes and seconds and let “off” like you did it.
If you will use 220V I recomend you to use a dpst or a spdt (http://en.wikipedia.org/wiki/File:Relay_symbols.svg) for cut line and neutral.
sir, why my diplay only show a black box…????
Why my lcd no output?? Only have a black box….
how can i do this operation continually.i dont want to stop the execution after single on and of…it should work cyclic till we press the start/stop button…
wish some1 could help
amaljacob28@yahoo.com
my project is most near with this project.i will used dog. clock with lcd and then the window will automatically open at 6am and close at 6pm. can you me please with my project using pic16f628a. thanks
my project is most near with this project.i will used dog. clock (i mean digital clock) with lcd and then the window will automatically open at 6am and close at 6pm. can you me please with my project using pic16f628a. thanks
Hi Raj! I’m trying to make a lcd chronometer, but first i have to understand this code :
f(Mode_Select){
ON_time[Cur_Pos] ++;
temp = ON_time[Cur_Pos];
switch(Cur_Pos){
case 0: if(temp > 9) ON_time[Cur_Pos]=0;
break;
case 1: if(temp > 9) ON_time[Cur_Pos]=0;
break;
case 3: if(temp > 5) ON_time[Cur_Pos]=0;
break;
case 4: if(temp > 9) ON_time[Cur_Pos]=0;
break;
can you explain please?
thank you so much!
marC:)
Dear sir
Let me know the fuse bit settings
for this timer I have confusion
in it. Is the Hex file on this
page is correct.
Thanks!
with regards!
Vaibhav Jain
Dear sir,
I want to use this timer for shutter control for night photography. I need the timer to use minutes ans secconds rather then hours and minutes. Is it possible to change the code?
Best regards
Dear Sir,
I would like to use thise circuit for shutter release controle for night photography. I need it to time minute and seconds rather then hours and minutes. Can you tell me how to change the code?
Best regards
hi sir,
i have this project in school (programmable digital timer switch using PIC 16F628A) but i dont know all the list of components to use and the program…
is some one able to help me get the details and some sample report of thier existing project?
thanks in advance
why my LCD Display not show the program?? just show this image http://img534.imageshack.us/img534/7528/picexample3.jpg please help me sir
HI All, everything works fine for me.
Hi
Your pcb shows two transistors, the chematic shows only one ?
Do you have a updated version of the chematic ?
Thanks
Dear Sir,
I would like to use thise circuit for shutter release controle for night photography. I need it to time minute and seconds rather then hours and minutes. Can you tell me how to change the code?
Best regards
Hi! This is one of the best PIC Microcontroller Projects as per my knowledge is concerned. I like the way that you have explained about this project. Keep publishing this type of posts.
Hi vinaykumar,
can you help me with this device? thanks please contact my email jerome.alog76@gmail.com
thanks
jerome
Thank you Sir. This is my first PIC Project and it is working finely.Could you help us by providing such a PIC circuit which will work in respect of clock time over 24 hours and once it programmed it will continue day after day if not changed.
sir i need a timer counter operation explanation for pic16f777a
sir i assembled this project but its not working please send me new hex code
Hello! Thanks for the project, I simulated in Proteus and it works, but I would like to know which version of MikroC compiler used, and I’ve tried to compile in some versions of MikroC and not running, it will be because the code has errors’ C ‘.
Thank you for your help.
there is some error in the source code ;;;;
device clock cannot be zero
internal error
through which software we can burn the program……n plz upload new program
light control switch project in Embedded control system
smart,suitable & simple project of Embedded system in the title
light control switch system
Hi good morning, I’m new to the topic of the pics and I wonder if you can make this timing circuit and over again without stopping. It would have to acivar and off indefinitely. I appreciate your help, thanks.
Hello good morning, I’m new to the world of the pics and I would like to mount this circuit but the timing will not stop ever. That is, it will stop and activate the relay continuously. I would appreciate your help to change this in the source file or if they have changed the hex file, and do not know much programming theme. Thank you very much for everything.
sir i want to work on pic16f877a, but this code is not working, it give error (demo limit), please sir help me
Hello,
great project, I simulated and it works perfect. Could you please send me on my emmail some materials or some text description about project, as much as you can? matej.condra@hotmail.com
Thank you or help.
Good technical innovation !, i want to practise this project using 0-60 seconds option .pls send me hex code . Law
sir how to repeat this program set one time timer
Hi anyone can help i have the same issue:
Ahmad on January 14th, 2013 5:05 am
why my LCD Display not show the program?? just show this image http://img534.imageshack.us/img534/7528/picexample3.jpg please help me sir
any suggestion to fix this bugs
thanks
plz sir can you tell me th contacts of the item that you put plz (it’s coed) thnx
Dear sir,
This timer work fine. But i want cycle timer please help me thankyou.