This is a project that I’ve done for a friend. She desperately needed a cool light for her glass cabinet that didn’t take up too much valuable space. So I designed this light to be as flat ass possible and to perfectly fit the floor panel of her glass cabinet. To ease control of the light I integrated a Bluetooth module into the design and wrote a small Android App to connect to it.
I’d say it turned out quite nicely.
This light is basically a sandwiched design. A hard foam baseplate (20cm x 23cm) carries the 12V RGB LED strips (5 x 20cm – 1m in total). The strips already have an adhesive backside, no separate glue was required and the 5 strips were evenly spaced on the baseplate.
The strips were soldered together in series and tested.
From the same material as the baseplate I cut three frames with the same outer dimensions as the baseplate and a width of 1cm. The frames were glued on the baseplate, stacked on top of each other, using double sided tape. A translucent window plate (also 20cm x 23cm) was glued on top of that. The window plate was made out of 3mm strong white Plexiglas.
The sides were sanded down to an even finish and then taped over with Aluminum adhesive tape to give it a nice metallic frame look.
The “brain” of this light solution is a Teensy 3.0 microcontroller board. It is an Arduino clone, but with a 32Bit ARM Cortex-M4 microcontroller @96MHz on a really small board (hence the name Teensy).
It is a bit overpowered for this solution, but I needed a 3.3V microcontroller for the BTM222 Bluetooth Module which can only handle 3.3V, which had a small and flat footprint to fit inside the light. Apart from the Teensy 3.0 and the BTM222 Bluetooth Module I only needed three MOSFETs to drive the LED strips (IRLZ 34N), a Power Supply – delivering 5V for the logic (Teensy has an on-board 3.3V voltage regulator) and 12V for the LED strips – and a few wires.
The BTM222 is connected via Serial UART (UART0 on Teensy), and the three MOSFETs are each directly connected to one of the Teensys PWM output pins.
The BTM222 is wired according to the datasheet, with only one big GND pin soldered, both Vss Pins soldered and the Rx and Tx Pins soldered. The Antenna is made out of a 3cm piece of wire. While you might think a simple wire Antenna will give you a crappy performance I can assure you it will not. In my tests I got much more than the usual 10m of range for Bluetooth Class 1 devices (even through a couple of concrete walls. I actually had to go outside to lose control/connection, at which point I was about 15m away and 2 stories down).
There are two Software components, the firmware for the Teensy and the Android App. The Teensy firmware, thanks to the Arduino Software, is about as simple as the Hardware side of things. The Android App is simple in the sense that I just had to modify the BluetoothChat example project that comes with the Android SDK.
You will find all the source files (Arduino Sketch and Android App) plus the Android App installable APK inside the ZIP file here:
There is one important thing to note here, in order for Android to connect to the BTM222 module there is a special UUID that needs to be set within the code. I had to look for a while before I found that special UUID, so I’ll include it here.
For the BluetoothChat App this needed to be set in the BluetoothChatService.java file on line 50.
// Unique UUID for this application private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
The Bluetooth connection layer is completely transparent to the Teensy program, which means I don’t have to handle anything for the Bluetooth protocol, for my microcontroller it’s just an ordinary serial connection (which, like a Modem, takes AT commands for configuration), so everything is just directly passed forth and back between my Android App and my Teensy Firmware. The communication protocol I wrote for that supports 4 commands. Each command has a parameter and each sequence ends with a CR character.
Available commands are:
m – control mode of Operation (0 = off, 1 = on, 2 = automatic fade)
r – control Red color level (0 – 255)
g – control Green color level (0 – 255)
b – control Blue color level (0 – 255)
This command set is simple enough for a person to memorize and use via the BluetoothChat App, but for convenience I added a keyword translation. This means, that keywords like “red”, “green”, “blue”, “orange”, “on”, “off”, “fade”, etc. are automatically translated into the command set that the firmware actually understands (color keywords translate into a sequence of three commands, to set every color channel -R, G, B – to its appropriate value to achieve the desired light color).