Week 3 & 4: May 22nd - June 1st
- zcarlier
- Jun 2
- 3 min read
Individual Log - Zach
With Memorial day passing our scheduled meeting days have changed, and weeks 3 and 4 have intersected some.
Following our weekly meeting with Prof. Ejaz, I was tasked with finalizing backlight control and overall code development for the thermostat. I began the week by finalizing the structure behind the warning system, which includes: a leak detection warning, low battery warning, overtemperature (scald) warning, and an insufficient hot water warning. Currently each warning is triggered by either the potentiometer or a button for testing purposes, but this will be changed to depend on values received from the valve control's MCU once group assembly and testing meetings are held. Each warning function is activated via conditional (if-then) statements in the loop function, where the value of the corresponding parameter (real_temp, set_temp, batt_rem, leak_detect) is then passed to its respective function. When a warning function is called, values are assigned to "noteval" and "dur" and passed to a seperate function that plays a unique beeping tone on a buzzer, and the LCD screen displays a message indicating what the warning is.
A bootup routine, which includes a short melody and message showing "The Smart Water Faucet" was created for the device. At the moment, this startup routine only occurs when the device is plugged in after power has been removed.
The first video below shows the boot up routine, and warnings for low battery and overtemp. (Please note that the variable set_temp is being used for initial testing of these warnings, final functions will be dependent on values received from the valve control MCU. Code for all warnings is prepared and only requires minor editing.)
The video below shows the displayed message and chime sound for an insufficient hot water warning using the potentiometer.
A button was wired temporarily to pin 7 and configured as a boolean to activate a leak detection warning. The code for this particular warning overrides the entire program and can only be exited after maintenance has occurred.
Currently, backlight control is dependent on when the potentiometer was last used to set a temperature. A timer is activated using millis() and compared to a set length. Once the value of the timer is greater than or equal to the timer set length, the backlight and display are turned off using lcd.noBacklight() and lcd.noDisplay(). A similar workflow will be added to activate or deactivate both the display and backlight whenever the faucet is used.
The video below shows the current of the thermostat circuit, first with the display and backlight on and then with both off. When active, the thermostat uses ~43 mA (0.38 W), and when not activate around ~12.7 mA (0.11 W).
With the thermostats code nearing completion, it was time to prepare the circuit for final assembly. Each section was carefully assembled, soldered, and wired onto a soldered breadboard, and tested to ensure no components would be damaged upon power up. Dupont jumpers are currently in place, but will be replaced with a more permanent solution in the coming weeks.

After finalizing the installation and wiring of components on the breadboard, the circuit was powered up and its functionality verified.
Comments