Programmable Relay Controller, with Alarm Clock
Here for a photo of this project built on a breadboard.
This project uses the Dallas Semiconductors DS5000T 8-12 microcontroller. By using the DS5000T we can take advantage of the built in time keeping functions to control our relays using the time and date.
This is a very useful project. Programmable relay controllers very similar to this project are available with quite a large price tag. This project has industrial, as well as home applications.
In normal mode it simply displays the date and time, and allows setting of these functions with user input buttons. The buttons have multiple functions, depending on what subroutine you are in. In the normal mode Button #1 moves the user to the Time setting routine. Button #2 moves the user to the Alarm and Control setting routines.
The alarm routine allows you to set the alarm output as shown in the schematic with the LED. The control routine is where you program the relays on/off times.
The pushbutton switches allow you to set the time clock, set the time for a relay to turn on/off, and to select which relay you are programming. You program each of the eight relays individually to turn on/off at any time you want. You can program the Alarm Output just as you would any alarm clock.
The alarm will come on for a period of 1 minute. If you need the alarm to stay on for a longer period of time, you can use one of the relay outputs for your alarm, or modify the code to make the alarm output stay on for a longer period. Using the relay output for an alarm will allow you to program the alarm to stay on for as long as you need it.
You program each relays on time, then you enter the off time. This project would be great for an automatic sprinkler system to water your yard at different times of the day or night. Once you build the circuit and play with it a while, you will see how simple it is to operate. I won't go into great detail of the programming modes because of the simplicity of operation. It will be very simple for you to learn when you finish building it.
The LCD used is a standard 4X20 Backlit type and is controlled using 4-bit operation. The ULN2803A is a high current darlington transistor array, used to drive the eight individual relays. The transistor used for the Alarm Output can be replaced with nearly any NPN type you have in your parts bin. If you replace the Alarm LED with a buzzer, make sure you select a transistor capable of handling the buzzer current requirements.
J2 in the schematic represents 8 individual relays attached the the ULN2803. The ECG47 transistor is an NPN high-gain amplifier type and may be replaced with nearly any NPN type.
The zip file for this project contains the assembly language file, the HEX file and the schematic you see here in GIF format. Click Here to download the files for this project. The file name is Relay.zip and is only 37KB in size. Click Here for a photo of the programmable relay controller as built on a breadboard.
Note: You can purchase a DS5000T directly from the Dallas Semiconductors Credit Card Sales service by calling 1-800-336-6933. Many of the projects I post here using the 8051 will be based on the Dallas DS5000T.
I use 8051 Development System I designed using the DS5000T. If you haven't seen it Click Here to see it. Using this development system makes it extremely fast and simple to prototype new designs.
The ULN2803A is available from Jameco Electronics at 1-800-831-4242 Part # 34315 and are only 99 cents each.
Have fun with this one, its quite handy. Use it for an automatic sprinkler system, turning on your home lighting at preset times and even to wake you up in the morning with the alarm output.
NOTE: Remember, the DS5000T has an internal lithium battery backup power source. In the event of power loss, all of your alarm times, the date/time, and all of your pre-programmed relay on/off times will NOT BE LOST. Quite handy........:o)
If you use an LCD with the LED backlight as shown in the schematic, you may want to reduce the size of R4 to about 3-6 Ohms to increase the backlight brightness. Refer to the manufacturers data sheet for the LCD you choose. Of course it will work with a standard 4X20 non-backlit LCD if you like. I prefer the backlit version because its much easier to see at night.
P.S. Use a well filtered 5VDC power supply for this project.