PIC projects - 25/04/2013

This is my first PIC-project using the PIC16F627A, PIC16F628A or PIC16F648A.

In fact it's like a “de luxe bedside-lamp”, that can be used for other purposes as well.

Perhaps you can picture the scenario : bedtime ; but first you want to read your book or make crossword puzzles in bed ... and then you fall asleep with the lights on or the pen in your hand, making scribbles on the sheets ...


This circuit may help you to end all this!

Short description :

When entering the bedroom, you push the button to activate the night lamp – this increases the intensity of the light progressively to the last value stored in the memory.

By activating a switch, the lighting stops after a predetermined time, otherwise you press a button when you decide to turn off the light slowly.

When the timer is activated, a signal (beeper) warns you a while before the time has passed and the light turns off slowly after 30 sec, unless you press the reset-button because you want to read or puzzle some more, and then the cycle restarts ...

The timer is set by means of a push button. Each time the button is pressed, the time is extended by 30 min. and the number of beeps indicates the value of the interval time. This is stored into the memory for the next time the dimmer is activated or when the time has to be changed.

(1 x beep = 30 min ; 2 x beep = 60 min ; 3 x beep = 90 min ...... 10 x beep = 300 min or 5 h max).

This circuit functions also as a “deluxe”-dimmer :

Beside the Timer-function, the light value can be set by means of 2 push-buttons.

As long as the UP-button is pressed, the light-value increases slowly till the button is released.

The last value is stored into memory.

Same happens with the DOWN-button; now the light-value decreases slowly to a lower value and this value is also stored in memory for later use.

There are also 3 PRESET-buttons : LOW, MEDIUM and HIGH.

1 push on LOW decreases the value slowly to a minimum-value (glowing).

1 push on MEDIUM : goes slowly to medium-intensity.

1 push on MAX : increases slowly to the maximum value.

All these settings are stored in memory for later use.

An extra relay contact is available to switch on a lamp or any other equipment (such as a radio). This contact is closed as long as the PWM-signal is present and will work along with the timer as well.

schematic (eagle - in pdf format)

datasheet : PIC16F627A, PIC16F628A of PIC16F648A

Used software : MickroC for PIC

Photo prototype (not yet ready)

hex-file (PIC16F628A)

Programmed chip and/or PCB : via webshop (not yet ready)

Simulation of the circuit in Real PIC Simulator

This article in pdf-format

Guy Delreux


Back to Top
Dear users, this website stores cookies on your computer.
Their purpose is to improve your website experience while providing you with more personalized services. Cookies are also used for ads personalisation. If you would like more information about the cookies we use, please see our Privacy Policy. By accepting cookies, you consent to their use. You can also adjust their settings. If you refuse cookies, your information will not be tracked when you visit this site. Only one cookie will be used in your browser to remember your preference not to be tracked.
Edit cookies setting