Three Cool Projects You Can Do On Your Arduino Uno: Home Automation, Handwash Timers & Automatic Plant Irrigation

Author: Darhan Saami

What is an Arduino Uno?

Arduino Uno is the best gadget to get started with programming or developing your systems based on your wants and needs. You can use it to customize many systems according to your likeability. Arduino Uno is one of the most commonly used Arduino devices. Therefore, you can find multiple tutorials on the internet to do what you want to do, making it so suitable for people who are just beginning. Arduino Uno has 14 input and output pins that serve multiple purposes. Such a wide variety indicates its flexibility in terms of the ways one can use an Arduino Uno. Simply put, it is an affordable device that can do anything you want it to do. In this article, we will look at three exciting projects you can do using Arduino Uno, which you can get from Amazon for <$23.

Home Automation System

Everyone has a smartphone on their hands these days. How easy would it be if you can control your home’s electrical appliances through your smartphone? 

What do you need? 

  • Arduino Uno
  • Bluetooth Module HC-05
  • Grove – 4 Channel SPDT Relay4
  • Home Automation Android APK
  • Arduino IDE Software

How to set up?

This system relies on Bluetooth commands sent to the Arduino receiver. The Bluetooth module in use is HC-05. It supports master and slave mode serial communication, making it able to communicate with Bluetooth-enabled devices such as phones and computers. 

Next, you need to use a relay. We have used Grove – 4 Channel SPDT Relay for this project. A relay allows you to turn a circuit on or off using current and voltage. This relay helps us separate the low-voltage circuit of Arduino and the high-voltage side controlling our project load.

Next up, we need to connect our Arduino Uno to the Bluetooth module and relay board. In this home automation project circuit, Pins 10 and 11 of Arduino connect to pins T(XD) and R(XD) of the Bluetooth module, respectively.

Pins Gnd and Vcc of the Bluetooth module are inserted into Gnd and +3.3V of Arduino board, respectively. Pins 2, 3, and 4 are connected to the relay board’s three relays (RL1, RL2, and RL3). Pins Vin and Gnd of the relay board are connected to pins Vin and Gnd of Arduino board.

Arduino Uno is programmed using the Arduino developed IDE software that you can download from arduino.cc. You need to download this application on your smart device. After you have switched the power on, pair your device with Arduino Bluetooth using the code ‘1234’. You are now all set to control your home appliances using your smart device. 

(Source and full tutorial here: https://www.electronicsforu.com/electronics-projects/hardware-diy/arduino-home-automation-system-android)

Coronavirus Handwash Timer

The world is trying to prevent the spread of coronavirus pandemic for the last year. One of the ways we can do this is by washing our hands regularly for at least 20 seconds. Most people do not wash their hands for enough time; therefore, it leaves some germs remaining on their hands, one of the major contamination sources. This simple time counts time from the moment soap is dispensed onto your hands and then lets you know when you can rinse your hands with water again. 

This system uses ultrasonic waves and sensors to detect hands’ movement and then sets a timer for 20 seconds. After 20 seconds have passed, it displays a green LED, which signals that you have washed hands for enough time now. 

What do you need? 

  • Arduino Uno
  • An ultrasonic distance sensor
  • Red and green LEDs (6)

How to set it up?

All you need to do is set up your Arduino and connect it to the ultrasonic sensor and the LEDs. We recommend you use jumper wires to connect everything. Be sure to connect the longer pins into Arduino digital pins and the shorter ones into Arduino ground pins. Once you have done this, you need to open the IDE on your Arduino and upload the following code:

Code for hand wash timer. Developed by The Tech Lab
Copyright (C) 2020 The Tech Lab

int echoPin = 11;
int trigPin = 12;
long duration;
int distance;

void setup() {
  for (int i = 2; i <= 7; i++) {
    pinMode (i, OUTPUT);
  }
  pinMode (trigPin, OUTPUT);
  pinMode (echoPin, INPUT);
}
void loop() {
  // This part of the code tells the sensor to measure distance and reads the measured data
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration * .0343) / 2;

  // This "If Statement" detects if there is any object within 30 centimeters
  if (distance > 0 && distance <= 30) {
    ledtimer();
  }
}

void ledtimer() {
  digitalWrite (7, HIGH);
  delay(4000);
  for (int i = 6; i >= 2; i--) {
    digitalWrite (i, HIGH);
    if (i == 2) {
      digitalWrite (7, LOW);
    }
    delay(4000);
  }
  for (int i = 7; i >= 2; i--) {
    digitalWrite (i, LOW);

  }
}

Now try running the code and see if the timer works. In case it does not work, check if you have made a mistake while connecting Arduino Uno to LED and ultrasonic sensors. After you have completed all of these steps, it is time to make an enclosure for your setup, and Bob’s the uncle! The enclosure is critical as this system will be working in a wet environment. Therefore, to save its circuitries, it is preferred to close it up. 

(Source and full tutorial here: https://create.arduino.cc/projecthub/the-tech-lab/fight-coronavirus-simple-handwash-timer-4dc8ac?ref=tag&ref_id=beginner&offset=5 )

Automated Plant Watering System

This system helps you water your plants regularly without forgetting and without moving a muscle. This system can also come in handy if you are going away on vacation for a while. This system requires some physical effort to set it up, but it is easier than it looks. The essential things you need are a box containing an appropriate volume of water, an Arduino Uno microcontroller that manages time handling, and a relay to turn it on and off at the right time. 

What do you need?

  • Arduino Uno
  • Nylon tubing 
  • The right light bulbs for plants (x2)
  • Light fixture (x2)
  • Relay PCB
  • LCD screen
  • Wire
  • A tub to store water
  • Maple Plywood

The total cost of your required materials should sum up to around $80.

How to set it up?

The first and most obvious step is to build a box for this system. The size of this box can vary according to the size of your plants. Building a box is very easy, and you can easily find a tutorial about it on YouTube. A critical piece of information to note is that you should build your box from a material tolerant to water exposure. 

For this system’s electrical circuit, you will require a relay to turn it on and off. This relay essentially completes the circuit. In simple terms, the relay is connected to 120V of power supply. So when the relay is closed, the power supply is passed, and the pump starts working. It is important to mount the power source, and relay above the flood zone in the box in case water starts leaking. Once you have mounted them up, it is time to connect your Arduino Uno to it. 
Once you have connected your Arduino to the relay, you can finally start working on the programming aspect of it. In this system, the Arduino microcontroller’s purpose is to run the system according to the code you desire. You can use any IDE to run the code for the system. Below, we have provided a pre-written code to run the system; however, you can manipulate it easily to time watering of plants according to your requirement. 

/*Clock with local remote time programming.
Standard alarm clock with relay triggering on A0-A3

*/

#include<Time.h>
#include<TimeAlarms.h>
#include<LiquidCrystal.h>

int x = 0;

long previousMillis = 0;
long intervalIdle = 300;
int LCDalarm=0;

LiquidCrystal lcd (12, 11, 5,4,3,2);

const int relayPinA0=A0; //Logic low triggers relay
const int relayPinA1=A1;
const int relayPinA2=A2;
const int relayPinA3=A3;
int potPin1 =A4;
int potPin2 =A5;

const int relayOverride = 0;
const int alarm1EnablePin = 1 ;

const int minutePin = 6;
const int hourPin =7;
const int timeSetButton = 8;
int buzzer = 9; // pin to connect PEZIO transducder (not a speaker!)
const int alarmLED = 13 ;   
const int alarm1SetButton = 10;
int pumpDuration = 0;
int dayInterval =1; //used for testing only

unsigned char delayms = 250; // delay between beep sounds (makes buzzer)

int minutePushCounter =0;
int minuteState= 0;
int lastminuteState = 0;

int hourPushCounter =0;
int hourState= 0;
int lasthourState = 0;

int setButtonState = 0;

int alarmHRPushCounter =1;
int alarmMinPushCounter =1;

int alarmHR = 0;
int alarmHRState = 0;
int lastalarmHRState = 0;

int alarmMin = 0;
int alarmMinState = 0;
int lastalarmMinState = 0;

//=========================== arrays to build custom font segments=======================

byte water[8] ={
B01110, B00100, 
B10100, B11110, B11111, 
B10001, B00000, B00001};

byte calendar[8] ={  
B01010, B11111, 
B11111, B10001, B10001, 
B10001, B10001, B11111};

 int dayoftheweek = 1 ;

void setup() {
  lcd.begin(20,4);
  
  setTime(12,00,05,5,9,1999); //power on time (HH,MM,SS,Day, Month, Year) 
  
 pinMode(minutePin, INPUT_PULLUP);
 pinMode(hourPin, INPUT_PULLUP);
 pinMode(timeSetButton, INPUT_PULLUP);
 pinMode(alarm1SetButton, INPUT_PULLUP);
 pinMode(alarm1EnablePin, INPUT_PULLUP);

 pinMode(alarmLED, OUTPUT);
 pinMode(relayOverride, INPUT_PULLUP);

 pinMode(relayPinA0, OUTPUT);
 pinMode(relayPinA1, OUTPUT);
 pinMode(relayPinA2, OUTPUT);
 pinMode(relayPinA3, OUTPUT);
  
 lcd.createChar(1,water);
 lcd.createChar(2,calendar);

}

//==================Basic Clock Protocals===========================

void loop() {
 //read the voltage at the potentiometer convert to 0-1023
  
  digitalClockDisplay();
  minute_reset59();
  hour_reset24();
  setAlarmHR_Min();
  setTime_Hour_Minute();
  AmPm();
  
 lcd.setCursor(0,3); lcd.write(1); lcd.print(" every "); printDigits(dayInterval); lcd.setCursor(10,3); lcd.print(" days");
 lcd.setCursor(17,3); lcd.write(2); lcd.setCursor(18,3); printDigits(day());
 if (second()==59){lcd.clear(); }

//=============Day Alarm================

/*
 if (digitalRead(alarm1EnablePin)==LOW) { //default code. incase this code gets wrecked
     alarm();  
} */

 if (digitalRead(alarm1EnablePin)==LOW) { 
   lcd.setCursor(1,1); lcd.print("=ACTIVE");
    if (day()%dayInterval==0)
     alarm();  
}
     
  else{
     lcd.setCursor(1,1); lcd.print("=off ");
     
     digitalWrite(relayPinA0,LOW); digitalWrite(relayPinA1,LOW);
     digitalWrite(relayPinA2,LOW); digitalWrite(relayPinA3,LOW);
     digitalWrite(alarmLED,LOW);
       }


      //--------------------RELAY OFF Toggles-----------------------------------------
  if (hour()== alarmHRPushCounter && minute()==alarmMinPushCounter && second()==pumpDuration/29) //relay turns off after 1 minutes from alarm set time
  {
    digitalWrite(relayPinA0,LOW); delay(200);
    digitalWrite(relayPinA1,LOW); delay(200);
    digitalWrite(relayPinA2,LOW); delay(200);
    digitalWrite(relayPinA3,LOW);  
   }
  
  //-----------RELAY OverRide Toggles-----------------------------------------
  if (digitalRead(relayOverride)==LOW && digitalRead(alarm1EnablePin)==LOW)
{ lcd.setCursor(15,1); lcd.print("OvrR"); //Relay override will only activate is Alarm Enable is also active
    digitalWrite(relayPinA0,HIGH); delay(200);
    digitalWrite(relayPinA1,HIGH); delay(200);
    digitalWrite(relayPinA2,HIGH); delay(200);
    digitalWrite(relayPinA3,HIGH); }
   }


//=========Begin Clock Subroutine Section=======================================================================================

 void setAlarmHR_Min() {
 while 
(digitalRead(alarm1SetButton)==LOW) {
   
    alarmHRState = digitalRead(hourPin); 
   if (alarmHRState != lastalarmHRState) {
     if (alarmHRState == LOW) {
      alarmHRPushCounter ++; }}

   alarmMinState = digitalRead(minutePin); 
   if (alarmMinState != lastalarmMinState) {
     if (alarmMinState == LOW) {
      alarmMinPushCounter ++; }}  
   
     lastalarmHRState = alarmHRState;
     lastalarmMinState = alarmMinState;     
   digitalClockDisplay();
   minute_reset59();
   hour_reset24();
     }
 }

void alarm(){
  
  //--------------------RELAY Alarm ON Toggles-----------------------------------------
    if (hour()== alarmHRPushCounter && minute()==alarmMinPushCounter && second()<=1){ //sets time for alarm to go off  
    digitalWrite(relayPinA0,HIGH); // relay board triggers on HIGH
    delay(100); digitalWrite(relayPinA1,HIGH);
    delay(100); digitalWrite(relayPinA2,HIGH);
    delay(100); digitalWrite(relayPinA3,HIGH); }
  
  if (hour()== alarmHRPushCounter && minute()==alarmMinPushCounter && second()<=4){ //alarm will sound for 10seconds  
    analogWrite(buzzer, 10); // PWM duty cycle to output; dont use 0 or 255                        
    delay(delayms); // wait for a delayms ms
   analogWrite(buzzer, 0); // 0 turns it off
    delay(delayms); // wait for a delayms ms

 unsigned long currentMillis = millis(); 
  if(currentMillis - previousMillis > intervalIdle) { // save the last time you wrote to LCD 
   previousMillis = currentMillis;   
   if (LCDalarm == 0){
     LCDalarm = LCDalarm + 1;
      lcd.setCursor(15,1); lcd.print(" (");lcd.write(1);lcd.print(") ");
      digitalWrite(alarmLED,HIGH);
       }
   else 
{
     lcd.setCursor(15,1); lcd.print("( ");lcd.write(1);lcd.print(" )");                                                            
     LCDalarm = LCDalarm - 1;
     digitalWrite(alarmLED,LOW);
      } }  
}
}
 
//--------------------------------------------------------
void minute_reset59() {
  if (minutePushCounter > 59){
  minutePushCounter = 0;}
  
  if (alarmMinPushCounter > 59){
  alarmMinPushCounter = 0;} }

void hour_reset24() {
  if (hourPushCounter >23){
  hourPushCounter = 0;}
  
   if (alarmHRPushCounter >23){
  alarmHRPushCounter = 0;} }

  void setTime_Hour_Minute () {
     minuteState = digitalRead(minutePin);
   if (minuteState != lastminuteState) {
     if (minuteState == LOW) {
       minutePushCounter++;
     }
   }
   
   hourState = digitalRead(hourPin);
   if (hourState != lasthourState) {
     if (hourState == LOW) {
       hourPushCounter++;
      }
   }
    lastminuteState = minuteState;
    lasthourState = hourState;

  setButtonState = digitalRead(timeSetButton);
    if (setButtonState == LOW) {
    setTime(hourPushCounter, minutePushCounter,00,dayoftheweek, 7, 2000);   
// (HH,MM,SS,Day, Month, Year) 
    }
  }
 
//--------------------------------------------------------
void AmPm () {
  if (hour()>=12) {lcd.setCursor(18,0); lcd.print("PM"); }
  else { lcd.setCursor(18,0); lcd.print("AM"); } }
  
 
//--------------------------------------------------------  
void digitalClockDisplay() {
 pumpDuration = analogRead(potPin1);
 dayInterval = analogRead(potPin2);
 dayInterval = map(dayInterval, 0,1000, 1,7);

  lcd.setCursor(4,0); lcd.print("Time");
  lcd.setCursor(9,0); printDigits(hour()); lcd.print(":");
  lcd.setCursor(12,0);printDigits(minute());lcd.print(":");
  lcd.setCursor(15,0); printDigits(second());
  lcd.setCursor(0,1); lcd.write(1);

  lcd.setCursor(9,1); lcd.print("Set @ ");
  lcd.setCursor(15,1); printDigits(alarmHRPushCounter); lcd.print(":");
  lcd.setCursor(18,1); printDigits(alarmMinPushCounter);  
  lcd.setCursor(0,2); lcd.print("Pump duration: "); printDigits(pumpDuration/29);
  lcd.setCursor(17,2); lcd.print("sec");
}

 
//--------------------------------------------------------
void printDigits(int digits) {
  if (digits <10)
  lcd.print('0');
  lcd.print(digits);
}

 
//--------------------------------------------------------

This code is exceptional in the way that it gives you the ability to manually override the pump, control how long you wish to keep the pump on and the frequency of watering. You can adjust these by playing around with the variables without making drastic changes to the code. 

In your system, you can even divide the hydraulics across however many plants you wish to have watered. You can do this by increasing the pump’s duration through your code and dividing the water volume across plants manually by inserting T-splits into the watering tube. Putting the plants into wooden boxes restricts their access to sunlight which is as important to plants as water. To counter this problem, we can set up fluorescent bulbs to light up the box. We recommend you to use bulbs that give out UV light as that is most beneficial for plants. These bulbs and fixtures can get mounted at any level above the box’s flooding level, but we chose to mount them at the roof of the box.

Lastly, the only missing ingredient of this system is water itself. So add some water into the tub that you have installed. This tub would require refilling from time to time. And finally, switch the power on, run the program and sit back as the relay will do the rest!

Source and full tutorial here: (https://www.instructables.com/Automated-Plant-Watering-System/)

You can get your Arduino Uno here.

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: