Christmas Light Control


This project is an automatic Christmas Light Controller for turning on outside lights on your patio / porch. It controls your lights via a relay board. It turns on the lights automatically when it gets dusk, and can optionally flash them at a preset temperature. When the temperature reaches the preset value the lights will be begin to flash automatically. This can be useful to indicate freezing weather and slippery conditions on your sidewalk or steps. The lights are automatically turned off at dawn.

Figure 1
Parts List
  • (1) Propeller Project Idea Pack (#910-32810)
  • (1) 100K, 1/4W, 5% resistor (#150-01040)
  • (1) LM2940-5 Regulator (Optional)
  • (1) 22µF Electrolytic Capacitor (Radial Lead, Optional)
  • (1) 3-Pin Single Row Header (#451-00303, Optional, but recommended)
  • (1) 14″ 3-Wire F/F Extension Cable (#805-00002, Optional, but recommended)

Hardware Build

The 5V regulator and 22µF capacitor are optional and only required if you plan on supplying Vin with more than 5V. I wasn’t sure what other things I might add to my board so I added the optional 5V regulator and its required 22µF minimum output capacitor. The DS1620 is powered from the 3.3V supply rail and the serial bus is connected to P13-P15. There is a 1K resistor between P13 and pin 1 of the DS1620 (data) to protect in case of a programming error.

The phototransistor collector is connected to P27 with a 100K pull-up. This value was chosen to adjust for the right average amount of light required to enable / disable the relay.

An optional 3-pin header and servo extension cable were chosen to connect the Single Relay Board to the Propeller Project Board. You could solder the 3-pin header from the relay board directly into the proto board area, however that would put all the load of the relay board and wires onto those three pins.

The relay board could be wired into your Christmas lights on a front porch or patio using the COM and NO connections on the relay board to switch the power going to the lights.


Figure 2 – My Board

Once you have everything soldered and secure you can download the code to the board. Now when it is dark the relay will turn on automatically. When the temperature is at or below your preset point the relay will toggle once per second effectively flashing the lights. This can be used as a indication of freezing weather warning of possibly slippery sidewalk or steps.

I laid my board out so I could mount it in an enclosure on the front porch facing away from the house. This way the phototransistor picks up the ambient light and not the light from your Christmas lights.

How It Works

The DS1620 returns the temperature in F. The light sensor returns a simple 1 or 0 depending on the light level. When it is dark the pin connected to the phototransistor reads 1. When this happens the relay turns on. If the temperature is below the set point (TEMP_FLASH) the relay toggles once per second. Once there is sufficient light the relay turns off.

The level of light required to turn the relay on / off is set by the 100K resistor. If you would like to be able to adjust the level you can replace the 100K resistor with a 100K potentiometer in series with a 1K resistor. This will let you dial-in the light level you want the relay to turn on / off at.


Discuss this project on Savage///Chats

Christmas Light Control by Chris Savage is licensed under CC BY 4.0


Leave a Reply