Print this page

4. Setup an outdoor webcam that allows website visitors to see your house lights as they control them

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.



 

Last modified on Friday, 02 February 2018 02:05