Introduction: Home Automation

About: I'm a journeyman Electrician ,ControlsTechnician,electronics engineer ,I have 4 dogs and a cat and a lust for information and learning

In this Instructable I will be using a couple of Particle Electrons, Raspberry Pi3 as my base electronics.I will add a Basic BOM(Bill of Materials).I am also designing a DIY Security system into this.. as well as simple Heating Control sketch

With this system you will be able to go on Holidays and rest easy that your home is safe and secure.(with no Leaks ) and you will be notified when there is trouble.
Bill Of Materials Description Link on where to Buy Costs
Raspberry Pi0 Basic Micro Computer https://www.adafruit.com/category/813 $10CAD
Particle Photon Micro Controller Http://www.particle.io $19USD
Liquid Flow meter 1/2 NPT Brass Flow meter https://www.adafruit.com/?q=Liquid%20Flow%20Meter& $25.00USD
Solenoid valve 1/2NPT Plastic Solenoid http://www.adafruit.com $25.00USD
Waterproof Boxes buy them anywhere , I bought mine off of amazon http://www.amazon.com $3.00 Each
Security Box buy them anywhere, I bought mine off of amazon http://www.amazon.com $25.00CAD

Step 1: Home Automation System

In this instructable I will demonstrate how to design and build your own Home Automation systems that includes sensors , Relays , Flood sensors ,Water shut offs , Water Flow sensor, and temperature sensors for every room.

Step 2: Different Types of Meters and Boards

The remote Water Flow meter Board that sits on your main intake pipe after the Flow meter and shutoff.I have included a gerber file for this Board.It requires power to operate. either a battery setup can be included in it or regular power from the USB.. I will be using the USB power block as it's easier to design into the Board and Junction Box.

The Remote Water leak Board this sits on the floor of your water closet or mechanical room or even in the bathroom where you might have a leaky toilet..A gerber file is attached

The Remote Relay Board this mounts near the Solenoid shutoff your water or mechanical room or even in the bathroom where you might have a leaky toilet..A gerber file is attached

You might have noticed the sensor boards are all exactly the same in size.I did that on purpose so as to only have 1 box type for all sensors

Step 3: Board Design

For the Main Control Board that sits in the Control Cabinet. I have included a gerber File for the enthusiast that doesn’t want to go through the hassle of doing a total design work up.
I have 3 relays designed into the Board.
1-can be used for an alarm Bell
1-can be used for turning on and off the solenoid
1-can be used for turning heating or Air conditioning on and off.
The Raspberry Pi Zero can be soldered into place in the spots provided to get power from the Board

Step 4: My Special Board

I designed this board for my solar project but it works for just about any Design Challenge you may have ..I'll include a gerber file for this board as it is awesome ..it has dual inputs for voltage..DC and AC up to 30 Volts..Two relays and all inputs are useable ..

Step 5: Special Links

The following are links to Products and programs I used to Design My Boards and have them made.

Products and Links Costs
digikey.com For electronics bits and Pieces Good quality and Low costs free shipping over $100CAD
pcbway.com Electronic board manufacturing Very good quality, Low cost and fast.. 7 day turn around from ordering to my door
fritzing.org Electronic Board Design they also manufacture and solder the boards if your in Europe. Free design Program
Spark fun.com Manufacture of the relays I'm using $2.00 Each
particle.io Web IDE for programming Free
twillio.com SMS messaging service Really cheap
OpenHAB.org Open source Home automation program for Linux, Windows and Mac Open source..Free Cool OpenHAB phone app to Control and monitor
nodered.org Open sourced Included in Raspi Programming
ThingsSpeak.com Analytics site Free for this type of project

Step 6: Bill of Materials

THE FOLLOWING ARE LISTS OF MATERIALS FOR EACH SHIELD


Bill of Materials: Security Panel.fzz
Label Part Type Properties
12VDC Voltage Regulator chip 78005; variant side; voltage 12V; package 78xxl
12VDC OUT Camdenboss CTB0158-4 hole size 2.7mm; variant 90° 4 connector; pins 4; package THT; pin spacing 0.2in (5.08mm); part # CTB0158-4
1K 1KΩ Resistor resistance 1KΩ; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
1K 1KΩ Resistor resistance 1KΩ; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
1K 1KΩ Resistor resistance 1KΩ; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
1K 1KΩ Resistor resistance 1KΩ; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
1K 1KΩ Resistor resistance 1KΩ; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
1K1 1KΩ Resistor resistance 1KΩ; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
3.3VDC OUT Camdenboss CTB0158-4 hole size 2.7mm; variant 90° 4 connector; pins 4; package THT; pin spacing 0.2in (5.08mm); part # CTB0158-4
3A Resettable Fuse PTC variant pth; package ptc
3A Resettable Fuse PTC variant pth; package ptc
3A Resettable Fuse PTC variant pth; package ptc
3A Resettable Fuse PTC variant pth; package ptc
5VDC Voltage Regulator chip 78005; variant side; voltage 5V; package 78xxl
C2 Electrolytic Capacitor voltage 50V; package 200 mil [THT, electrolytic]; capacitance 47µF
C3 Electrolytic Capacitor voltage 50V; package 100 mil [THT, electrolytic]; capacitance 0.1µF
C4 Electrolytic Capacitor voltage 50V; package 100 mil [THT, electrolytic]; capacitance 0.1µF
C5 Electrolytic Capacitor voltage 50V; package 100 mil [THT, electrolytic]; capacitance 0.1µF
D1 Rectifier Diode type Rectifier; package 300 mil [THT]; part # 1N4001
D2 Rectifier Diode type Rectifier; package 300 mil [THT]; part # 1N4001
F4 Resettable Fuse PTC variant pth; package ptc
IC3 IC hole size 1.0mm,0.508mm; chip label IC; pins 6; package DIP (Dual Inline) [THT]; pin spacing 300mil; true
Jumper Generic double row male header - 8 pins hole size 1.0mm,0.508mm; pins 8; form ♂ (male); row double; package THT; pin spacing 0.1in (2.54mm)
Jumper1 Generic double row male header - 6 pins hole size 1.0mm,0.508mm; pins 6; form ♂ (male); row double; package THT; pin spacing 0.1in (2.54mm)
LED1 RGB LED (com. cathode, rgb) pin order rgb; polarity common cathode; rgb RGB; package 5 mm [THT]
Motion ,Analog IN/OUT Camdenboss CTB0158-6 hole size 2.7mm; variant 90° 6 connector; pins 6; package THT; pin spacing 0.2in (5.08mm); part # CTB0158-6
Particle Electron variant variant 5; pins 36; manufacturer Particle; name Electron; version 1.0.0
Power Red (633nm) LED leg yes; color Red (633nm); package 5 mm [THT]
Q2 NPN-Transistor type NPN (EBC); package TO92 [THT]
Q3 NPN-Transistor type NPN (EBC); package TO92 [THT]
Q4 NPN-Transistor type NPN (EBC); package TO92 [THT]
R1 220Ω Resistor resistance 220Ω; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
Relay1 RELAY variant pth4; package relay-jzc
Relay2 RELAY variant pth4; package relay-jzc
Relay3 RELAY variant pth4; package relay-jzc
Relays OUT 250VAC/3A Camdenboss CTB0158-9 hole size 2.7mm; variant 90° 9 connector; pins 9; package THT; pin spacing 0.2in (5.08mm); part # CTB0158-9
SW3 DIP SWITCH channels 1; package dipswitch-02
SW4 DIP SWITCH channels 1; package dipswitch-02
Temp1 DS18B20 1-Wire Temperature Sensor part # DS18B20
Temperature , Digital IN/OUT Camdenboss CTB0158-8 hole size 2.7mm; variant 90° 8 connector; pins 8; package THT; pin spacing 0.2in (5.08mm); part # CTB0158-8
VAC Camdenboss CTB0158-2 hole size 2.7mm; variant 90° 2 connector; pins 2; package THT; pin spacing 0.2in (5.08mm); part # CTB0158-2
VDC Camdenboss CTB0158-2 hole size 2.7mm; variant 90° 2 connector; pins 2; package THT; pin spacing 0.2in (5.08mm); part # CTB0158-2


Bill of Materials: Water Leak Board.fzz
Assembly List

Label Part Type Properties
10K 10KΩ Resistor resistance 10KΩ; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
J1 Screw terminal - 3 pins hole size 1.0mm,0.508mm; pins 3; package THT; pin spacing 0.137in (3.5mm)
Particle Board Electron variant variant 5; pins 36; manufacturer Particle; name Electron; version 1.0.0
Temperature Sensor DS18B20 1-Wire Temperature Sensor part # DS18B20


Bill of Materials: Flow Meter Board.fzz
Label Part Type Properties
10K 10KΩ Resistor resistance 10kΩ; pin spacing 400 mil; package THT; bands 4; tolerance ±5%
10K 10KΩ Resistor resistance 10K0Ω; pin spacing 400 mil; package THT; bands 4; tolerance ±5%
10K 10KΩ Resistor resistance 10KΩ; pin spacing 400 mil; package THT; bands 4; tolerance ±5%
J1 Screw terminal - 3 pins pins 3; pin spacing 0.137in (3.5mm); package THT; hole size 1.0mm,0.508mm
Mosfet MOSFET-NCHANNEL variant pth; package to-92
Particle Board Electron variant variant 5; manufacturer Particle; pins 36; name Electron; version 1.0.0
Temperature Sensor DS18B20 1-Wire Temperature Sensor part # DS18B20


Bill of Materials: Relay Board.fzz
Label Part Type Properties
10K 10KΩ Resistor resistance 10KΩ; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
220ohm 220Ω Resistor resistance 220Ω; bands 4; tolerance ±5%; package THT; pin spacing 400 mil
J1 Screw terminal - 3 pins hole size 1.0mm,0.508mm; pins 3; package THT; pin spacing 0.137in (3.5mm)
Particle Photon Electron variant variant 5; pins 36; manufacturer Particle; name Electron; version 1.0.0
Q2 NPN-Transistor type NPN (EBC); package TO92 [THT]
Temperature Sensor DS18B20 1-Wire Temperature Sensor part # DS18B20
U8 RELAY variant pth4; package relay-jzc

Step 7: Soldering the Board

Soldering the Board.…work your way from the inside to the outside of the Board. briefly touching the pins to be soldered. Don't linger too long as you may melt the pieces above you on the other side of the Board. You just want to wait long enough for the solder to liquefy that you are touching to the iron and the piece pat the same time. If you are not sure what you are doing practice on a blank board with some cheap resistors till your comfortable

Step 8: Securing Your Boards Into Boxes

So now after you've ordered all your Parts and they Have come in ..And you've soldered them.
Let's put them into their Appropriate boxes

Step 9: Installing the Meter and Shutoff

Your Going to need some basic tools for this ..A plumbers Adjustable jaw wrench, A bucket ,Some Teflon Tape ,Basic hand eye coordination ..I've included a pezeo sensor to detect when my water Pressure tank engages telling me if the is water flowing (water flowing drops the pressure of the tank then activates the pump(Well system)

Step 10: Hooking Up Your Boxes

Step 11: Water Leak Box

The Water Leak box is a simple sensor setup using Small 10/32 screws and nuts attached to the Particles +3.3 volt output on the sensor board and the D1 input ..Basic theory ..Water is conductive ..Water will breach the contacts ..Send 3.3 volts to the Particle input waking up the Particle which is in a deep sleep ..It'll send a text and an alert to your phone ..You have to send a message back to the particle using a function ..just type in a 1 and send to put it back to sleep..

Step 12: Testing All Your Devices

Test every device before you power it up with the particle in it

Step 13: The Pezio Sensor

I decided to use a Pezio sensor to sense Flow and actuation of my Pressure switch as I have a well system and wanted to know when the switch was activated.

Step 14: Programming and Testing Your Programs

Programming is relatively easy using the Particle and there is no weird code to fight with ..You will have to use the libraries button in the ide to get everything to work. But there are excellent tutorials around for this.

The Following are clickable links to the Particle IDE Shared Code

https://go.particle.io/shared_apps/59b9c36208187bf... (Security Shield Code )

https://go.particle.io/shared_apps/59bdc307cf7cb97... (Sensor Board Code)

https://go.particle.io/shared_apps/59bdbdaecf7cb95... (Water Meter Code)

https://go.particle.io/shared_apps/59bdc5d0cf7cb9e... (Relay Shield Code)

The Code For Openhab 1.8 for your Raspberry Pi is in the text files above)

A great Tutorial for installing and using openHab is above as well

I decided to use Node_Red as an intermediary between the Particles and the Openhab MQTT protocols..I found it was more stable and didn't need as much babysitting .It come standard in the Raspberry Pi as a program so now downloading of the Node red is required but you need to install the Particle nodes which we will go through here.

For my notification Services I used Twillio..It messages me via SMS when there is an alarm or trouble in my house.(Water leaks , Cold temperatures, Fire or Smoke Alarms, Water flowing for no reason).

A good tutorial is available on the Particle Community Website for using Twillio and on the Twillio website. The Web hooks for both are attached.

Step 15: OpenHab 1.8 Screen Shots