Sunrise Alarm Clock With LCD Display and Bluetooth App

Wintertime can be sad. You wake up, it’s dark and you have to get out of bed. The last thing you want to hear is the annoying sound of your alarm clock. If you, like me, have trouble waking up in the morning this alarm clock is just what you need.

In this tutorial, we are going to build a Sunrise Alarm Clock. It's an alarm clock like any other in that you can set the hour and minute you want to wake up, but with the benefit of using light to brighten up your bedroom over a period of time like a sunrise to wake you up instead of an annoying buzzer!

We will also be using a bluetooth module to create an app that let's you set the alarm via your phone onto the clock. The LCD display will show the tiime, date and day of week.

Sunrise lamps exist on the market but they can be expensive (a quick search on Google returns products in the €100 range), fragile and quite clinical-looking. That's why I decided to make my own for my Arduino School Project. All the parts will be listed in the next step. The code can be downloaded from my Github repo sunrise-alarm-clock. Let's begin :)

Step 1: Gathering the Parts

We'll be using a clock as our input and an ultra-bright LED as our output to simulate our sunrise.

To build the circuit we will need :

- Arduino Uno- clockmodule RTC DS3231 - a MOSFET to control the brightness of the light - a super-bright LED (I bought 2, one warm, one cold) - 9V battery to power the LED - a breadboard- a LCD Display (16:2)- Bluetooth adapter hc-05 so we can use an app to set the alarm.

Step 2: Assembling the Circuit

You can refer to the sketch for my circuit, unfortunaly I coudn't find the RTC DS3231 in the program so I had to do with this one. Connections are a bit different in real, here are the connections. (the bluetooth module is not in the sketch but I will explain how it works below cause it rather tricky)

RTC DS3231

GND goes to GND on the arduino

VCC goes to the 5v

SDA goes to arduino

SCL goes to arduino

We won't use SQW & 32K

MOSFET

Gate pin goes to pin~9 on the Arduino Uno because it's PWMDrain pin goes to the negative side of the LED Source pin goes to GND on the Arduino

LCD-Display

GND goes to GND on the arduino

VCC goes to 5VSDA goes to A4 on the arduinoSKL goes to A5 on the arduino

LED- goes to mosfet+ goes to the 5v

9v battery You can buy a 9v battery in any local shop, plug into the arduino with a connector strip.

Bluetooth module hc-05

5V goes to 5V from the arduino

GND goes to GND on the arduino

Now there's 2 more inputs but here comes the tricky part, we have to connect the opposite inputs of those 2 on the arduino

TX from hc-05 goes to RX on arduinoRX from hc-05 goes to TX on arduino

Important: Make sure you DISCONNECT the TX & RX from the HC-05 when you're uploading code on your arduino or you will get an error saying "something went wrong with uploading the code" in the compiler.

The library that I'm using to run the clock can be found at Rinky-Dinky Electronics http://www.rinkydinkelectronics.com/library.php?id=73 and make sure you are on the DS3231 page. Download the zip file, save it and place it in your Arduino's libraries folder.

Time

Include the library DS3231 or DS1307 in your arduino code

Uncomment these 3 lines of code to set the time:

// rtc.setDOW(MONDAY); // Set Day-of-Week to SUNDAY<br>// rtc.setTime(23, 57, 0); // Set the time to 12:00:00 (24hr format)
// rtc.setDate(14, 1, 2019); <br>// Set the date to January 1st, 2014

Step 5: Time for Testing!

Attachments

Step 6: Bluetooth App Set-up

Because I found it annoying to dig into the code everytime I wanted to set an alarm I wanted to make a app that would set the alarm, which is way easier.

Go to http://ai2.appinventor.mit.eduhere we can make a simple app that lets us set the alarm, i've included the simple design set-up (you can always tweak this later) and the code used for the bluetooth connection.

You can then publish your app and connect with it on your phone by using a QR code or directly downloading the app on your computer, then porting it over with cable on your phone. (screenshot)

Step 7: Building the Case

You can always build a different case around your arduino clock. I used wood and matte plexiglass to construct my own alarm clock case. I chose matte plexiglass so you can see the light clearly shining through the case but you cannot see the inside of the clock.

Step 8: Finished!

Now that you have uploaded the code to your arduino, build the case and checked if you properly assembled your clock, you can set an alarm on the bluetooth app and start waking up more naturally! :)