Smart Home Connected Shed

This project started out as a way of improving the security of our shed. It quickly morphed into a fully connected extension of our smart home out into our garden using a Raspberry Pi as a slave processor, as part of our Home Control System (HCS).

We took this approach because we had a large number of sensors and devices that we wanted to integrate into our smart home, many of them within or with close proximity to our shed. The approach we have taken means we can integrate and control many devices for a modest outlay. It also ensure that they all remain under full control of our smart home and gain all of the common capabilities it currently provides, including voice control, powerful scheduling, etc.


We have already installed a double mains outlet in our shed. We also have a 12V dc power feed from our 12V UPS.


For this project we have run four Cat5e Ethernet cables down the inside of our house wall and into our shed (which sits up against the side of our house). These are connected to a 24-port Gigabit switch.

All cables are ducted and sit within 40mm × 25mm trunking.


The Raspberry Pi is very extensible in terms of sensors that can be connected directly to it. The number of physical GPIO pins is not really a limiting factor as we will show with this project.

The sensors currently connected are:

Digital Inputs

  • I1 = Shed Path PIR - outside shed
  • I2 = Rainwater Harvesting
  • I3 = Rain Sensor
  • I4 = Shed Door
  • I5 = Shed Light Sensor

Analogue Inputs

  • A0 = Outside Humidity
  • A1 = Shed Battery Voltage
  • A2 = Shed Voltage
  • A3 = Shed Solar Charge

Dallas 1-Wire

  • Outside Temperature
  • Shed Temperature
  • Ground Temperature

Digital Input Expansion

To provide extra input capability we are using the MCP23017 I2C IC (datasheet) to provide an additional 16 digital inputs.

Digital Outputs

Prototype output board
For this project we created a prototype digital output board on Veroboard to start with. This is using the 5 spare pins exposed by our Raspberry Pi Header Board. The first three are not used as these are used for I2C and 1-wire. This is an early prototype of our High Power Output Board, which has eight high-current output channels at 12Vdc.

OP4 Heartbeat LED

This is a red LED on the outside of our shed which serves two purposes. Firstly, it flashes and acts as a visible deterrent. Secondly, it is a visible RPi heartbeat that can be seen from our conservatory. If it is not flashing, then we know something has gone wrong. This is in addition to the watchdog capability deployed though.

OP5 Shed Path Light

The 'Shed Path Light' is activated by both the 'Shed PIR' and 'Shed Door', both of which extend the time the light is on for (both open and close). The 'Shed Path Light' is also a modelled object and so it can be addressed and controlled by our smart home.

Shed Path Light
The 'Shed Path Light' is only turned on when the 'Shed Light Level' is below a certain threshold. It is a fast reacting LED waterproof lamp which kicks out a lot of light. It provides enough light for the Raspberry Pi camera module to take good quality photographs in all conditions.

OP6 Front Garden Lights

The 'Front Garden Lights' are a series of three decorative LED lights mounted in glass 'cracked' spheres. These are mainly decorative in purpose but also provide low-level lighting to see where you are going near our front door. They prove really useful late at night when the street lights have been switched off and for this reason we tend to leave them on until 2am in the morning.

They are controlled by our software controller and come on at dusk/sunset.

OP7 Garden Lights

More on our garden lights.

OP8 Patio Lights

Patio lights
We had already provided a 12V dc power feed for these (and other) lights around our garden. These are simply connected up to our output board and modelled as an object called 'Patio Lights'.


Rain Sensor


Rain Water Harvesting

This is achieved using our generic moisture & flood sensor board. The inputs are connected to two 5mm stainless steel bolts mounted in the tubing connecting the guttering to our water butts. When the flow is sufficient, the rain water triggers the sensor, which is connected to an input pin. The input is pulled to ground via a 1kΩ resistor, which is used to protect the pin. The sensor is housed in a small waterproof case.

In theory, we could install a connected flow meter in-line and this is something we will look at later. For now we are happy that our smart home knows we are harvesting rainwater.

Shed Light Sensor

This is a very simple circuit using an LDR (Light Dependent Resistor) and a few resistors to drive an opto-isolator input on our optically isolated input board. This provides a local (binary) view of light level outside our shed, removing the need for an analogue sensor. This is not directly reported back to our Home Control System (HCS) but is used by the Shed slave processor to make local decisions, with actions that are reported.

Testing showed some oscillation during change of state but we used the Pi4J setDebounce method to minimise this. It's not really an issue though as the pin state is checked each time a decision is used to turn on a light.

Shed Path PIR

Outdoor PIR
The external PIR sensor used is a cheap, waterproof PIR sensor bought from eBay. It has a light-level sensor which we deactivate (to ensure they pick up movement during the day) and also has a built in timer (which we set to minimum). These also use a 12V dc power source and provides a 12V output.


We are using an older Raspberry Pi model B with a standard 5Mpixel RPi camera module. We have switched off the camera LED, to avoid reflections and it being visible at night.

RPi B header board
We are using the original version of the header board we designed for the model B Raspberry Pi. On later versions of the Raspberry Pi we use our new version.

Optically isolated input board
The headers expose a 'standard' 10-way connector for use with our optically isolated input board, which we use in many smart home projects.


As with most of our Home Control System (HCS), this project is implemented in Java.

RPi Camera

We have written some Java classes to wrap the RPi camera module functionality. This is common code used across many projects and handles things like queuing requests to take capture still images and video clips, capturing at various resolutions, performance monitoring, etc.


We have common code for sending heartbeats and a watchdog service. The watchdog service also handles reporting of warnings and errors.


When starting a project like this, start with the basics. We installed power and networking before we did anything else.


This is a widget showing what was recently tweeted by our smart home and this includes things covered by this project:

Share ...
We are on ...
Facebook Twitter
YouTube Flickr Follow us on Pinterest
Buy It Now