How to Bluetooth control your garden hose

In this tutorial I will show you how you can use a smartphone or tablet with a Arduino board and a Bluetooth module to wirelessly control your garden hose to turn it on or off and also set a timer for the watering time….

 

click on the video below for full tutorial…

 

 

Parts List:

ARDUINO Board

HC-06

Logic LVL converter

H-bridge

LED

Latching Solenoid

 

Schematic:

 

APK ANDROID File:

 

ARDUINO CODE:

#define led 13
#define s1 11
#define s2 12
int timer = 1;
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(s1, OUTPUT);
pinMode(s2, OUTPUT);
digitalWrite(s1, LOW);
digitalWrite(s2, LOW);
}

void loop() {
if (Serial.available() >= 2 )
{
unsigned int a = Serial.read();
unsigned int b = Serial.read();
unsigned int val = (b * 256) + a;

if (val == 100) // turn water on
{
digitalWrite(s1, HIGH);
delay(100);
digitalWrite(s1, LOW);
digitalWrite(led, HIGH);
}

else if (val == 200) // turn water off
{
digitalWrite(s2, HIGH);
delay(100);
digitalWrite(s2, LOW);
digitalWrite(led, LOW);
}

else if (val >= 1 && val <= 60) // watering time
{
timer = val;
}

else if (val == 300) // start watering timer
{
digitalWrite(led, HIGH);
digitalWrite(s1, HIGH);
delay(100);
digitalWrite(s1, LOW);
delay(timer * 60000);
digitalWrite(led, LOW);
digitalWrite(s2, HIGH);
delay(100);
digitalWrite(s2, LOW);

}
}
}

Advertisements