Introduction: Raspberry Pi Home Automation Server

About: thanks

The raspberry pi is an amazing little computer for the price. Now that you have a raspberry pi lets put it to work!

A web-server does not require much computing power or disk space. With a little php and occasional python we can tailor the apache web-server to keep track of an whole array of sensors.

Total Cost $54 (plus 2x5V power supplies):

Raspberry pi model B $25:

Server .img $10

Temp Sensor $15

4 gig sd card: $4


You will need a free gmail account in order to send texts or emails when the sensors trigger. Obtain your account from

Win32DiskImager should be installed on a pc (to write the .img file to a 4gig or larger sd card).

Putty or an equivalent ssh terminal program should be installed on a pc in your network.

A compatible sensor should be ordered from tindie like:

Note: To program a sensor follow this instructable:

Step 1: Theory

  1. The raspberry pi server is connected directly to the router or through a usb wifi adapter.
  2. The router will assign an ip address to the server via dhcp
  3. When the raspberry pi server starts it will create an apache server located at:
    http://192.168.0.X/Paulware where 192.168.0.X is its address assigned by the router
  4. When the raspberry pi server starts it runs /etc/rc.local which runs a python .py which sends a message every 1 minute, broadcasting its udp address on the local network. This broadcast will be read by each sensor and that is how the sensors determine where to send their information to.
  5. You can determine the address assigned by the router by looking at your router page, or by connecting the raspberry pi hdmi socket to a home television, attaching keyboard and mouse to pi and typing the command: ifconfig at the line terminal.

Step 2: Configure the Server

In order to send text or emails when the sensor triggers you need to enter the gmail username and password.

To configure your gmail username and password:

  1. With a browser, open http://192.168.0.X/Paulware/configure.php where 192.168.0.X is assigned by your router
  2. Enter your gmail username and password
    Note: Do not use the "" in the username.

Step 3: Configure Gmail So That the Raspberry Pi Will Be Able to Send Emails.

As explained here:, gmail needs to be configured to allow a python program to send email.

Step 4: Add a Sensor to the System

  1. With a browser, open http://192.168.0.X/Paulware where 192.168.0.X is assigned by your router
  2. Add the MAC address for sensor you purchased from tindie, and you have already programmed using this instructable:
  3. Enter the type of the sensor and the action you want to occur when the sensor triggers.
  4. Test the action to check if the correct action will occur when the sensor triggers.

Step 5: To Make Your Home Server Accessible From the Outside Internet

Go to your router configuration page (which is different for different routers)

Port forward port 80 from 192.16.0.X (assigned by router).

Note: This is an optional step. The server will be able to send emails/texts without this step.

Step 6: Using the Wifi Dongle

If you would rather use a wifi dongle than plug directly into the router, you can follow the ada fruit tutorial on wifi setup.

I usually use putty to get the line terminal they mention in step 2.

Step 7: Make Your Own Sensor.

You can use the init.lua without change.

The sensor.lua should be modified to change the SSID and password to match your local network, and the function readSensor should be modified to read your particular sensor.

The senor.lua file have the sensor wait until the raspberry pi's address is broadcast over udp. When this address is received the sensor will then send its value to the raspberry pi server.

Once your sensor is working, post it at for sale and general review by others.