Tom Hammond

Tom Hammond

Easiest to hardest:

  • SAVE NEWS ARTICLES ON WEBSITE TO PDF!
  • Add realtime clock to webpage for visitors from different timezones to easily tell when lights are available
  • Add two bulbs to bottom left string
  • Shorten bottom left and bottom middle cords?
  • Make floor hole in living room larger
  • Replace current garage extension cord with new 50' cord
  • Backup FPP as image
  • Backup camera as image
  • Backup "Christmas DMX" folder to CD
  • Make new tree anchors
  • Fix driveway arch
  • Find out why last 4-5 pixels do not light up on bottom left string (something wrong with sequence or string itself?)
  • Secure camera better so that wind doesn't blow it around.
  • Add resistors to data lines in GE control box
  • Build how-to website
  • Redo Layout in xLights (fix window accuracy)
  • Add WS2811 RGB spotlights
  • Add WS2811 mini arches
  • Person who may provide free stuff from MicroCenter: Ed Lukins, 614-850-3270
  • Find out how to allow more simultaneous connections to the camera. Try setting up sessions with Facebook Live? YouTube Streaming? Twitch? I discovered that a 4.5Mbps upload connection allows up to 8 simultaneous connections.
  • When there are too many people clicking, try setting up votes so that every 30 seconds, the most voted sequence plays.
  • Figure out whe GE bulbs are pink at times when they are supposed to be white (ask Facebook group)
  • Fix existing sequences and make them nicer, convert my old animations to sequences.
  • Website does not seem to show me as the clicker, even when the lights are available. It shows the previous clicker as using them instead.
  • Find out why white analog LED lights flicker on wreath
  • Find out why Falcon Player services sometimes stops for no reason, will not accept web input, have to restart service. (intermittent problem, sometimes more often than not). If I fix *** below, it may fix this problem, too.
  • Find out why GE controller "freezes" for no reason, need to reset power to accept DMX data from Falcon Player (rare problem).
  • Find out way to prevent people from sending commands to Falcon Player when lights are not on (daylight hours)
  • Find out why GE pixels are pink instead of white under full load (seems to be a power issue, not a bad pixel issue)
  • Fix marquee (make stiffer diffuser, enable 8-pixel characters, shorter (black) network cable, attach LED strips better), strengthen box halves, fix Arduino sketch problem.
  • Build flat tree like Keith's!

 

  • Currently building the iTwinkle website
  • Preparing for a presentation at Light Up Ohio this coming weekend
  • Ordering hardware to build the 17' tree
  • Fixing broken props from last season

(work-in-progress document)

 

Install BBB OS and Falcon Player in one step

  1. Download image from http://sourceforge.net/projects/win32diskimager/files/latest/download onto microSD card
  2. Insert card, hold down button S2, connect USB cable to power it on.
  3. Keep holding button until blue lights start to flash
  4. Wait about 20-25 minutes
  5. When blue lights stop flashing, disconnect USB cable and remove microSD card
  6. Connect network cable and empty flash drive, then connect power
  7. Access FP web interface via http://fpp/
  8. Allow FPP to automatically update to 1.8, then allow it to reboot and automatically update to v1.9

 

The tune-to sign works independently of the rest of your light show.  It does not use the animations created by xLights and is not controlled by Falcon Player.  Instead, when powered up, it reads a file named MESSAGES.TXT on a website that contains a list of holiday messages.  It then begins displaying these messages in a random order.  

Between messages, the tune-to sign reads a file named LOCATION.TXT on a website.  If you are using Internet controlled lights, this file displays the location of the Internet user who is currently controlling your lights.  If someone is actively controlling your lights, the tune-to-sign will display that person's location.  When no one is controlling your lights, the tune-to sign will resume displaying random holiday messages.

The tune-to sign is meant to be seen by cars passing by.  Therefore the enclosure is large (16 feet wide) and the characters are large (about 10.5" tall).  To save power and keep the sign affordable, it uses only seven strips of LEDs at 135 lights each, totaling 945 lights.  Instead of combining many lights to make large letters, I use fewer lights that are magnified with honeycomb-like channels that reflect and amplify each light within each channel.  That way the entire sign can be driven by an inexpensive Arduino and a regular 400-watt computer power supply.

The enclosure is a long, narrow box that houses the power supply and Arduino on the left (as you are facing the sign) in a compartment.  The compartment has removable face to allow access to this hardware.  Seven strips of LEDs line the rest of the enclosure in the second compartment, the front of which is covered with plastic diffuser used to cover drop-ceiling lights.

 

Building the Enclosure

The build plans are here.  The build plans above provide dimensions for enclosures using 1/2" or 1/4" thick wood.  My actual enclosure uses 3/4" thick wood because it was cheaper at the home improvement store.  I used poplar, but discovered that it becomes soft in wet/snowy weather, so the screw fasteners tear apart.  Use a harder wood for your enclosure.

The enclosure consists of 3/4" wood for the top, bottom, sides, and compartment divider.  I used 1/8" plywood for the backing.  In additional to the poplar being too soft, the plywood backing warps badly in moist weather.

For the panel that covers the hardware compartment, I cut a piece of metal roofing and attached a wooden strip to become the handle.  Between the short electronics compartment and the long LED strip compartment, I installed a wooden divider.  I made the divider "float" above the back of the enclosure so that the wires from the LED strip in the long compartment can pass through to the electronics compartment.

To install the frosted diffuser, I used a table saw to cut tracks in to the top, bottom, and side walls, then slid the diffuser in the tracks.

 

Installing the LED strips

The LED strips can be purchased from Amazon, eBay, AliExpress, etc.  You can do a search for "ws2812b 5050 led strip 5v" to find them.  Make sure that they have 30 LEDs per meter; buy a 5M strip that has 150 LEDs on it.  The strip should be rated for 5V.  If you accidentally purchase a 12V strip, the LEDs are sometimes groups in threes and are not individually controllable.  Here is what they look like:

Trim each strip to 135 LEDs (if you are using a 16' enclosure like I am).  The strips usually have an adhesive backing, thought I've found that it doesn't stick to painted wood that well.  Run the seven strips of LEDs along the enclosure, spacing them evenly so that the LEDs form square distances from each other.  Then secure the strips better with white or clear tape.  In my enclosure, I actually ran eight strips, but the eighth strip is not used.  It is for future expansion that is not implemented yet.

 

Installing the power supply

As mentioned above, I use a 400W computer power supply to power the tune-to sign.  I found a 3D printed bracket on www.thingiverse.com to mount it in the enclosure (the purple bracket in the picture below).  

Because my power supply does not have a power switch (ATX power supplies typically do not), I shorted the green pin on the large motherboard connector to one of the black pins on that connector using a thick wire or bent nail.  This way, when the power cord is plugged in the power supply, it instantly powers on. Here are instructions on how to do this.

To power the LED strips, each LED strip has a red wire for power and a white wire for ground.  Your strip's wire colors may be different, so look closely at the strip to see which wires are power & ground; they should be labeled.  I soldered all seven red (power) wires together to a single, thick red wire.  I also attached an eighth red wire into this bundle; this will be used to power the Arduino.  I did the same for the white (ground) wires, soldering them together to a thick, black wire (with an extra eighth wire to ground the Arduino).  On the other end each thick wire, I crimped a cut-off nail.  I then plugged these two wires into the 5V and GND pins on the power supply's motherboard connector, respectively.  The nails were thick enough to make a snug connection.

 

Installing the Arduino

The tune-to sign is controlled by an Arduino Mega 2560.  These can be found easily on Amazon, eBay, etc.  The Mega 2560 model is required because it has enough RAM memory to hold the program and store the messages it will display. 

I found a 3D printed mounting bracket on www.thingiverse.com, then mounted the Arduino into the enclosure.  I connected the power and ground wires from the power supply to the 5V and GND pins on the Arduino (see picture below).

For a wiring diagram, please click here.

On my LED strips, the data wire is green.  Your strip's data wire color may be different, so look closely at the strip to see which wire is for data; it should be labeled.  I soldered a 220-ohm resistor to each data wire, then soldered a female connector to the other end of the resistor.  I then used heat shrink to protect the resistor and soldered connections on each end of it.  The resistor is used to reduce interference caused by "signal bounce".  Signal bounce can cause your LED strips to light-up unexpectedly.

For each of the seven data wires, I plugged them into pins 23-29 on the Arduino, with pin 23 for the bottom strip of the tune-to sign.  So the Arduino now has seven data wires, a 5V power wire, and a ground wire plugged into it.  With the picture below, I also connected a voltage display to the 5V and GND pins.  This tells me the voltage of the power supply that is helpful for diagnosing problems.

Lastly, I attached an Ethernet "shield" to the Arduino, like this one.  This allows the Arduino to have Internet access from my home network's router.  This can be easily found on eBay & Amazon; search for "Ethernet Shield W5100 Arduino 2560".  Be sure that the shield is model W5100 and supports the Arduino 2560.  Below is a picture of an Arduino Mega 2560 with an Ethernet shield attached to it:

And below is a picture of my Arduino with the shield and wires connected to it:

 

Programming the Arduino

 

You need to install a program on the Arduino that makes it become a tune-to sign controller.  To program the Arduino, you need to download the Arduino IDE.  This allows you to upload programs from your computer to the Arduino board.  Normally, you download the tune-to sign program, open it into the IDE, then upload the tune-to sign program to the Arduino board.  This is trickier than it sounds, as the program needs installed a special way into the IDE.  To save you time, you can download the Arduino IDE with the tune-to sign program already installed from here.  Simply unzip this file into a folder on your computer.

 

Configuring the tune-to sign program

The next step is configuring the tune-to sign program for your particular lights, such as the website where the Christmas messages are retrieved from.  To do this, edit the TomsTuneToSignProgram.ino file in the arduino-1.6.5-r2\examples\TomsTuneToSign folder with your favorite text editor.  These are the important lines that need changed:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

The Ethernet shield may have a sticker on it with its MAC address.  This is a 16-character code, usually divided into eight 2-character pieces.  The MAC address is a like a house address in your neighborhood; it is a unique number that is different than other devices on your home network.  If your shield does not have this information printed on it, you may be able to skip modifying the above line.

char server[] = "itwinkle.org";  

This defines the website where the tune-to sign will find the LOCATION.TXT and MESSAGES.TXT files.  My website is "itwinkle.org", change this to your website instead.

int scrollSpeed=35;
int delayBetweenMessages=5000;

If the messages scroll too fast on your display, you can change the above "35" to a different number to speed it up or slow it down.  Normally, there is a five-second delay between each messages.  You can change this delay from "5000" (milliseconds) to a different number.

#define PIXELS 135 

If the strips of LEDs on your tune-to sign have more or less than 135 pixels per strip, change the above number accordingly.

int loopLocationDisplayDuration = 30;

If you are using Internet Controlled lights, the above number reflects the length (in seconds) of your animation files that website visitors choose.  In my case, my Internet controllable animations run 30 seconds each. 

 

Uploading the tune-to sign program

The next step is sending the tune-to sign program to the Arduino's memory.  To do this, open the folder that contains the Arduino IDE that you downloaded above.  Then run arduino.exe.  When the program starts, click File > Examples > TomsTuneToSignProgram.  A second Arduino IDE window will appear with the tune-to sign program open.

Before connecting your Arduino, verify this first:

* Make sure that you are using the Arduino Mega 2560.  The tune-to sign program only works with this board.

* If you have the LED strips connected to the Arduino, it is a good idea to temporarily disconnect them.  If the Arduino already has an older version of the tune-to sign program and you connect the Arduino to your computer, the Arduino may draw too much power from the USB port to power the lights.

When you have met the above requirements, connect the Arduino to your computer via a USB cable.  If this is the first time you have connected the Arduino, Windows will attempt to install hardware drivers for it.  Depending on the version of Windows that you have and the brand of Arduino, the driver may install automatically or you may be prompted to provide the driver software (you may have to download the driver software for that particular brand of Arduino).  Either way, the drivers must be installed successfully before proceeding to the next step.

When you connect the Arduino via USB and the computer accepts the connection with no errors (indicating that the drivers are installed and functional), tell the Arduino IDE the type of Arduino you are using.  Click Tools > Board > "Arduino Mega or Arduino Mega 2560".  Next, choose Tools > Ports > COM x where "COM x" is the virtual communications port that was assigned by the driver.  If you see more that one listing under "Ports" and are not sure which one to choose, try the first one, then try uploading the DMX program as explained below.  If the upload fails, choose the next COM port under Ports, then try uploading again.

Next, verify that the DMX program code is valid by clicking the checkmark icon in the Arduino IDE toolbar (below the File menu).  You will see "Compiling sketch..." in the window's lower status bar while the program is verified.  This may take several moments.  If you see an orange message stating "Error compiling", then there is something wrong with the DMX program or perhaps there is a typo in the global.h file that you modified above.  In this case, you will need to close the Arduino IDE program, fix the problem, then open the Arduino IDE and try to verify the program again.

If the tune-to sign program verifies correctly, you will see the "Done compiling" message in the status bar.  At this point, you can upload the tune-to sign program to the Arduino via the Upload button (the right-arrow button next to the checkmark button in the toolbar).  When you click Upload, the tune-to sign program will be verified again, then you will see "Uploading" in the lower status area.  A light on your Arduino will rapidly flash during the upload process.  When the upload is complete, you will see a message stating so in the status area.  You can disconnect the Arduino from the USB cable.

 

Preparing your website for the tune-to sign

When powered on, the tune-to sign retrieves its list of holiday messages from a file on a website called MESSAGES.TXT into its temporary memory.  If you want to change the messages the tune-to sign uses, simply update the MESSAGES.TXT file on your website, power off the tune-to sign, then turn it back on.  You may have up to 58 messages in this file with each message no longer than 75 characters.  If you store more (or lengthier) messages than indicated, the tune-to sign will not start properly.

Each message can be displayed in a variety of colors, specified as three-letter codes before the message.  For instance, here is a MESSAGES.TXT file with three colored messages in it:

<messages>
WHILet It Snow, Let It Snow, Let It Snow! 
REDIt's beginning to look a lot like Christmas
BLUIt is Christmas in the heart that puts Christmas in the air
</messages>

The color codes are: GRE (green), WHI (white), RED (red), BLU (blue), BRO (brown), YEL (yellow), CYA (cyan), PUR (purple), VIO (violet), LPI (light pink), MAR (?), TAN (tan), GOL (gold), LIM (lime green), LBL (light blue), ORA (orange), PIN (pink),

If your lights are Internet controllable similar to mine, my website creates a file called LOCATION.TXT and updates it with the current Internet user who is controlling the lights.  This file contains the location of the user, such as the following:

<location>
8575
Czech Republic
</location>

After the tune-to-sign displays a random holiday messages, it looks for the LOCATION.TXT file on your website.  If someone is actively controlling your lights, the tune-to sign will display the location (in this case "Czech Repulic") on the sign, telling people in your neighborhood where your Internet visitors are from.  If you do not have Internet controlled lights (there is no LOCATION.TXT file on your website), the tune-to sign will simply display random holiday messages.

 

Checking communication

After the tune-to sign program is uploaded to the Arduino, it will begin running the tune-to sign program immediately.  We now need to see if the controller can be contacted on an Ethernet network.  To do this, connect one end of an Ethernet cable to the Arduino's network board and the other end to an Ethernet switch or hub.  Connect your computer to the Ethernet hub/switch via another cable.

Then you can power-on your tune-to sign.  Lights should appear on the Arduino.  On the end of the network cable that plugs into the Arduino's network board, there are two lights.  One should be solid, indicating a connection to the Ethernet hub/switch.  The second light should be flickering occasionally, indicating that the Arduino is sending/receiving information on the Ethernet network.

As soon as you power the tune-to sign, it will contact the website that contains MESSAGES.TXT, then save the holiday messages therein to the Arduino's temporary memory.  It will then begin displaying these messages on your sign!

The tune-to sign works independently of the other light controllers.  It doesn't receive commands from xLights nor Falcon Player; the tune-to sign does not play shows created by these.  Instead, the tune-to sign relies on files on the iTwinkle website.  

When the tune-to sign is powered up, it looks for a file in www.itwinkle.org named messages.txt.  This file contains a list of messages for the tune-to sign to randomly display.  There can be up to 55 messages up to 75 characters long.  To change the messages that the tune-to sign displays, simply change the contents messages.txt file on the website, then reset the tune-to sign by disconnecting power, then apply power again.  Messages can be displayed in different colors; prefix each message with a three-character color code such as "RED", "BLU", "YEL", etc.

After displaying each message, the tune-to sign checks the website to see if anyone is actively controlling the lights.  It does this by reading the location.txt file on the website.  If this file shows a different location than the previous time it checked this file, the tune-to sign knows that someone is actively controlling the lights at that moment.  It then uses the contents of this file (city, state and/or region) to display the visitor's location with a message such as "Lights being controlled from Paris, France".  After this message is displayed, the tune-to sign goes back to displaying random messages again.

 

The tune-to sign is a bit of a misnomer.  Traditional tune-to signs display a message to outdoor visitors to tune their car radios to a station that is playing Christmas music that is synchronized to lights.  

My tune-to sign works differently.  It uses 135 columns by 7 rows of LED lights to display messages in a ticker-tape or scrolling marquee fashion.  These strips of LEDs are mounted in a 16' wooden box, powered by a computer power supply and driver by an Arduino Mega 2560.

You can program up to 55 messages of 75 characters each.  The tune-to sign will randomly display these messages in various colors.  

What makes this tune-to sign interesting is that if someone in the world is actively controlling the Christmas lights, the sign will display the country and city/region that someone is from, using a message such as "Lighting being controlled from Paris, France".

The tune-to sign controller works independently of the other controllers; the tune-to controller does not need to communicate with xLights nor Falcon Player.

Tune-to sign controller (one half)

In order for people on the Internet to control your Christmas lights, they need to see your lights (through an outdoor webcam) and actually control them (through the Raspberry Pi running Falcon Player).  This involves creating webpage that shows the video of your house and buttons that visitors click to control your lights.  This involves knowing a little about HTML and PHP programming, but I provide enough examples to get you started.

To create a webpage, you need to purchase a web hosting package.  There are many companies on the Internet that do this; I prefer www.1and1.com.  The hosting package will provide a place where you create your webpage and a domain name to access it (in my case, www.itwinkle.org).  Whichever company that you choose, make sure that it allows creating and running php scripts.

 

Showing a live video feed from your webcam on the webpage

  1. Create a file called index.php on your home computer using a text editor such as Windows Notepad.  Note: Do not use a word processor such a Microsoft Word as it will add extra characters into the php file that cannot be understood by the website.

  2. Type the following lines in this file:

    <!DOCTYPE html>
    <html>
    <body>
    <img src="http://itwinkle.ddns.net:8080" />
    </body>
    </html>

  3. Replace "itwinkle.ddns.net" with the Dynamic DNS hostname that you created in the "Setup a Dynamic DNS service so that the Raspberry Pi and webcam can be easily accessed from the Internet" page on this website.

  4. Save the file, the upload it to your website.  The technique for uploading filers can be different for each Internet hosting company.  I prefer using FTP to send the index.php file to the website, but there are many other ways.  Contact your website hosting company if you are not sure how to do this.

  5. Open a web browser on your home computer, then go to the website domain name that you created when purchasing the website hosting package.  In my case, the website is www.itwinkle.org

  6. You should see a live video feed from your webcam!

 

Controlling your lights from a webpage

The first step to controlling your lights from a webpage is configuring Falcon Player that runs on the Raspberry Pi.  Normally, you use the Falcon Player web interface to choose which show files that you want to play.  You choose a show/sequence file, click the [Play] button, then your lights play the show.  For Internet control of your lights, visitors need to play show files without using Falcon Player's web interface.  This involves writing "scripts" on Falcon Player to automate how it works.

 

Creating a script file on the Falcon Player Raspberry Pi

  1. Create a file called butterfly.sh on your home computer using a text editor such as Windows Notepad.  Replace "butterfly" with the name of your show/fseq file.  In my case, I named the file "butterfly.sh" because the show/fseq name is "butterfly.fseq".  Note: Do not use a word processor such a Microsoft Word as it will add extra characters into the script file that cannot be understood by the website.

  2. Type the following lines in this file, then save it:

    /opt/fpp/bin.pi/fpp -c stop
    /opt/fpp/bin.pi/fpp -p "butterfly"

    Replace the "butterfly" in the above line with the name of the show file you want to use.  

    The above lines do two things.  The first line tells Falcon Player to stop animating your lights, so that it is ready to play the show that was chosen.  The second line tells Falcon Player to play the "butterfly" show/fseq file, which starts animating your lights.

  3. Using your home computer's web browser, open the Falcon Player web interface, then login with the name & password when prompted.  In the Falcon Player menu, choose "Content Setup > File Manager", then click the Scripts tab.  The "Script Files" section should be empty as you haven't uploaded any scripts yet.  Click the blue [Select Files] button, then browse your computer to the folder where you saved the above butterfly.sh file.  When you select the script file and then click [Open], the file is immediately uploaded to Falcon Player on the RPi.  The Script Files section should show the script file that you uploaded.

 

Creating a script file on your website

  1. Create a file called butterfly.php on your home computer using a text editor such as Windows Notepad.  Replace "butterfly" with the name of your show/fseq file.  In my case, I named the file "butterfly.sh" because the show/fseq name is "butterfly.fseq".  Note: Do not use a word processor such a Microsoft Word as it will add extra characters into the php file that cannot be understood by the website.

  2. Type the following lines in this file, then save it:

    <?php
    $url = "http://itwinkle.ddns.net/runEventScript.php?scriptName=butterfly.sh";
    $headers = @get_headers($url);
    ?>

    Replace "itwinkle.ddns.net" with the Dynamic DNS hostname that you created from the Setup a "Dynamic DNS service so that the Raspberry Pi and webcam can be easily accessed from the Internet" page.  Replace the "butterfly" in the above line with the name of the script file that you created above.  

    The above lines allows website visitors to activate a file called runEventScript on your Raspberry Pi running Falcon Player.  This file then runs the script that tells Falcon Player to stop what it is currently doing, then play the show/fseq file that was chosen on your lights.

  3. Save the file, the upload it to your website.  The technique for uploading filers can be different for each Internet hosting company.  I prefer using FTP to send the butterfly.sh file to the website, but there are many other ways.  Contact your website hosting company if you are not sure how to do this.

 

Creating a website link to activate the website script

The final step is creating a button that website visitors click to play chosen show files, thereby animating your lights.  

  1. If you already created an index.php file to show video from your outdoor webcam, open this file to edit it.  Note: Do not use a word processor such a Microsoft Word as it will add extra characters into the php file that cannot be understood by the website.

  2. Between the <body> and </body> lines in this file, add the following lines then save it:

    <iframe style="display:none;" name="target"></iframe>
    <a href="/butterfly.php" target="target">Butterfly</a>

    Replace the "butterfly" in the above line with the name of the show file you want to use.

    The above lines allows website visitors to activate the butterfly.php on your website, which then activates a file called runEventScript on your Raspberry Pi running Falcon Player.  This file then runs the script that tells Falcon Player to stop what it is currently doing, then play the show/fseq file that was chosen on your lights.

  3. Save the file, the upload it to your website.  The technique for uploading filers can be different for each Internet hosting company.  I prefer using FTP to send the butterfly.sh file to the website, but there are many other ways.  Contact your website hosting company if you are not sure how to do this.

  4. Open your home computer's web browser, then go to the domain name that you created when purchasing the website hosting package.  You will see a link on the page called "Butterfly".  When you click this link your lights should starting animating with the butterfly show.

 

Protecting your Falcon Player Raspberry Pi from hackers

When website visitors click the "Butterfly" link to control your lights, this link activates the butterfly.php file on your website.  This file then activities the RunEventScript file on your Raspberry Pi.  The trouble is, RunEventScript can run all sorts of scripts on your Raspberry Pi, possibly scripts that can damage your RPi.  If hackers view the contents of the butterfly.sh file on your website, they will see references to RunEventScript and may try to hack your RPi.

The following steps offer basic security by hiding the RunEventScript reference, so that it is not easily seen inside the butterfly.php on your website.  As mentioned in earlier instructions, please disconnect your Raspberry Pi from the Internet when Christmas is over; do not leave it connected to the Internet 365 days a year!  Otherwise you could be inviting hackers to damage your RPi.

  1. Open the butterfly.php file that you created in the above steps, then copy its contents to the clipboard (highlight all lines, then press [Ctrl-C].

  2. With your home computer's web browser, go to the PHP Obfuscator website.

  3. In the area that says "Insert PHP file contents here...", click your mouse in this area, then paste the contents of the clipboard ([Ctrl-V]).

  4. The right area of this webpage will show a lot of gibberish.  Highlight all of this gibberish (make sure of you have all lines; you may have to scroll down to highlight all of it), then copy it to the clipboard.

  5. Create a new file called butterfly.php with a text editor, then paste the contents of the clipboard into it.

  6. Save the file.  Important: Do not overwrite the original butterfly.php file from Step 1; save this new file somewhere else.  You will need the original file in its "non gibberish" state in case you need to make changes to it in the future.

  7. Save the file, the upload it to your website, overwriting the butterfly.php file that was there.  The technique for uploading filers can be different for each Internet hosting company.  I prefer using FTP to send the butterfly.php file to the website, but there are many other ways.  Contact your website hosting company if you are not sure how to do this.

    Note: If you make changes to the original butterfly.php file in the future, you need to follow the above steps again to create a new "gibberish" version of it, then save it to your website again.

 

Congratulations, you now have Internet controlled Christmas lights!

Accessing devices on your home network from the outside world

When you created a domain name via www.no-ip.com in the previous instructions, this domain name allows the outside world to find you.  Specifically, website visitors can find devices on your home network, as long as these devices have Internet access.

When website visitors contact your domain name (in my case, itwinkle.ddns.net), their request comes from their computer's web browser, through the Internet, to your home Internet router.  If any devices on your home network are "listening", they will respond.  By "listening", I mean devices that can show a webpage to the website visitors.  

Your Raspberry Pi running Falcon player is a "web server"; it shows a web interface when you access it through your home computer's web browser.  So, when website visitors go to itwinkle.ddns.net on their web browser, they will be shown the web interface for Falcon Player, as it was "listening" and responded to their request.  

 

One Internet connection controlling multiple devices

The problem is that the outdoor webcam needs to be "found" by website visitors.  The webcam is also a webserver that uses a webpage to show the live video feed.  So when website visitors go to itwinkle.ddns.net, how does it know which webserver to use (Falcon player or webcam).  To make Internet controlled lights, website visitors need access to both at the same time.  They need to see your house with the webcam and control your lights with Falcon Player.  

 

Accessing multiple devices with your Internet router

Normally, only on web server can be accessed by a single domain name.  But with "ports", you can access multiple web servers from a single domain name.  The default port number for most websites is "80".  When your Internet router receives contact from a outside visitor, it sends that request to any devices on your network listening on port "80.  Both Falcon Player and your webcam are listening on port 80, which is a problem because they will both respond at the same time.

To solve this problem, your Internet router may have a feature called "port forwarding".   This allows website visitors to use multiple port numbers to access your multiple devices.  In my case the Raspberry Pi running Falcon player "listens" for requests on port 80 (the default port for web pages), while the webcam listens on port "8080".  So, when website visitors go to "itwinkle.ddns.net" or "itwinkle.ddns.net:80", they will see the Falcon Player web interface, while going to "itwinkle.ddns.net:8080" will show them a live video feed from the webcam.  

Note: The webcam has an administrative web interface on port 80.  When I access the IP address of the webcam, I can login to the camera to make changes.  In addition, you can configure a "video streaming" port in the MotionEye OS settings to easily display the live video stream (bypassing the web interface).  I set this port to 8080.  When I access itwinkle.ddns.net:8080, the router directs the request to the IP address of the webcam, then to port 8080 on the webcam, which displays the live video stream.

Not every Internet router has this "port forwarding" feature and the method to activate it is different for each brand of router.  Below is how I setup this feature on my TP-Link brand of Internet router:

  1. Using a web browser on your home computer, go to the gateway of the IP address that was assigned to your home computer.  The gateway is usually the IP address with a ".1" for the fourth number.  For instance, my home computer is assigned an IP address of 169.101.200.100 by the router, so the gateway is 169.101.200.1.
  2. You may be prompted for a name and password to access the router's web interface.  Enter the name & password if prompted.
  3. In the router's web interface, choose Forwarding from the left-side menu, then choose Virtual Servers from the submenu.  



  4. Click the [Add New...] button to add an entry to the Virtual Servers list.  Set the Service Port to "80" and set the IP address to the RPi running Falcon Player.  Make sure that Protocol is set to "ALL" and Status is setup to "Enabled" for this entry.

    The RPi has a built-in web server which is used for configuring Falcon Player via its web interface or running scripts that control your lights.  This web server responds to visitor's requests on service port 80, which is the default port for accessing a website.

    To allow an Internet visitor to see Falcon Player RPi, they do not know the IP address of your RPi nor the IP address of that your Internet provider assigned to your home network.  But since you are using Dynamic DNS, visitors can find Falcon Player through the DDNS address. In my case, they point their web browser to itwinkle.ddns.net.  When a visitor's web browser contacts your home network, their web browser defaults to port 80.  

  5. Click the [Add New...] button again to add a second entry to the Virtual Servers list.  Set the Service Port to "8080" and set the IP address to the RPi running the outdoor webcam.  Make sure that Protocol is set to "ALL" and Status is setup to "Enabled" for this entry.

    When Internet visitors point their web browser "itwinkle.ddns.net:8080", your router directs the request to port 8080 on the outdoor camera RPi, displaying the live video stream.  The camera's RPi also has a built-in web server which is used for configuring the live video feed from the camera.  This web server responds to visitor's requests on service port 80, which is the default port for accessing a website.  

  6. Click the [Next] button at the bottom of the screen, then save your changes to the router.

 

In summary, your RPi running Falcon Player and the RPi running the webcam both respond to incoming requests on port 80.  This is a problem as both RPis are listening for incoming requests from Internet visitors on this port.  The router, through port forwarding, can send light control requests to the Falcon Player when visitors specify port 80 on their web browser.  When visitors specify port 8080 on their web browser, the router sends those requests to the webcam instead.  Thus both Falcon Player and the webcam can respond to incoming requests, even though they both "listen" on the same port (port 80).  

In order for website visitors to control your Christmas lights, they must be able to "find" your outdoor webcam (to see your lights) and the Raspberry Pi running Falcon Player (to control your lights).  Your Internet provider provides a unique IP address that allows people to find you.  However, this IP address changes to a different number from time to time, depending on the whim of your Internet provider.

In order for website visitors to find you, despite a changing IP address, you can do two things.  You can purchase a "static IP address" from your Internet provider, an IP address that does not change.  But if you want to save money, you can setup a "Dynamic DNS Service" (DDNS).  This associates a domain name with the IP address assigned by your Internet provider.  When your IP address changes, the domain name points to the new IP address.  That way, website visitors "find" you through the domain name which never changes.

There are lots of different ways to setup a DDNS service.  Some are free, some incur a cost.  I chose the "free" route.  My favorite is www.no-ip.com.  Here is how it works:

  1. Create a free account account on www.no-ip.com
  2. Choose or create a hostname (domain name) that will be used for visitors to find you on the Internet.  I chose itwinkle.ddns.net
  3. Download and install the Dynamic DNS Update Client (DUC) on your home computer (not the Raspberry Pi).  This program watches the IP address provided by your Internet provider.  If the IP address happens to change to a different number, the DUC client updates the hostname in Step 2 to point o the new number.
  4. On your webpage that visitors see to control your lights, you use the hostname to access to the Raspberry Pi running Falcon Player and the outdoor webcam.  More information about setting this up is in the "Setup a webpage that allows visitors to send commands to the Raspberry Pi, playing chosen animations" page on this website.
  5. That's it!

Even though www.no-ip.com is a free service, it requires you to verify your account once a month.  This helps them ensure that you need and are using their service.  Once a month, you will receive an email to verify your account.  Simply click this link to do the verification.  It's easy and just takes a minute.  

If you would rather not bothered with monthly reminders, there are paid Dynamic DDNS services available through other companies, but I have not pursued this.

In order for Internet visitors to control your Christmas lights, they need to see them remotely.  I use an "IP camera" (a.k.a. "network camera") that displays a streaming video of my house on a webpage.  This camera is mounted on a tree at the edge of the yard, pointing toward the house.  IP cameras use an Ethernet cable to connect to your router, allowing the camera access to the Internet.

IP cameras can be quite cheap to very expensive.  I needed the IP camera to stream live video onto a webpage without needing to login with a name & password.  I also needed multiple website visitors to watch the video stream simultaneously.  I also needed a way to disconnect visitors if they were viewing the camera too long, which prevents other people from viewing it.  Getting these features normally requires an expensive IP camera costing hundreds of dollars.

Thankfully, there is a cheaper solution that offers more flexibility than the commercially made IP cameras.  I installed a Raspberry Pi into a "dummy" camera enclosure, then installed the free MotionEye software on it.  In addition to having most all the features I needed, it doubles as a recording security camera during the non-Christmas season.  Below is how to build it!

 

The hardware

  • Raspberry Pi 2 or Raspberry Pi 3.  The Raspberry Pi 1 does not have enough performance to operate the camera.

  • MicroSD memory card.  8 gigabytes is fine if you will only use it for live streaming.  If you want to use the camera as a recording security camera, I suggest a larger memory card to store the recordings (32 or 64 gigabytes).

  • Raspberry Pi camera module.  There are three versions (v1, v2, and v2.1).  Any of these versions will work.  The later versions support higher resolutions, but the resolution doesn't matter with live streaming (which uses low resolution anyway).

  • "Hacked" USB cable.  Any USB cable will do.  You will cut the end off, then wire the cut end into the Raspberry Pi to power it.  

  • Long, two-wire cable.  I connected male and female USB connectors to each end of this 100' cable.  This will provide power from the inside of my house to the outdoor camera.

  • Long Ethernet cable. This connects the outdoor camera to the Internet router inside your house.  Mine is 100'

  • 5.25V USB power adapter.  This plugs into the wall, then my 100' USB extension cable plugs into the adapter.  The Raspberry Pi needs 5V to operate, but 5.25V is needed because of the 100' cable length (the voltage drops a little from the long cable).  This makes sure that 5V is fully provided to the RPi.

  • Micro USB power cable.  This is handy for powering your Raspberry Pi during the installation of the software.

  • Dummy security camera.  The Raspberry Pi and camera module will be placed into this enclosure.  Refer to the pictures on this webpage, then use eBay to find a similar enclosure.  You can mount the RPi however it will fit, but if you have a 3D printer, there are adapters that make it all fit nicely inside the enclosure.  More on that below.

 

The software

  • MotionEyeOS.  This is free software that you install onto the Raspberry Pi.  It contains both the RPi operating system and the camera software. This link has versions for Raspberry Pi 2 and Raspberry Pi 3, so download the correct version for your particular RPi.

  • SD Formatter.  This erases the microSD memory card and prepares it for use.

  • Win32 Disk Imager. This saves the MotionEyeOS image file that you downloaded above onto the Raspberry Pi's memory card.

  • PuTTY.  Some of the installation steps below require that you access the Raspberry Pi's operating system.  Putty provides "shell" access to your RPi.

 

Installing MotionEyeOS

  1. Download the MotionEyeOS software using your home computer.  It downloads as a Zip file.

  2. Unzip the file into a folder on your home computer.  There will be a single file that ends in ".img".

  3. Download and install the SD Card Formatter program on your home computer.
    1. Insert the microSD memory card into your home computer (if it has a memory card slot) or into a USB card reader.
    2. Run the SD Formatter program.
    3. Make sure the Drive field is set to the drive letter of the memory card.  Important: If it's the wrong drive letter, you could erase a drive on your home computer instead!  Be very sure the drive letter of the memory card is shown.
    4. Click the [Option] button, then set "Format size adjustment" to "On".
    5. Click the [Format] button to erase the memory card.
    6. When the format is finished, close the SD Formatter program.



  4. Download and install the Win32 Disk Imager program on your home computer.
    1. Run the Win32 Disk Imager program.
    2. Near the Image File field, click the blue folder button, then locate the MotionEyeOS .img file that you downloaded and unzipped.
    3. Make sure the Device field is set to the drive letter of the memory card.  Important: If you choose the wrong drive letter, you could erase a drive on your home computer instead!  Be very sure the drive letter of the memory card is chosen.
    4. Click the [Write] button to save the .img file to the memory card.
    5. This process may take several minutes.  When it is finished, close the Win32 Disk Imager program.
    6. Remove the memory card from your home computer and insert it into the Raspberry Pi.

 

Turning on the camera for the first time

  1. Insert the memory card into the Raspberry Pi if you haven't already done so.
  2. Connect the camera module to the RPi.
  3. Connect an Ethernet cable to the RPi that is also attached to your Internet router.
  4. Connect the micro USB power adapter to your RPi, then plug the adapter into a wall outlet.
  5. Wait a few minutes for the RPi to power up.  You will see flashing lights on it.
  6. Your router will assign a random IP address to it via the router's DHCP service.  You will need to login to your router's interface to determine the IP address that it assigned to the RPi.
  7. Open a web browser on your home computer, then go to the IP address that was assigned to the RPi.
  8. You should see an video feed from the RPi's camera (note that the screenshot below is a night-time shot; you can't see my house nor lights, but you can at least see the camera's web interface).  

 

Configuring camera settings

The next step is optimizing the camera setting to work well with Internet control.

  1. Click the blue “Person” icon in the top-left corner of the window, then login with “admin” for the username and a blank password
  2. Click the triple “horizontal line” icon in the top-left corner of the window to open the Settings menu



  3. Set these settings:

    1. General Settings > Advanced Settings: On
      1. Admin password: (set this to whatever password that you like; make it somewhat complex!)
      2. Time Zone: (choose your timezone)

    2. Network > IP Configuration: Manual (Static IP)
      1. IP Address
        1. Enter the IP address that you want to use.  Do not set this to the DHCP address that was assigned by the router as this address could change from time to time.  
        2. The first three numbers must be the same as the other devices on your network.  The fourth number can be 2-254, provided that it does not conflict with other devices on your network.  In my case, I set the camera's IP address to 169.101.200.199
      2. Default Gateway
        1. The first three numbers must be the same as the other devices on your network.  The fourth number is a "1".  In my case, I set the camera's default gateway to 169.101.200.1

    3. Services > Enable FTP Server: Off
      1. Enable Samba Server: Off
      2. Enable SSH Server: On

    4. Expert Settings > Enable CSI Camera Led: Off
      1. This setting disables the red light that shines from the RPi camera module and is optional.

    5. Video Device > Camera Name: Christmas Cam (you can name your camera anything you want)
      1. Brightness: 75*
      2. Contrast: 92*
      3. Saturation: 75*

        * Note: If these settings do not appear, your camera may be setup as a MMAL type camera in the latest version of MotionEyeOS.  If you wish to adjust these settings and your camera is the standard RPi camera connected through the CSI port, do the following: Click the Trashcan icon at the top of the configuration page to remove the existing camera, then click the dropdown to reveal "add camera...", then choose "Local V4L2 Camera" for the camera type.  Save your settings, then reboot when prompted.

      4. Video Resolution: 640x480 (for 768Mbps Internet upload speed) or 1280x720 (for >768Mbps Internet speed, tested with 4.5Mbps)
        1. You can set the video resolution higher if you have a fast upload speed on your Internet connection.  640x480 works fine for a 768Kbps upload speed.  It affects the size and sharpness of the video.
      5. Frame Rate: 15 (also update “stream_limit” below if needed), 30 frame rate works better with 4.5Mbps upload speed.
        1. You can set the frame rate higher if you have a fast upload speed on your Internet connection.  It affects the smoothness of the video.
    6. Text Overlay: Off

    7. Make sure that the Text Overlay, Still Images, Movies, and Motion Detection sections are turned off.  Make sure the Video Streaming section is turned on.

    8. Video Streaming > Streaming Frame Rate: 15 (also update “stream_limit” below if needed) (you can set the frame rate higher if you have a fast upload speed on your Internet connection)
      1. Streaming Quality: 18%
        1. This can be increased if you have a fast upload speed (100% is good for 4.5Mbps speeds).  It affects the sharpness of the video.
      2. Streaming Port: 8080
        1. Since Falcon Player and the camera both have web interfaces, setting a different port on the camera allows both interfaces to be available.  Falcon Player is accessed via port 80 while the camera is accessed via port 8080.

  4. The final configuration setting activates a feature that stops the video stream for abusive Internet visitors after 15 minutes.  This prevents visitors from embedding the streaming video on their own pages or leaving the video running too long on their web browsers.

    1. Download and install the PuTTY program on your home computer.  This allows you to access the RPi via a shell (command line) interface.
      1. You don't need to download the entire "package file" file.  Simply download putty.exe

    2. Start PuTTY.  The following screen appears:



    3. The the IP address to the Raspberry Pi into the Host Name field, then click the [Open] button below.

    4. You are prompted for a name and password.  Enter "Admin" for the name and the custom password that you defined in the steps above.

    5. After logging in, type the following command and press [Enter]:

      nano /data/etc/motion.conf



    6. Add the following line to the bottom of the file:

      stream_limit x

      where "x" is the number of frames per second times the number of desired seconds before stopping.  For example, to stop video stream after 15 minutes at 15 fps, replace “x” with 13500.

    7. Press [Ctrl-O] (the letter "O") to save the change, then press [Ctrl-X] to exit the text editor.

    8. Type "exit" at the prompt and press [Enter] to close the PuTTY program.

 

Mounting the RPi into the dummy camera enclosure

There are a number of inexpensive camera enclosures on eBay. These are "dummy security cameras" that fool people into thinking that a real camera is watching them.  These enclosures are perfect for mounting a Raspberry Pi into them.

  1. To start, purchase a camera enclosure like this one:


    I bought mine from eBay.  Try to find this exact type if you can; the following instructions are meant for mounting the Raspberry Pi into this type.

  2. Disassemble the enclosure.  There are four screws on the back cover to do this.  
  3. Remove the fake LEDs in the front of the enclosure.  To mount the Raspberry Pi's camera module into the enclosure, download and print these files with a 3D printer.  
  4. The front of the enclosure (where you mounted) and the main body of the enclosure need slightly extended from each other to support the full size of the RPi.  You can download and print this collar with a 3D printer to do this.



  5. To mount the Raspberry Pi into the enclosure, the top half of the main body contains a fake battery compartment.  I mounted the RPi to a small acrylic board, just wide enough to fit into the enclosure's body.  I the mounted the board to the top half of the main body, with screws from the acrylic board going into the fake battery compartment.  So the RPi is suspended upside down inside the camera enclosure.



  6. To provide power to the RPi, I cut-off the male end of a USB cable, then soldered the red and black wires (power and ground, respectively) to female jumpers. This webpage shows the pinouts for USB connectors.  
  7. I then plugged these jumpers into pin 2 (power) and pin 6 (ground) on the RPi.  



  8. I built a long, 100' extension cable with a male USB connector on one end and a female connector on the other end.  Plug one end of the extension cable into the short cable that you made above, and the other end into a 5.25V USB power adapter like this one.



  9. To provide Internet access to the Raspberry Pi, I ran a 100' Ethernet cable from the RPi to my home's Internet router.
  10. To allow the power cable and Ethernet cable to exit the enclosure, I cut a slot in the back cover of the enclosure, passed the cables through, then sealed the slot with electrical tape.
  11. My camera is affixed to a tree at the end of my yard, pointing to the house.  I buried 100' of 3/4 electrical conduit between the tree and house, then ran the camera's power and network cables through the conduit.



 

Page 3 of 5
Go to top
JSN Boot template designed by JoomlaShine.com