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
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.
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.
Click here to see a video about the project in it's development state:
Video Overview
Click to see the product through its evolution.
Some pictures of the clock after being mounted in the 3D printed box.
![v1.0 assembled](https://github.com/DavidMiles1925/water_alarm_clock/raw/main/media/printed_box_setup.jpg)
![v1.0 assembled](https://github.com/DavidMiles1925/water_alarm_clock/raw/main/media/printed_version.jpg)
![v1.0 assembled](https://github.com/DavidMiles1925/water_alarm_clock/raw/main/media/printed_version_top.jpg)
![v1.0 assembled](https://github.com/DavidMiles1925/water_alarm_clock/raw/main/media/printed_version_back.jpg)
A picture of the "box build" for the computer components:
![v1.0 assembled](https://github.com/DavidMiles1925/water_alarm_clock/raw/main/media/version1.1_box_build.png)
- The alarm clock as of version 1.0:
![v1.0 assembled](https://github.com/DavidMiles1925/water_alarm_clock/raw/main/media/Version_1_Assembled.jpg)
Click to learn about the debug console.
- The debug interface as of version 0.6:
![debug v0.6](https://github.com/DavidMiles1925/water_alarm_clock/raw/main/media/v0.6_debug_interface.png)
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.
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 has been an instrumental part of product testing, solution design, and general consulting.
David is responsible for the software and small electronics portion of the project. He is also the one maintaining the project documentation.
Click to expand...
- Turn on the device.
- 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.
- 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.
- Use the 'HOUR' button to submit the value. Treat it like your 'ENTER' button.
- 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.
Click to expand...
- Turn the alarm on by pressing the ON/OFF button. The screen should display "ALARM:ON"
- Hold down the 'SET ALARM' button. The alarm time should appear on the screen.
- With the 'SET ALARM' button depressed, press the 'HOUR' and 'MINUTE' buttons to set the alarm time.
- 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.
Click to expand...
- Fill pump reservoir.
- Ensure you have something to catch the water ejected during priming.
- Press 'HOUR' AND 'MINUTE' buttons at the same time. Pump will run as long as the buttons are depressed.
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.
- 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
- 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.
- 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
Note: This repo is located at http:https://github.com/DavidMiles1925/water_alarm_clock
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
= 5These pin assignments are found in lcd.py
LCD_RS
= 7
LCD_E
= 8
LCD_D4
= 25
LCD_D5
= 24
LCD_D6
= 23
LCD_D7
= 18These 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.
ifSNOOZE_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: IfBYPASS_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.
Click to see installation instructions.
- 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.
- Clone repo:
a. In the terminal, navigate to your desired directory and enter this command:git clone https://github.com/DavidMiles1925/water_alarm_clock.gitb. You will be prompted for username and key (it is labeled password).
Copy and paste the key generated in step 1c as the password.
- Run program:
a. Run program in console:cd path/to/program python main.py
Click to see installation instructions.
-
Follow these instructions to set up the Pi.
- Also, if you require authentication, follow instructions in the above section Intallation on Pi 4 -
Run these commands to run program
git clone https://github.com/DavidMiles1925/water_alarm_clock.git
cd water_alarm_clock
python main.py
Click to see installation instructions.
- Modify etc/rc.local with admin priviliges:
cd /etc sudo nano rc.local
- Added this line to /etc/rc.local:
sudo python /home/pi/water_alarm_clock/main.py &
- To stop the process, first find the pid number:
ps aux | grep "main.py"
- Note the number in the second column.
- Terminate process:
sudo kill -TERM ###*replace "###" with the number from step 4
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
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.
Click to see version notes:
- added better error handling
- README updates
- Primer made to be constant flow
- Switched hour and minute GPIO pins
- created set_system_time() function
- added set time logic
- README:
- add set time instructions
- added snooze feature
- tweaked snooze output
- adjusted lcd performance
- README:
- added overview video
- added technical notes section
- general fixes
- 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
- 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
- Created basic alarm logic
- integrated indicator LED
- integrated relay circuit
- test all components
- 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
- adjusted time output formatting
- created debug output to console
- README update:
- hardware
- future versioning
- Created main function
- Created basic utilities library
- Created configuration file
- Initialized repository
- Incorporated bare-bones error handling
- Started README