Introduction: Web Controlled Holiday House Lighting

Picture of Web Controlled Holiday House Lighting

This is an extension to a previous Instructable on Permanent Holiday LED House Lighting.

Now that all the LEDs are wired up, the challenge is getting out there each holiday to change the pattern. You could add some push buttons to choose between programs, but since I manage TeleToyland for fun, and connect things to the web a lot, why not make the house web controlled!

The previous Instructable shows how to do all the wiring. This one mashes it up with the LED Tower Instructable to allow web control of the LED animations. The concepts could be applied to other projects. You can try the LED Tower any time online, but I will not make the house a project open to the web - am just using it for my ease of setup.

This project adds a Wifi shield to the Arduino from before - I used a CC3000 shield since it's less expensive, and it seems to work well. I also have a Unix web host setup that allows PHP web programming, and a MySQL database to hold the configurations. The LED Tower works in a similar way, and mentions other ways to do this kind of project. It could all fit on an Arduino if you want to have the Arduino respond to web requests directly - the DB is not a requirement.

Step 1: Parts

Picture of Parts

To add the web control to the previous Instructable, not many new parts are needed - just a CC3000 Wifi Shield. This shield is less expensive than the Arduino Wifi Shield, and Adafruit provides code samples that were sufficient for this project.

You will also want some kind of web hosting that allows PHP and a MySQL database

Step 2: Code

Picture of Code

The web server side of this project is very similar to the LED Tower Instructable. There are many ways to approach this kind of project, and this one works without configuring routers and Dynamic DNS, but does require an ISP web host with PHP and a MySQL database, which are common.

The core of this system is a MySQL database, and the attached SQL script will create the structure used by the code. It's a very simple schema - just one table with a field for the commands along with index/key and timestamp fields.

The attached PHP web page does all of the user interface to add commands to the queue and manage them. It's very basic and could be improved with a bunch of JavaScript, but we are kicking it old-school today. :-)

The page shows a form for adding commands, processes any removal commands, and shows the list of current commands all in the one page/script. The screen shot in the intro and this step are actually on the same web page. Each new command needs to be added in a few places in the PHP code/HTML, and also in the Arduino sketch, but the idea is that new commands will not be added very often. The page also has some macro commands to make it easier each year. Those can be added without changing the Arduino code.

On the Arduino side, the attached sketch connects to your Wifi network, loads the commands, and executes them in a loop. A hidden PHP page is used to retrieve the commands - it just returns the list, and does not remove them for this project since the main web page is where the command list is managed. You can run that hidden page on a browser to see if it is working.

The command format is simple - just a comma separated list of parameters.

The script only loads the commands once since we generally set the animation once per holiday and turn them on. It may not be worth the effort to load the commands repeatedly in the loop since you'd need to decide when to poll the server - each step of each animation, between steps, or with each loop. Changing the commands is mostly cool when you are showing off to neighbors :-) If you want to use a loop, the Xively CC3000 project linked from the Adafruit site has a repeating client example for the CC3000 shield.

Another way to do this project is with a Spark Core. That device is like an Arduino + Wifi Shield, and you can program it via a web IDE, so that would make it possible to do all of this project without a database and separate server. You can also do a front end entirely in JavaScript, and use their REST API to talk to the Spark Core. An Instructable for another day!

Comments

kebmoore (author)2014-11-28

My wife has finally agreed to let me start a holiday lighting project based on this idea. I will do more to protect the LED strips because of the snow and rain here in central Indiana. I have about 50 meters of roof line to adorn on our 2 story house, so this may be a multi-year project. Thank you for the examples you have given.

CarlS (author)kebmoore2014-11-28

Good luck and have fun! Be sure to read the comments on this one - some great ideas in there! I am switching from my Thanksgiving to Christmas lighting program today. :-)

iam_maker_leo (author)2014-11-20

Wow... how great beauitful house is....

I want to try it with my ethernet shield...( I dont have wifi shield ㅠㅠ)

CarlS (author)iam_maker_leo2014-11-20

Thanks. The Ethernet shield should fine - the code is very similar if you start with one of the client examples. I did that for a different project.

MsSweetSatisfaction (author)2014-11-18

Wow your house looks really great! I bet the neighbors are jealous of your high tech lights!

Thanks - I am keeping low key without synchonized music and all :-)

About This Instructable

3,511views

50favorites

License:

Bio: A Maker since childhood with all the classic symptoms, a robot builder, and an Internet software CTO by day.
More by CarlS:Marching Band Field PropGlow in the Dark TombstonesBucket Bot 2
Add instructable to: