Inspiration
From biology class and psychology class in high school, our team learned that light stimulates the brain even while asleep and rouses humans awake effortlessly. It's so effortless because of human's circadian rhythm, which dictates the time that a person will begin to tire and begin to wake, which is calibrated based off of the sunrise and sunset. With the advent of blinds, shades, and houses, humanity began turning to noisemakers to wake them up since the sunlight has been blocked from reaching the inside. Our team found that going to bed and waking up at a good time everyday is a challenge because no matter how good of sleep we got, we always woke up tired. Through research we found that if we were able to restore this circadian rhythm, our sleep would not end in us waking up tired, but refreshed, alert, and ready to start the day.
What it does
The Sleep Switch is a device which retrofits existing "dumb" light switches into a "smart" remote alarm clock. The Sleep Switch has a built in microprocessor which connects to the world wide web and retrieves accurate, time-zone calibrated time. Then, it reconfigures itself into a WiFi Access Point and creates a webserver that any WiFi enabled device can connect to. Our companion app, Sleep Switch connects to this webserver and sends the Sleep Switch any configured alarm set with the built-in Android Alarm system.
When the time comes and the alarm activates, the Sleep Switch actuates a servo pushrod which flicks the light ON, and then retracts the pushrod to help minimize the Sleep Switch's footprint.
How we built it
The Sleep Switch was programmed by Jacob to run on an ESP8266/ESP32 board in C++ using the Arduino IDE. The Sleep Switch companion app was programmed in Java using Android Studio by Christian and then tested by sideloading the .APK onto Christian's Moto X4. The Sleep Switch model was designed and built by Jacob and Matt, and the electronics were chosen and configured by Jacob. The model was 3d printed on a Prusa Mini and assembled with screws, hot glue, and patience.
Challenges we ran into
At first, our team tried to use Bluetooth Low-Energy or BLE, but it is barely supported on ESP devices and is a lot more complex than Bluetooth to configure and use. The Arduino side was able to get the BLE system working and sending/retrieving data but BLE Security features were not implemented in the ESP libraries and several device identifying features were not present which makes remote user verification nearly impossible. The Android side of the BLE was even less coherent than the Arduino side especially for newer Android developers like ourselves. We burnt a full 8 hours at least trying to get BLE to work.
The ESP32 TTGO board that our team is using does not power on if given a 9V supply even though the documentation states that it supports the given voltage, so we had to add in a voltage converter which really added a lot of bulk to the overall footprint, but can be removed once a better board is chosen.
Using HTTP and WiFi to connect two devices together and have them communicate data is something new to our team so we had to research it a lot, and a lot of the Android libraries for communicating via HTTP or via WiFi were out of date and would not work with newer devices, while the most recent libraries would not work with older devices which is something that Christian wanted to design for.
We had several power-saving features enabled during the development of the BLE Arduino app that would allow the Sleep Switch to run off of a single battery for years based on the current draw during the ESP32's Deep Sleep and using transistors to switch power to the Servo on or off. We did not get the chance to reintroduce these features into the WiFi version of the Sleep Switch due to time constraints.
Accomplishments that we're proud of
We are proud of our device's relatively small footprint and that it is out of the way, located far underneath the light switch. Our design allows the switch to still be used normally and does not impede normal function at all. We are proud of how refined the BLE Arduino side got, especially with the power saving features allowing for as little current draw as 200uA which would allow for the device to run off of a low-end 9V battery for over 250 days, and with a bit more refining, that could turn from 250 days to 1080 days.
What we learned
Matt learned a lot about Fusion360 and the CAD process using calipers to measure and replicate real-world objects into the virtual world. Jacob learned how to use Arduino BLE, Arduino WiFi Access points, WiFi web servers, and configure the WiFi to switch between different modes to coordinate the RTC. Christian learned how to program Android apps using Android Studio, learned a lot about Android BLE, and also how to connect to WiFi servers.
What's next for Sleep Switch
WiFi low energy mode, a refined circuit board, and smaller device footprint.
Built With
- arduino
- esp32servo.h
- time.h
- urlconnection
- wifi.h
- wificlient
Log in or sign up for Devpost to join the conversation.