Skip to main content

*WINNING ENTRY* Leak killer Design Challenge

In this Design Challenge, I will be using a couple of Particle Electrons and Raspberry Pi 3 as my base electronics. I will add a Basic BOM (Bill of Materials). I am also designing a DIY Open Source Security system into the Challenge as well as simple Heating Control sketch.

With this system, you will be able to go on holiday and rest easy that your home is safe and secure (with no leaks).

Bill Of Materials

Description

Bought From

Costs

Raspberry Pi Zero

Basic Micro Computer

Adafruit

$10 CAD

Particle Photon

Micro Controller

Particle

$19 USD

Liquid Flowmeter

1/2 NPT Brass Flow meter

Adafruit

 

$25 USD

Solenoid valve

1/2NPT Plastic Solenoid

Adafruit

$25 USD

Waterproof Boxes

Buy them anywhere, I bought mine from Amazon

Amazon

$3 USD Each

Security Box

Buy them anywhere, I bought mine from Amazon

Amazon

$25 CAD

 

That's the expensive stuff

The following are the products and programs I used to design my boards and have them made:

Products

Description

Costs

Comments

Sparkfun.com

Manufacturer 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 source

Included in Raspi Programming

 

ThingsSpeak.com

Analytics site

Free for this type of project

 

 

The Board Designs

Main Control Board

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 as 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.

1_IoT_Relay_Shield_75fd532fa767e5f44fc2f6da38244a058d78205e.jpg IoT Relay Shield

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 at the same time. If you are not sure what you are doing, practice on a blank board with some cheap resistors until you’re comfortable.

 

Water Flow Meter Board

2_Flow_Meter_Board_bf82930c8a8a6801decd05a93cfa625ada77cb30.jpg 

 

 

 

 

 

 

 

 

Flow Meter Board

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 as well. 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.

Water Leak Board

3_Water_Leak_Board_fb6508b64502101269ccda8fa7cac511f0a36731.jpg

 

 

 

 

 

 

 

 

 

Water Leak Board

The Remote Water Leak Board 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 for this one as well.

Sensor Board

4_Sensor_Board_b4c6f432d2f2760f0a3a1b9147bbfcc8cc683b41.jpg

Sensor Board

The Sensor Board is for the piezo sensor and any other sensors you want to implement, including motion detection.

 

Relay Board

5_Particle_Photon_Relay_Board_8022e3d5a1b81b431dd89e231dfa5ac1f34d3b55.jpg

 

Particle Photon Relay Board

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 for this one as well.

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

Penteon IO Board

6_Penteon_io_Board_7fe356c16357ae6d6044bb930d6bccbec26d9656.jpg

Penteon IO Board

This is the flagship of my board collection. It has dual voltage AC or DC inputs up to 30VDC. Two relays and all inputs and outputs present. It’s a little larger but great for the flow and solenoid valve and sensors.

 

Bills of materials for each individual shield

 

Security Panel BOM

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

 

Water Leak Board BOM

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

 

Flow Meter Board BOM

Label

Part Type

Properties

10K

10KΩ Resistor

resistance 220Ω; pin spacing 400 mil; package THT; bands 4; tolerance ±5%

10K

10KΩ Resistor

resistance 220Ω; pin spacing 400 mil; package THT; bands 4; tolerance ±5%

10K

10KΩ Resistor

resistance 220Ω; 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

 

Relay Board BOM

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

 

So now, after you've ordered all your parts, they have come in and you’ve soldered them. Let’s put them in their boxes and power them up.

The following pages are dedicated to building your boxes and programming the shut-off valve and flow meter.

Building the boxes

7_photo1_76b17a3dfc6530cae8e18a12b0014b2115974d94.jpg 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8_photo21_d7423d9723185268147022f529d57d59639ca981.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

9_Photo3_e83dab595f4ea50589b6f9a2b5406706daac2ffd.jpg

 

10_Photo4_2b76dea1571a929efce0825edf507046b30cdddf.jpg

 

 

The Boards

Soldered sensor boards

 11_Soldered_Sensor_Board_1_7e985ab1d7f2d8364bc30e6bc86bffeeacfa15ec.jpg

 

11_Soldered_Sensor_Board_21_8599c809392e104638e7d4c17b497be7e71f3102.jpg

 

11_Soldered_Sensor_Board_3_76203531d9b76f71269890cff1401346d9a0d79a.jpg

 

11_Soldered_Sensor_Board_4_952b0b143bec6935bb59607e64568f748d092604.jpg

 

12_Assembled_c317a43c5e81d755a2998ca128739d7bf6201ab6.jpg

 

 

Special Design Considerations

 13_Special_Design_Considerations_1_e07d05b14118ecd0c7ab6d4a8c3f47c2bb205a54.jpg

The Piezo vibration sensor was implemented for the non-penetration water flow part of the design challenge. I wanted to have the Piezo sensor detect vibration from the flowing water. To do that I designed a simple mechanical vibration magnification system which would amplify the vibrations of flowing water to readable levels. It will pick up environmental vibrations as well, such as people walking across floors, earthquakes, heavy construction nearby etc.

14_Figure_1_4bc16e57974484834c7bbaec0ceb268ef0a73198.jpg

 

 

 

 

 

 

 

 

 

Figure 1

Fitting the boards into the boxes and wiring them up

I started by soldering longer wires to the flow meter to accommodate better placement.

15_soldering_11_71215ac2f5b388e7803aa309ff2ba1bad31973eb.jpg

 

15_soldering_2_061bd293300bc917cc84b099251ebf9263c0f6ab.jpg

 

15_soldering_3_6215051508d96e1918b89a8af7842fec8abd0538.jpg

 

The first box soldered up

Remember to test all your devices for faults and grounds before you plug your powered-up device into it!

16_Testing_1_cb90fd12e7a55d8bcaef2223ff00868ef9d8d63d.jpg

 

16_Testing_2_5deccee50c0302a44ae418230ceb0f3e96c9b591.jpg

 

16_Testing_3_36a5fbfa95a0bea3208b80a240e583a22973ddc6.jpg

 

17_Analytics_1_aca3fc6aef391fc97df9d5e61119cc844cc567b9.jpg

 

17_Analytics_2_8db6ee41ccb28267dea28b0a80f63731fac42871.jpg

 

 

The Particle Program for the Vibration Sensor (Particle IDE)

// This #include statement was automatically added by the Particle IDE.

#include <OneWire.h>

#include "DS18.h"

const int MOTION_TIMEOUT = 5000UL;

const int ledPin = D7;

const int MOTION_TIMEOUT1 = 5000UL;

DS18 sensor(D0);

unsigned long oldTime;

volatile unsigned int WaterPulseCount = 0;

const float pulsesPerLiter = 485;

const float pulsesPerLiter1 = 485;

#define WATER_SENSOR_PIN A1

#define WATER_SENSOR_PIN1 D2

float input_voltage = 0.0;

double VRaw;

float Vib =0;

float VibS =0;

float liters = 0;

char liters_S[6];

char freq[6];

int PezioPulseCount=0;

//

int PezioPulseCount1=0;

void WaterPulseCounter(void)

{

WaterPulseCount++;

}

void PezioPulseCounter(void)

{

PezioPulseCount++;

}

void setup()

{

Serial.begin(9600);

Particle.variable("Vib", freq, STRING);

Particle.variable("litersS", liters_S, STRING);

pinMode(WATER_SENSOR_PIN, INPUT);

attachInterrupt(WATER_SENSOR_PIN, WaterPulseCounter, FALLING) ;

oldTime = millis();

}
void loop() {

char message[120];

String data = String (20);

if (sensor.read()) {

Serial.printf("Temperature %.2f C %.2f F ", sensor.celsius(), sensor.fahrenheit());

Particle.publish("Underside_Temperature", String(sensor.celsius()), PRIVATE);//You can adjust

("Temperature") to say what you want

delay(2500);

}

else {

if (sensor.searchDone()) {

Serial.println("No more addresses.");

} else {

}

}

unsigned long t;

static unsigned int pc;

t = (millis() - oldTime);

if(t >= 1000) {

//Read water sensor pulse count and process

if (WaterPulseCount != 0) // Do nothing if water is not flowing!

{

detachInterrupt (WATER_SENSOR_PIN);

liters = (WaterPulseCount / pulsesPerLiter) * (t / 100);

oldTime = millis();

pc = WaterPulseCount;

WaterPulseCount = 0;

attachInterrupt(WATER_SENSOR_PIN, WaterPulseCounter, FALLING);

sprintf(liters_S, "%4.3f", liters);

Particle.publish("Vibration_Level",liters_S,60,PRIVATE);

}

}

}

 

Testing the Program

Flash the Particle and flick the sensor a few times to see if it appears on the Particle screen.

 

Vibration Test using Librato

18_Vibration_Test_using_Librato_595aff0813458a379ffefa04c41812ba779dd8d5.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Water Vibration Sensor Box

 19_Water_vibration_sensor_box_1_e74369c34f46ab7d58481b0a5fb1fd9ae5d57c07.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Micro Vibration Sensor $7.00CAD

Sensor Shield with Power input without the Particle. Up to 20VDC Integral Temperature Sensor, Analog and Digital inputs.

Costs:

  • Board $2
  • Voltage Regulator $5
  • Power input $2
  • Temperature Sensor $11
  • 4 pin Screw Connector $2
  • Vibration Sensor $7
  • Particle $19
  • 18 Pin female headers $2

Total for Water Leak Sensor $49 CAD

The Battery Version is slightly more expensive but still within budget. The sketch differs a bit in that the Particle will sleep until there is an event… Then go back to sleep.

19_Water_vibration_sensor_box_2_a95f3eac6e44dade918801ea263f3b5b3d4409ec.jpg

Costs:

  • Board $2
  • Voltage Regulator $5
  • Power input $2
  • Temperature Sensor $11
  • 4 pin Screw Connector $2
  • Vibration Sensor $7
  • Particle $69
  • 18 Pin female headers $2

Total for Water Leak Sensor $110 CAD

 

Particle Sensor Shield Powering up

Real analytics of vibration sensor mounted on water pipe:

 20_Water_Meter_Analytics_e35d8dabc74493744b0159e84bf803a11cd58101.jpg

 

 20_connected_parts_1a7f9ecf170fcd3d815b59a5205577ec380cabf2.jpg

 

 20_connected_parts_2_d1d2f8e9c93e3589ba7aeaed34a4ce57c2e2d8dc.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Water Leak Sensor

Building the sensor box was relatively easy using small 10/32 bolts and nuts along with some stakeons. I made the box to sense small amounts of water. The following pictures show how it was built.

21_Water_Leak_Sensor_1_a7936d41a44a33f2aa7acd052bb9b9ae528e777e.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The sensors on the box bottom

21_Water_Leak_Sensor_2_ee1ca33b6e8e4533d7476f241f455ae8e87cd5cb.jpg

 

The completed box

21_Water_Leak_Sensor_3_9bda9ce666a8c759b137d75164c504c775f54376.jpg

 

21_Water_Leak_Sensor_4_9db139952857f425a134ff42c672d9360b4bf9a3.jpg

 

Box sleeping and ready to transmit trouble

 

Alert Video

 

Security Shield and Program

The Security Shield is a basic design with up to 24VAC or 24VDC power input capability with

12VDC and 3.3VDC outputs and inputs to various devices. This unit is supplying power to four security PIRs, a battery and the water shut off solenoid under the house.

22_Security_Shield_and_Program_1_3ad5ca997834bbe59e33a60e5d11f2dcdece015e.jpg

 

Security Shield with Raspberry Pi Zero mounted on it. The Pi is powered by the security shield. Its main function is to run the OpenHAB program and the Node-Red Program.

22_openhab_85e006c872a6487d1c111c0f0458e4d47a8b2e30.jpg

 

 

 

 

It's handy to have them both powered but the shield space is limited in a control cabinet.

 

Screenshots of OpenHAB Program running on an IPad:

22_openhab_2_925eb3b1f19b792a39e8d64b188f79c6898624f2.jpg

 

 

22_openhab_3_c791cc7ba012eb8ab332b23a7e6b0ed2c2853247.jpg

 

 

Links to tutorials for installing and running OpenHAB:

23_Links_1_1f8002eef7f230c8284ccbf8462fec5afc800a1a.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

23_Links_2_1fa591d3a84b5050793b8f8ae93aac13e3a19e67.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Node-Red

23_Links_3_e46f9a5d9732711b68f80c4e30e6fe0b173b191d.jpg

 

Node-Red is a simple intermediary between OpenHAB and the Particle Publish web cloud. This enables Particle and the Raspberry Pi Zero to do their work without using MQTT in the

Sketch, which I found was a little buggy at times. Both are programmed to start after reboot so it is self-starting following a reboot.

 

 Thank you for considering my designs.

Downloads

I am a ticketed Electrician In Canada , I work designing shields for IOT and sensing equipment for Penteon Corporation, I also dabble in Linux programming, C++ and electronics https://www.hackster.io/Jade7272 https://www.linkedin.com/in/jade-perreault-0a396722/