So we borrowed a Wake-Up Light from a friend. I was quite skeptical at the beginning but it did make waking up a lot easier and partially alleviated my morning grumpiness. As any upstanding DIYer will do, we decided to build our own:
Here’s what the light needed to be:
- Low Cost (not counting the hours). Should be cheaper to build than buying a new one.
- Should work with any table lamp.
- A simple but effective interface.
- Should also work as a mood light.
- Easy controls (so we made an app).
- Open design. I want to make it easy for anyone to replicate my design if they want to.
Code and Microcontroller
I built the project around a Stellaris Launchpad (an ARM Cortex M4F microcontroller board) which turned out to be surprisingly easy to use. TI has now re-branded the Stellaris family to Tiva and made some incremental changes. The equivalent board is the Tiva Launchpad which can easily run my code with minor adjustments.
All my code for the microcontroller can be downloaded from GitHub. The README.md on that page describes the source code from a top level and explains the commands and pin usage of the system. If you’re lazy, the binary is available here and can be flashed using TI’s LM flash programmer software.
I opted to make the box so that you can plug in any table lamp of your choice. This way, it’s a much simpler box to build and move around, I can directly plug in any table lamp I fancy.After some research, I decided to use the AC dimmer circuit in this awesome instructable. I built the same circuit but used an H11AA1 instead so that I did not need a rectifier chip. Here’s the finished board and schematics for my dimmer board:
I later added a fuse as well which is not depicted above.
This circuit cannot work with capacitive loads. This means no LED lights and no CFLs either. Good old Incandescent and Halogen lamps work. LED lights that claim to be dimmable may work but I haven’t tested one. I use a 42Watt Halogen lamp. I hate wasting energy, so I may make a completely different design in the future.
After experimenting with a buttons + LCD interface, I decided the whole system was just too clunky and hard to build. I decided to make the system simpler and added bluetooth into the mix with an HC-05 bluetooth transciever with a UART interface. Now I could just control the light using my computer!
My wife Dhara came up with the idea to make an app for that. And so she did:
Dhara’s Android app can set the brightness of the light to set the mood. It can also set alarms along with days of the week when the alarm should go off. This is a feature I found missing in the light we borrowed. The app also automatically synchronizes the time of your clock with the light.
If you want the app and its source code, just leave a comment or contact me. As the app is bound to the MAC address of my HC-05 module, we will need to compile a new one for you.
All the commands to the light are in human readable ASCII format. For example, the command for setting time to Sunday, 4:15PM is “T0:16:15:00”. This is computationally inefficient but made it a lot easier for me to debug the light. I can also use the Bluetooth SPP Pro app to debug and control the light. All the commands are documented in the README.md on the project’s GitHub repository.
In addition, there is a single push button on the box to snooze and switch off the alarm. The button can also be used to cycle between 5 brightness levels.
What’s a wake up light without sound? Um, a work in progress?
So far, I’ve built an amplifier using an LM4876 chip and built some code to play sounds using PWM. The Stellaris does not have a DAC of its own and PWM can only go so far in sound quality. The sound is far too tinny, so we are just using a phone for the alarm sound for now. In the future, I will add a DAC chip for better sound quality and an SD-Card to store longer sound tracks.
The Top Board
The top board hosts the LM4876 audio amplifier. The filter and feedback circuit is same as what is recommended on the datasheet. I chose this chip because the recommended circuit around the chip is quite simple. In addition it is also power-efficient (it’s designed for mobile phones) and has a signal to completely switch off the output. The IC is not available in DIP package so I flipped it, glued it to the board, and then soldered wires to its tiny legs. The amplifier outputs to a speaker hacked out of a friend’s dead laptop. Those speakers are the right impedance and quite efficient!
Apart from the amplifier circuit, the board serves as a general routing board. I used IC-feet as sockets for the Launchpad’s pins and routed the pins to the HC-05 module to the UART pins of the Launchpad and the button to the 3.3V and GPIO pins of the launchpad.
The Whole Thing
The launchpad is sandwiched between the two boards I made. The bottom board for controlling the lights has an AC socket attached to its AC output, so I can plug in any lamp to it. There is a 5V wall adapter connected to the AC input which is also going into the bottom (dimmer) board.
Here‘s a video explaining this project.
What do you think of this project? Would you like to make your own? Want some help? Leave a comment and I’ll get back to you.