Automatically Turn on/off and monitor your Christmas Lights

Use the power of your Raspberry Pi to automatically control and monitor your Christmas lights!     Now you don’t need to manually turn on or off the Christmas Lights, the Raspberry Pi can control it for you.

In my first post, I showed how to build the Lawn Connect Project to automatically connect, control and monitor your landscape lighting.     I will extend this project here.

In this newly updated post,  I’ll show you the setup I use in my house to control my outside Christmas lights, monitor if anything is wrong, save electricity by turning them off each night, etc.

The three step process is as follows:

  1. Add your outside Christmas lights to LawnConnect
  2. Re-Calibrating your system to include the Christmas lights.
  3. Adjusting the “Lights Out” monitor threshold

Step 1:  Add your Christmas Lights to the Lawn Connect.

Using a multiple AC outlet power strip,  simply plug in your Christmas Lights to be connected to the output of the Lawn Connect.   Now the LawnConnect will automatically turn on both the Christmas lights and the Lawn Lights at the same time.


In my case ,   I connected several strings of Chrismas lights including a new LED projector that I placed in my front yard.  I also disconnected a string of Lawn Lights that light up my garage door to improve the contrast of the Christmas Lights.

Christmas Lights on Front Porch
LED Projector Christmas Light
Lawn Light is shown at top that that I disconnected to improve contrast and the newly installed Christmas Lights

Step 2:  Re-Calibrate the LawnConnect

Once the lights are installed, go to the LawnConnect Web App and press the Lights On button to apply AC power.    You simply need to press the Calibrate button to reset your Lawn Lights.   However, depending on the what type of Christmas lights you have, this may take some trail and error.

The goal of this calibrate step is to calibrate the lights when the current is at it minimum value.   The Christmas lights on my front porch are the blinking type with different patterns.   After some observation of the current reading, I realized there was almost a 200mA (0.2amp) variation in the current as a function of the blinking pattern.   I needed to ensure that my calibration occurred during a blinking pattern where the current was at a minimum.   After pressing Calibrate several times, the blinking patter was able to go through its sequence without the LawnConnect detecting a blown out lawn lamp.     In the future, I need to add an adjustment to the web page that allows the user to manually set a calibration current.

LawnConnect Web Page

Step 3: Adjust the “Light out” monitor threshold

This step may not be needed if you were able to successfully Calibrate your lawn connect when teh current is at a minimum.  However, you may still want to tweak this for your Christmas lights if you continually get a false trigger text message each evening.

This requires you adjust the Lamp_Off_Threshold parameter value in the file.

# ADC value to power output
# ADC is based on 3.3v range, or 3.22mv/bit with 10bits.
# Rsecondary is 470ohms
# transformer is 1:2500
# primary current = ADC*3.3v/1024/470*2500*sqrt(2)
ADCtoCurrentGain = 3.3/1024/470*2500/math.sqrt(2)

# threshold To detect …
Lamp_Off_Threshold = 7.0*ADCtoCurrentGain

In my case, the Lamp_Off_Threshold is set to 84mA or approximately 10watts (i.e. 10W = .084A * 120V ).     You can simply increase the “7” above to a higher value until you no longer get a false reading that a Lamp has burnt out.

A detailed explanation of the ADCoCurrentGain equation shown in the code above is provided in the Sensor Board Setup description of the project located at the LConnect github repository.

Please send me your question and comments in the textbox shown below.