Water Alarm with RPi

An alarm that sprays water at the time set via Telegram bot and stops on detecting a smile!

Public Chat
Similar projects worth following
I hate to over sleep and loosing out productive morning. To deal with this worked on this project to make an alarm that sprays water on the set time and the spray stops on detecting smiley face. I also intended to delve into using different modules, which are Camera, I2C, motor workings. After learning about the possibilities with Telegram bot, I went with the idea of setting time by messaging the bot and receiving the smile pic later on.


So I'm a guy, who loves indulging in challenges. An optimist who tries finding fulfillment everywhere. "To define is to limit" said a great man so I'm in a quest to do all the stuff without any bounds by trying to seize my day the best.

But wait to seize my day, I need to wake up first. To wake up I need to stop snoozing my alarm or make my alarm so noticeable that I don't happily sleep off in ignorance and later look at the missed alarm notification with despair, of course damping my "seize the day" zeal to nadir yet another day :( . And more worse was the times I had 8 AM classes at halls far away, and I barely used to gain conscious at 7:45 AM, what a day-mare it was! And many such situations aren't uncommon for us power sleepers out there. My optimism tells me take take this as a challenge and make something of this. And so it struck me to make an alarm that shoots water and wakes the heck of me refreshed. So my pursuit began...


This is the basic view of circuit with RPi, Pump, Camera being the primary units.

Being a fan of Nolan flicks especially Batman trilogy, who can be more cooler a servant than Alfred Pennyworth. Hence my servant bot named "Alfred Pi-nyworth".

Send a message to bot set time, show a smiley face to stop the spray. and need to run in separate terminal. As for face detection, cam display window needs to be accessed, the should be run directly or using VNC not SSH.

Constraints and Materials

I wanted my old RPi 3 as brain for this device with build being modular and utilize the unused material available at home. With this intension I scouted my store room and found an old rubber pipe, short plastic pipe and connector of water dispenser and nozzle of a broken plant sprayer. Luckily all fit perfectly. LEGOs were the first things that came up thinking of modularity, so made base, skeleton with them and used a packing foam sheet pieces to cover the rest.


Used common time library, Adafruit library for display part, and OpenCV, Telepot, GPIO libraries for Smile detection, telegram control and pump part. Did some copy, paste, improvisation of codes. Alarm time to be inputted with alarm word and time in HH:MM at last 5 digits. I must admit that I should have made more robust code and better code structures so will definitely update them.


This may be a simple implementation to start out but will be hoping to make this better with newer ideas. Hence always open for suggestions!

PS: my first documented project, hence might be a little overly stated/engineered :)

device control code

x-python-script - 5.37 kB - 09/06/2021 at 13:02


Vermin Vibes 1989.ttf

font for display

TrueType Font - 12.94 kB - 09/06/2021 at 12:59


XML - Extensible Markup Language - 908.33 kB - 09/04/2021 at 14:13



for smile detection

XML - Extensible Markup Language - 184.09 kB - 09/04/2021 at 14:13


For I2C time display

x-python-script - 1.72 kB - 09/04/2021 at 14:11


  • 1 × Raspberry Pi 3B
  • 1 × Raspberry Pi Camera 5MP
  • 1 × 6V DC submersible pump
  • 1 × LM 293D Motor Driver
  • 1 × 0.96 inch I2C OLED display

View all 11 components

  • 1
    Setting up the Pump

    Attached the pipe of about 8-9 mm thick in diameter to the side outlet of pump. The other end, I attached to a pipe joiner and smaller pipe, that I got from water dispenser. Finally the attached the nozzle which I borrowed from a broken sprayer.  

    For the electronic part, connected the pump to LM293D driver IN pins and a 4xAA battery holder to power pins

    def alarmSprayOn():
                print("In Alarm Spray On ")
                for i in range(8): 
    ##range value depending on capacity of water container
    def alarmSprayOff():
                print("In Alarm Spray Off ")
  • 2
    Setting up the I2C dispaly for clock

    I'm using the 0.96 inch I2C display. For this to work Adafruit display module is to be downloaded on Pi. 

    This is a good article to get started. 

    I2C display setup with RPi

    After the setup analyze the example codes for working principles. I went through the and modified it to suit my purpose for clock setup.

    And then I coded time display program with output being shown on our I2C display.

    We can choose the font we like by downloading the .ttf files and accessing them by their full path in the font object created.

    font = ImageFont.truetype('/home/pi/Desktop/Test/VerminVibes1989.ttf', 30) # had to put full path to resolve 'OSError: cannot open resource' issue
    def I2C_TimeDisplay():
        def clk_time():
                t = time.localtime()
                current_time = time.strftime("%H:%M:%S", t)
                return current_time 
            while True:
                current_time = clk_time()
                draw.rectangle((0,0,width,height), outline=0, fill=0)
                draw.text((x+14, top+12),  current_time,  font=font, fill=255)
                # Display image.
        except KeyboardInterrupt:
  • 3
    Setting up control with Telegram bot

    I first thought of setting up a server to control RPi operations, but later switched to Telegram because it feels more appealing and easy to control by sending messages and iterations can be easier. Bot can bring life to many more cool ideas quickly. We need to clone telepot library for this. This article provides a good walk through of the process.

    Telegram Bot for RPi 

View all 5 instructions

Enjoy this project?



Vijay wrote 09/06/2021 at 14:41 point

Great work Manas!! 

  Are you sure? yes | no

Manas Ramidi wrote 09/25/2021 at 03:31 point

Thank you!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates