WakeUp Light Design

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:

WakeUpLight box lamp and app

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.

Light

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:

Dimmer (bottom) board that controls the lamp’s brightness.

Schematic for the dimmer board.

I later added a fuse as well which is not depicted above.

The operating principle of the circuit is quite simple and described quite well here and here.
Warning: Be very cautious when working with AC, electric shocks can kill.

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.

Interface

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:

WakeApp Screenshots

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.

Sound

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

Top Board for signal routing and sound amplification.

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.

WakeUpLight Box

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.

Beagaroo controlled with Chronos

I set up beagaroo to be controllable with my TI EZ430-Chronos development kit (ahem watch). The watch has accelerometers whose data can be transmitted to a wireless access point. The data can be read out from the access point as if you were reading over a serial port.

Roomba controlled with Beagleboard. The beagleboard has Chronos RF dongle and WiFi Dongle attached and is powered with its own battery pack.

 

I also multi-threaded my program such that the thread writing wheel-speeds to the Roomba actually smooths out its output. This is done such that the difference between the set and requested speed halves on each iteration. I don’t need a feedback loop like PID because that’s already built into the Roomba. The Roomba does allow you to make dramatic changes to the inputs that can harm the motors and mechanics. The smoothing ensures this doesn’t happen.

The manual control with the watch was also a test of this algorithm. There are delays between my actions and Roomba’s movements. So there might still be some fine-tuning to be done with the smoothing.

So here’s a video of all this in motion:

What’s Beagaroo

I own a beagleboard (Every embedded-systems enthusiast should own something like it). I have been tinkering with it for some time. I’ve always been fascinated with robots and have build a couple from scratch, not this one though.

To me, the most interesting software is one that interacts with the real world. One example is the current incarnation of Jetsons’ Rosey: Roomba – An awesome robot vacuum cleaner. I decided to use the roomba as a starting point for my project. iRobot have been nice enough to include a serial interface that allows you to control the robot and read its sensors.

Thus, beagaroo was born:

So far, I have my beagleboard connected to my roomba over the Roomba Open Interface. I’ll continue to develop this robot over time. Stay tuned.