Skip to content

A Raspberry Pi project. I build an alarm clock that shoots water at you to wake you up.

Notifications You must be signed in to change notification settings

DavidMiles1925/water_alarm_clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Water Alarm Clock

v1.0 assembled

Table of Contents

Click to expand...

- Project Description
 - About the Product
 - Inspiration
 - Project Showcase
  - Video Overview
  - Product Images
  - Debug Console

- Project Credits
 - Jonathan Hoffman
 - Tom Ryan
 - David Miles

- Documentation
 - Using Water Alarm
  - Setting the Clock
  - Setting the Alarm
  - Setting the Snooze
  - Priming the Pump
 - Technical Notes
  - Config Information
  - Installation (Raspberry Pi 4)
  - Installation (Raspberry Pi Zero W)
  - Run Program on Startup
 - Hardware and Design
  - Parts List
  - Design Schematic
 - Software
  - Current Version
  - Version Release Notes


Project Description

About the Product

This is a project in development to create an alarm clock that will spray you with water to help heavy sleepers get out of bed in the morning. It has undergone many transformations since its inception, but it continues to be fun and challenging project that pushes our team to try and learn new things.

Inspiration

This idea was conceived by Jonathan Hoffman, who has always thought outside of the box. He is a heavy sleeper, and wants something to get him moving quickly in the moring. I (David Miles) took the idea and ran with it. You can read more in our bios below about the roles we each play in the project if you're interested.


Project Showcase

Click here to see a video about the project in it's development state:
Video Overview


Product Images

Click to see the product through its evolution.

Some pictures of the clock after being mounted in the 3D printed box.

v1.0 assembled v1.0 assembled v1.0 assembled v1.0 assembled

A picture of the "box build" for the computer components:

v1.0 assembled

- The alarm clock as of version 1.0:

v1.0 assembled

Debug Console

Click to learn about the debug console.

 - The debug interface as of version 0.6:

debug v0.6

This interface was used to:

Test individual components of the project. For example, when testing the buttons I would print a message to the screen when each button was depressed.

Display the values of important variables. When debugging, it was invaluable to know how my variables were set.

Display the expected LCD output. I sent the same string to the console as to the LCD. As I was getting the screen working, this was helpful because I knew if I didn't get the correct output, it was probably an error in my wiring.


Project Credits

Jonathan Hoffman - Product Owner

Jonathan, or "Jono" as his friends call him, is the one who initiated this project. He is largely responsible for the mechanical design, and has selected pump and circuit equipment to be used in product construction.

Tom Ryan - Consulting Engineer

Tom has been an instrumental part of product testing, solution design, and general consulting.

David Miles - Software Developer

David is responsible for the software and small electronics portion of the project. He is also the one maintaining the project documentation.


Documentation:

Using Water Alarm:


Setting the Clock

Click to expand...
  1. Turn on the device.
  1. You will be prompted with some basic instructions, and then you will be asked to enter the date and time, one item at a time.
  1. Use the 'MINUTE' button to change the value on the screen. If you pass your desired value, simply keep going and it will circle around again.

    Note: Time will need to be set in 24hr format. Clock will display AM/PM format.

  1. Use the 'HOUR' button to submit the value. Treat it like your 'ENTER' button.
  1. The system will verify you have entered a real date. If there is an error in the date, the system will restart and prompt you for the date and time again.

Setting the Alarm

Click to expand...
  1. Turn the alarm on by pressing the ON/OFF button. The screen should display "ALARM:ON"
  1. Hold down the 'SET ALARM' button. The alarm time should appear on the screen.
  1. With the 'SET ALARM' button depressed, press the 'HOUR' and 'MINUTE' buttons to set the alarm time.
  1. Release the set alarm button. You can check the alarm time at any time by pressing the 'SET ALARM. button.
    Note: YOU WILL NEED TO PRIME THE PUMP before using.

Priming the Pump

Click to expand...
  1. Fill pump reservoir.
  1. Ensure you have something to catch the water ejected during priming.
  1. Press 'HOUR' AND 'MINUTE' buttons at the same time. Pump will run as long as the buttons are depressed.

Setting the Snooze

Click to expand...

Note: Currently the only way to adjust the snooze is through the config.py file. Future versions will include a button for this feature.

  1. Open config.py with a text editor or the terminal:
cd path/to/water_alarm_clock
sudo nano config.py

*Press CTRL+S to save, then CTRL+X to exit

  1. Set SNOOZE_COUNT_CONFIG = # where "#" is the number of times you would like snooze to sound (the pump to activate) in the one minute following the first alram. Values are listed below for reference.

SNOOZE_COUNT_CONFIG = 1 (default setting): Alarm will sound once more in addition to the initial alarm. The number of seconds between the intial alarm and the snooze alarm is determined by MAX_SNOOZE_TIME.

SNOOZE COUNT CONFIG...
    =1: See above.
    =2: Alarm will sound at +29 seconds and +58 seconds.
    =3: Alarm will sound at +19, +38 seconds and +57 seconds.
    =4: Alarm will sound +14, +28, +42, and +56 seconds.

  1. Set MAX_SNOOZE_TIME (default=30): The time in seconds between the intial alarm and the snooze alarm when SNOOZE_COUNT_CONFIG = 1.

 Algorithm for determining snooze activation times:
DELAY_TIME = (60 / SNOOZE_COUNT_CONFIG) - 1


Technical Notes

Note: This repo is located at http:https://github.com/DavidMiles1925/water_alarm_clock


Config Information

IMPORTANT!!!
Make sure the constant called LOG_DIRECTORY_PATH has the correct value set!

Example:
LOG_DIRECTORY_PATH = "/home/YOUR PI NAME HERE/water_alarm_clock/logs"

Click to see detailed config information.

LOG_DIRECTORY_PATH - The path that your logs will write to:

LOGGING_ENABLED - Turn logging on/off (True/False)

CONSOLE_OUTPUT_ON - Turn console output on/off (True/False)

Pin assignments
LED_PIN = 27
RELAY_PIN = 21
SET_BUTTON_PIN = 13
ALARM_BUTTON_PIN = 26
HOUR_BUTTON_PIN = 6
MINUTE_BUTTON_PIN = 5

These pin assignments are found in lcd.py
LCD_RS = 7
LCD_E = 8
LCD_D4 = 25
LCD_D5 = 24
LCD_D6 = 23
LCD_D7 = 18

These two variables determine default alarm time.
ALARM_HOUR - Set to an integer between 0 and 23
ALARM_MINUTE - Set to an integer between 0 and 59

ALARM_SET - This decides whether or not the alarm will be set when the device is powered on.
 Set True for ALARM: ON
 Set False for ALARM: OFF

ALARM_DURATION - Time in seconds the pump will run
*NOTE: In one second approx. 2oz of water comes through pump. Be careful setting this value too high!

SNOOZE_COUNT_CONFIG - Used for determining how the snooze will function. Read below for more details.
 if SNOOZE_COUNT_CONFIG = 1:
  Pump will activate once more, in addition to intial alarm. The number of seconds between the intial alarm and the snooze alarm is determined by MAX_SNOOZE_TIME.

 if SNOOZE COUNT CONFIG =   2: Alarm will sound at +29 seconds and +58 seconds
  3: Alarm will sound at +19, +38 seconds and +57 seconds
  4: Alarm will sound +14, +28, +42, and +56 seconds
  5+: Use Algorithm: DELAY_TIME = ((60 / SNOOZE_COUNT_CONFIG) - 1)

MAX_SNOOZE_TIME - The time in seconds between the intial alarm and the snooze alarm when SNOOZE_COUNT_CONFIG = 1

BYPASS_SET_TIME - This variable is used to bypass setting the time on power-up. If set to 'True', the time will be pulled from the Wifi, or if there is no connection, it will be set to the epoc.
 - False: User will set system time manually
 - True: System time will be set to default

BYPASS_INSTRUCTIONS - This variable is used to bypass the instructions that display before setting the time.
*Note: If BYPASS_SET_TIME is set to True, this variable will have no effect.
  False: Instructions will display at startup
  True: Instructions will NOT display at startup

BUTTON_SLEEP_TIME_AFTER_PRESS - This is the amount of time that the buttons will 'sleep' after each press.


Install on Raspberry Pi 4:

Click to see installation instructions.
  1. Configure git:
     a. Install git: Click Here To Install Git
     b. Configure:
git config --global user.name "yourusername"
git config --global user.email "your@email"

 c. Create GitHub Access Token: Instructions here
SAVE THIS KEY IMMEDIATELY! YOU WILL NOT BE ABLE TO ACCESS IT AGAIN.

  1. Clone repo:
     a. In the terminal, navigate to your desired directory and enter this command:
git clone https://github.com/DavidMiles1925/water_alarm_clock.git

 b. You will be prompted for username and key (it is labeled password).
Copy and paste the key generated in step 1c as the password.

  1. Run program:
     a. Run program in console:
cd path/to/program
python main.py

 b. Configure for startup


Install on Raspberry Pi Zero W:

Click to see installation instructions.
  1. Follow these instructions to set up the Pi.
     - Also, if you require authentication, follow instructions in the above section Intallation on Pi 4

  2. Run these commands to run program

git clone https://github.com/DavidMiles1925/water_alarm_clock.git
cd water_alarm_clock
python main.py

Configure to Run On Startup:

Click to see installation instructions.
  1. Modify etc/rc.local with admin priviliges:
cd /etc
sudo nano rc.local
  1. Added this line to /etc/rc.local:
sudo python /home/pi/water_alarm_clock/main.py &
  1. To stop the process, first find the pid number:
ps aux | grep "main.py"
  1. Note the number in the second column.
  1. Terminate process:
sudo kill -TERM ###

 *replace "###" with the number from step 4


Hardware and Design:

Parts List

Pump info needed
Converter info needed
Raspberry Pi Zero W
1602 LCD Screen
B10K Ohm Potentiometer
5V SL-C Relay
4-pin buttons x4
Pack of Jumper Wires
220 Ohm Resistors x2
1K Ohm Resistors x4
47 Ohm Resistor x1
LED x1


Design Schematic

setup diagram


Software:


Current Version: 1.2

This version is a fully functional version of the software that has been tested with the hardware. It has a printed case, and is awaiting pump nozzel adjustments. The next step is to build a full prototype of the final Water Alarm product.


Version Release Notes:

Click to see version notes:
Version 1.1

 - added better error handling
 - README updates
 - Primer made to be constant flow
 - Switched hour and minute GPIO pins

Version 1.0

 - created set_system_time() function
 - added set time logic
 - README:
  - add set time instructions

Version: 0.7

 - added snooze feature
 - tweaked snooze output
 - adjusted lcd performance
 - README:
  - added overview video
  - added technical notes section
  - general fixes

Version 0.6

 - configured to run on startup
 - Minor improvements:
  - optimized sleep times
  - added exit message on lcd
  -re-introduced debugging for porting
 - Reformated board layout for efficiency
 - README:
  - Project recap
  - Videos/images
  - add hardware links
  - add screen wiring diagram

Version 0.5

 - added AM/PM logic
 - formated output for AM/PM
 - integrated screen
 - calibrated potentiometer
 - generated screen output to match debug output
 - reformatted code for easier reading

Version 0.4

 - Created basic alarm logic
 - integrated indicator LED
 - integrated relay circuit
 - test all components

Version 0.3

 - Set up GPIO pins
 - integrated buttons:
  - alarm on/off
  - set alarm
  - hour
  - minute
 - configured button logic
 - console debug formatting adjustments
 - README:
  - added table of contents

Version 0.2

 - adjusted time output formatting
 - created debug output to console
 - README update:
  - hardware
  - future versioning

Version 0.1

 - Created main function
 - Created basic utilities library
 - Created configuration file
 - Initialized repository
 - Incorporated bare-bones error handling
 - Started README

About

A Raspberry Pi project. I build an alarm clock that shoots water at you to wake you up.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages