In this follow up to my kinetic lamp project, I want to add support for generic 2.4 GHz remote controls, add WiFi connectivity and replace the large AC motor in the base with a small, quiet 12V DC stepper motor and control the whole thing from an Arduino or ESP32 module.
A proof of concept will be made using off-the-shelf parts, but ideally this could be made into a PCB that would fit into the base of my lamp.
Getting to this point will require writing all the software, reverse engineering the remotes and making changes to the existing lamp design to house all the electronics.
Components
1×
Arduino Nano or ESP32
This will be the main controller
1×
MySensors Nano RF Shield
This will provide connectivity to inexpensive 2.4 GHz RGB remotes.
1×
DM-100AC
This is a DMX compatible constant-current RGB LED driver.
1×
28BYJ-48 12V stepper motor
This is an inexpensive stepper motor
1×
ULN2003AN Motor Driver
This is an inexpensive motor driver board for the stepper motor
For this project, I intend to use 1W RGB LEDs that come in a "star" configuration. These are different from "addressible" LEDs in that they have no build-in electronics. What they have is six pads that connect directly to the anodes and cathodes of a red, green and blue LED die. Driving these is tricky, because each color LED has a different voltage drop. You could use resistors for current limiting, but you would be generating a lot of waste heat. One trick I've used in the past is to tie them all in series and then use an adjustable voltage bulk converter to drive them as one:
Although this works, it requires the bulk-converter to be tuned to a very precise voltage and I later found out, also carries a risk of thermal runaway, especially if the LEDs are driven near their maximum ratings. Of course, this method also makes controlling the individual LEDs from a microcontroller impossible.
For this reason, I set out to find a constant-current supply for my LED projects. One part I came across was the DM100-AC, which can often be found on eBay for around six bucks. There is little documentation on these boards, but they seem to have quite a following on a particular Christmas decoration forum.
These boards are quite sophisticated, combining a STM microprocessor, two MAX1487 RS-485 transceivers and a three channels of 300mA constant-current LED drivers. The supply voltage is from 9V to 24V and the board features built in rectifiers and a large electrolytic capacitor for power filtering, so you could power it using an AC wall wart, although DC works fine too (there seems to be a variant without rectifiers, the DM100-DC, available as well):
At the top, there is an unpopulated header which I presume is for programming, conceivably one could load new firmware into these boards, but sadly none of the unused GPIO pins are exposed as pads on the PCB, limiting the possibilities of using this as a generic dev board. This header does provide access to 5V and GND, which I was hoping I could use to drive the Arduino Nano. However, the power regulator is a 78L05, which is rated for 100mA, so probably not enough head room.
In my next installment, I'll discuss the interfacing of the DM100-AC to the Arduino.
So, I was able to find Vincent's github. It was hiding in plain sight. Although his objectives were most similar to mine, his project demonstrates one of the difficulties in dealing with these Milight bulbs: there are actually several 2.4 GHz radio chips out there that can be used for interfacing these bulbs. The bulbs and remotes themselves seem to have a radio called the PL1167, but radio I bought for this project is something called the nRF24L01+. Browsing the datasheets, these radios appear to be completely different beasts, but apparently some really smart fellow managed to coax them into speaking the same language. As clever as it is, this mimicry does make understanding the how things work a bit harder.
Anyhow, since Vincent's code targeted the PL1167, and I had this other radio, it wasn't able to run his code directly, but looking through his code, I was able to determine why I had originally been unsuccessful with OpenMili. There are actually four different models of MiLight bulbs and four different remotes. I offer a picture of three of those:
OpenMili only supports the RGBW model and I had been doing my testing with the RGB remote. Luckily, as I own all three, switching to the RGBW wasn't a problem. I am now able to get some captures going:
Not bad! (a big hint: If you are using OpenMili, "xr" starts a capture). I guess this is a start, but it does show that the original OpenMili repo isn't complete and does not support all the styles of remotes. It seems like Chris Mullins WiFi Gateway project may have significantly expanded on the original OpenMili work, so I'll have to explore that next and see whether I can pick out the bits of code I need to get the other remotes to work.
Or, I could simply proceed using just the RGBW remote for now. We shall see...
Cloned the openmili project and made my first attempt at trying to get the MySensors Nano RF Shield to detect any sort of packets from my remote, no dice. Still many questions to be answered, but getting a better understanding of the task that lies ahead.
There are several related projects out there that might provide clues, such as this and this and this, but one key differentiating factor is that these projects on sending commands to such lamps, rather than what I want to do, which is receive commands from a remote. Essentially, I am trying to make my own Milight-compatible lamp, which is compatible with the proprietary Milight remotes and Milight gateway, which I already own.
The only lead I've found so far that appears similar to what I am trying to do is this, but while there is a mention of a github page, a link to it is nowhere to be found.
Okay, everyone. I've created a concept video to demonstrate the goals I have for this project:
What is shown in the video is the mechanical prototype of my motion lamp you may remember from an earlier project. This video is a concept of the controller I want to make. The remote control does not actually work, nor does the lamp have any real electronics in it.
The lamp is hardwired to the DM-100AC, which in turn is hardwired to the 12V adapter. The DM-100AC is simply going through its built-in demo cycle, so there is no Arduino and the remote is there just for show.
The lamp is being turned by a microwave turntable motor in the base. This is a 120V AC motor with a separate AC power cord and no control at all. The plan is to replace the AC motor with a small stepper motor so it can run off the same 12V DC as the rest of the electronics. It would also be under the control of the Arduino, so the I could use some of the extra buttons on the remote to vary the speed.
The mechanical mount for the LED arm needs to be totally redesigned. Right now it is sits in place loosely -- half way though the video you see it catches a ride with the turning globe and flashed the LED at you. It shouldn't do this, but it looked kinda cool so I left it in the video.
There's still a lot of work to be done to make this lamp robust enough for actual use, but it looks kinda nice in the video!
Basically extends DMX512 to run via NRF24 modules, and has some useful demo code for things like direct PWM and such.
DMX plus something like Q Light Controller Plus allows you to program full shows, open source. A real (not a clone) FTDI chip also shows up in QLCP as a DMX device (as someone used it for one) and so if you have some NRF24 modules, an Arduino, and a FTDI programmer, you actually have an RFShowControl transmitter already.
Hi Daren, RFShowControl looks interesting, but the only reason I am using the DM-100AC DMX controller is because it was most inexpensive way I found to get three constant-current drivers for an RGB LED. The DMX functionality is actually an obstacle here, because DMX uses differential signalling and I have to play some tricks to connect it straight to the digital I/O pins of the Arduino. For my purposes, it would have been better if this had three PWM inputs rather than a DMX interface, but I couldn't find anything as affordable as this.
You actually skip over the DMX layer entirely here. It is just how QLC+ defines the data structures.
The transmitter is a FTDI + Arduino + NRF24 module. The receivers are NRF24 modules + Arduino and you can have as many as you want.
The output is PWM or whatever you can produce on the Arduino from those 0-255 stream of values at about 20Hz <EDIT> 30Hz </EDIT> update frequency, and you can receive either the entire stream, one segment, different channels, etc... there.
Use a 3.3v Arduino and all you need is a 4-12v power source, the Arduino, and the NRF24 module for the receiver (and maybe a capacitor if you ever plan on transmitting with your NRF24 module) I actually skipped the power supply too and used a large value capacitor/resistor/zener diode as my power source... and it worked fine. Although you would kill yourself then if you tried to program it while plugged in... :)
Take a look: at https://github.com/komby/RFShowControl
Basically extends DMX512 to run via NRF24 modules, and has some useful demo code for things like direct PWM and such.
DMX plus something like Q Light Controller Plus allows you to program full shows, open source. A real (not a clone) FTDI chip also shows up in QLCP as a DMX device (as someone used it for one) and so if you have some NRF24 modules, an Arduino, and a FTDI programmer, you actually have an RFShowControl transmitter already.