Introduction: Raspberry Pi + WebCam + IR Remote Home Controller

WebCam + IR Remote Home Controller

Harware :

1. HomeWebCam

2. IR Remote Control

3. Raspberry Pi

How to Make ?

See Above Photos

How it works ?

  • Use your Home WemCam Software to control and View.
  • When the Laser Pointer point to Device, Remote to ON and Off by WebIOPi




More Information : iMediaBank - http://www.imediabank.com

Step 1:

IR Remote

Hardware

Parts

  • Infrared LED: Home TV remote
  • IR Receiver: A3H3 and A3I3
  • NPN Transistor: B29X 9014
  • 1.5Ω Resistor: 1
  • 220Ω Resistor: 1

Terminal Install :

  • $ sudo apt-get install lirc

For start after boot (Modify /etc/modules):

  • lirc_dev
  • lirc_rpi gpio_in_pin=23 gpio_out_pin=22

For test only:

  • sudo modprobe lirc_dev
  • sudo modprobe lirc_rpi gpio_in_pin=23 gpio_out_pin=22

Modify /etc/lirc/hardware.conf

######################################################## 

# /etc/lirc/hardware.conf #

# Arguments which will be used when launching lircd 

LIRCD_ARGS="--uinput"
# Don't start lircmd even if there seems to be a good config file
# START_LIRCMD=false
# Don't start irexec, even if a good config file seems to exist.
# START_IREXEC=false
# Try to load appropriate kernel modules
LOAD_MODULES=true
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""
######################################################## 

Start and Stop lirc

  • sudo /etc/init.d/lirc stop
  • sudo /etc/init.d/lirc start

Testing

  • sudo /etc/init.d/lirc stop
  • mode2 -d /dev/lirc0

  • result :

space 16300
pulse 95
space 28794
pulse 80
space 19395
pulse 83
space 402351
pulse 135
space 7085
pulse 85
space 2903

Create a new remote map

Check Key List name $ irrecord --list-namespace

# Stop lircd so /dev/lirc0 is not in use
sudo /etc/init.d/lirc stop
# Create a new remote control configuration file (using /dev/lirc0) and save the output to ~/lircd.conf
irrecord -d /dev/lirc0 ~/lircd.conf
# Edit ~/lircd.conf and add edit the name of the controlled device
nano ~/lircd.conf
# Make a backup of the original lircd.conf file
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf
# Copy over your new configuration file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf
# Start up lirc again
sudo /etc/init.d/lirc start

TEST

# List all of the commands that LIRC knows for 'samsung_tv'

irsend LIST samsung_tv ""
# Send the KEY_POWER command once
irsend SEND_ONCE samsung_tv KEY_POWER
# Send the KEY_VOLUMEDOWN command once
irsend SEND_ONCE samsung_tv KEY_VOLUMEDOWN
# Send the KEY_VOLUMEDOWN command 10 times lowering the volume for 10 units at once
irsend --count=10 samsung_tv KEY_VOLUMEDOWN

Step 2: WebIPOi

Main Page : https://code.google.com/p/webiopi/

  • WebIOPi is a very useful for developer to control GPIO from web page by python.

Installation

WebIOPi is developed and tested on Raspbian. You only need Python, either 2.7 or 3.2. Download, then extract and install WebIOPi. The setup script will automatically download and install required dependencies using apt-get. You may have to manually install GCC and Python development headers if you are not using Raspbian.

Update note: Stop your existing WebIOPi service, then process with the setup. Your configuration will be kept but others files will be override.

See downloads page to get latest package, and adapt x.y.z with the version you download.

$ tar xvzf WebIOPi-x.y.z.tar.gz
$ cd 
$ cd WebIOPi-x.y.z
$ sudo 
$ sudo ./setup.sh 

Setup may take a moment.

Running WebIOPi

Finally, use webiopi command :

$ sudo webiopi [-h] [-c config] [-l log] [-s script] [-d] [port]
    Options:
      -h, --help           Display this help
      
      -c, --config  file   Load config from file
      
      -l, --log     file   Log to file
      
      -s, --script  file   Load script from file
      
      -d, --debug          Enable DEBUG
    Arguments:
      port                 Port to bind the HTTP Server 

For instance, to start with verbose output and the default config file :

$ sudo webiopi -d -c /etc/webiopi/config 

You're done, and ready to enjoy WebIOPi ! But the server and GPIO state will be lost when you'll stop the script (CTRL-C) or close the terminal.

Running WebIOPi (Daemon)

You can also start/stop the background service, the configuration will be loaded from /etc/webiopi/config.

$ sudo /etc/init.d/webiopi start
$ sudo /etc/init.d/webiopi stop

Auto start at boot

To setup your system to start webiopi at boot :

$ sudo update-rc.d webiopi defaults

To remove webiopi start from boot :

$ sudo update-rc.d webiopi remove 

Usage

If your are directly using your Raspberry Pi with keyboard/mouse/display plugged, open a browser to http://localhost:8000/

If your Raspberry Pi is connected to your network, you can open a browser to http://raspberrypi:8000/ with any device of your network. Replace raspberrypi by its IP.

Contents 1 WebIOPi2 Installation3 Running WebIOPi4 Running WebIOPi (Daemon)5 Auto start at boot6 Usage7 Reference

SANKI Device 2-Axis Joystick ADXL3453-axis accelerometer Analogue Sensors Arduino Button Camera DS1307 (Clock) DVK511 EEPROM Heartbeat Sensor Home Remote + Server IR Remote LCD1602/2004 LED ( Simple ) LED / Matrix - 74HC595 LED Light-Emitting Diode Matrix LED 8x8 + Max7219 NE555 Nokia5110 NRF24L01 Photoresistor PIR Sensor PL2303 PWM Dim Control RFID-RC522 RTC-DS1307 Clock + EEPROM AT24C32 Stepper Motor Ultrasonic

Reference https://code.google.com/p/webiopi/