Sunrise Lamp
Daniel Ha
Daniel Ha
Front view of the sunrise lamp, with power on.
A new way to wake up. Waking up in the morning doesn't have to be so "alarming". Sol is a lamp simulates a natural sunrise, offering a calmer way to start your day. Sol is meant to live on the nightstand, so it can easily wake up the user when activated. Through the potentiometer in the back, the user can set time which the lamp will light up.
Sunrise lamp in context- Beside the bed
Deconstructed before assembly. Part include the shade, glass sphere, base, base lid, high power LED, heat sink, RTC, Arduino Micro, Potentiemeter, and voltage regulator.
Potentiemeter in the back to set time
Why a Sunrise Lamp? Waking up through an exposure to light, especially in the morning, is shown to regulate your body's circadian rhythm. This provides for a more natural and calming way to wake up, contrasting the startling and agitating phone alarm. This video shows the lamp fading in the light on the correct time. The video has been sped up in order to clear show the light fading in. The lamp was also set in demo-mode so that the RTC will reset itself to 6:59 AM so that it would run the function after a minute.
I was exploring different options to set the time (buttons, potentieameter, display screens). I was considering which options would best fit within the design while giving the person a better user experience as well.
Customizing a heat sink for the LED due to the orginal heat sink not being able to fit inside my design. I had to cut a piece of aluminum and tap hole inside in order to correctly mount the heat sink
3D printing of the lamp shade. After talking with Cody, we decided to use "airplane mode" inorder to create a thin layer.
Lamp running the fade in function as the potentiameter is set to 7:00
Creation of solder components using the Arduino Micro
All the parts of the lamp before assembly.
Address all of the prompts below. It is best to address all of these topics in a natural piece of prose. However, if you prefer, you may write four disjoint paragraphs, each of which is addressing a prompt. (The first way is better.) In total, this section should be ~300–500 words.
I was glad to hear that people enjoyed the function and form of my lamp. I believe I was successful in capturing and mimicing a sunrise through this device both in how it worked and looked. Some suggestions that were made I that I would definetly incoporate next time would be to have more time segments so that the user can have more felxibility in choosing their time.
For the most part I was very happy with the way the project came out. The code and hardware worked together to simulate exactly what I was orginally imaging. I was quite suprised by this as my expections of having a fully refined product was low. However, combined with the well fabricated exterior of the lamp, I believe this device feels somewhat polished and presentable. I believe some areas of improvement lie within how the user sets the time. Ideally I would have liked the lamp to connect with an app interface so that the user could have even more ability to personalize the device such as how long the lamp takes to fade in.
Being a Design major, I enjoyed fabricating the device the most. I was really cool to see my concept come to life. However, I new and challangeing aspect of this project was when I had to consider how to device would fit with the electric components. The coding aspect of the project was difficult to me, but with the help of Ella and Zach I began to understand more about each function of the code
If I were to build this device again, I would like to pair it up with a app interface that would allow the users to set the time and duration of which the lamp will light up. However, aspects such as the exterior of the lamp I was quite satisfied with.
//Sunrise Lamp
// Daniel Ha
//this code takes in the input of the potentiameter and maps the values to either 7,8, or 9. If the RTC value is equal to the potentiameter value, it runs the function fadeinLight which increases the LED brightness from 0 to max brightness over a minuete.
#include <DS3231.h>
#include <string.h>
DS3231 rtc(SDA, SCL);
const int LEDPIN = 9;
const int POTPIN = A0;
String alarmTime = "";
// Init a Time-data structure
Time t;
Time a; // alarm time
bool lightIsOn = false; // Tracks whether the light is currently on
unsigned long lightonTime = 0;
void setup() {
Serial.begin(9600);
// Setup Serial connection
//Serial.begin(115200);
// Uncomment the next line if you are using an Arduino Leonardo
//while (!Serial) {}
// Initialize the rtc object
rtc.begin();
pinMode(LEDPIN, OUTPUT);
// The following lines can be uncommented to set the date and time
//rtc.setDOW(TUESDAY); // Set Day-of-Week to SUNDAY
//rtc.setTime(6, 59, 30); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(18, 2, 2025); // Set the date to January 1st, 2014
a.min = 0;
a.sec = 0;
}
void loop() {
int potValue = analogRead(POTPIN);
int setHour = mapPotValueToTime(potValue); // Map potentiometer value to 7, 8, or 9 AM
// Get data from the DS3231
t = rtc.getTime();
//Serial.println(t);
Serial.print("Mapped Time: ");
Serial.println(setHour);
if (setHour == 7) {
a.hour = 7;
} else if (setHour == 8) {
a.hour = 8;
} else if (setHour == 9) {
a.hour = 9;
}
// Check if current time matches alarm time and light hasn't turned on yet
if (a.hour == t.hour && a.min == t.min && a.sec == t.sec && !lightIsOn) {
Serial.println("Light on");
fadeinLight();
lightIsOn = true; // Mark light as turned on
lightonTime = millis(); // Start timer for auto-off
}
unsigned long currentMillis = millis();
// Turn off the light 10 minutes after fade-in is completed
if (lightIsOn && currentMillis >= lightonTime + (1000L * 60 * 5)) {
digitalWrite(LEDPIN, LOW);
lightIsOn = false; // Reset flag so light can turn on again the next day
Serial.println("Light off after 10 minutes.");
}
}
void fadeinLight() {
for (int i = 0; i <= 255; i++) { // Limit to 255 (max PWM value)
Serial.println(i);
analogWrite(LEDPIN, i);
delay(235); // Adjusted delay to ensure full fade-in over 1 minute
}
lightonTime = millis();
}
// Function to map potentiometer value to time (7, 8, or 9 AM)
int mapPotValueToTime(int potValue) {
if (potValue < 341) return 7;
else if (potValue < 682) return 8;
else return 9;
}