I already had a CC3000 breakout module from adafruit at my hands, and so I started to experiment with one of the analog inputs and a simple sliding fader, and I was able to dim a light wirelessly. Awesome!
|First basic setup, running off a battery for testing|
One of the things I wanted to achieve was automatic discovery of the PiLight server using UDP Broadcasts. The CC3000 library was not really very supportive with this, but I got it to work after all using some low-level socket functions.
To make something useful out of my experiment, I ordered a few components: I hooked up an MSP3208 ADC chip and some more faders and pots to the existing setup. I added a 74HC165 parallel-to-serial latch and a rotary encoder. To display useful as well as not-so-useful information, I added an HD44780 2x20 character LCD to the setup. All this went into a handy little console case that was sitting in my attic for the past ten years or so.
|Laying out the components (Motorized faderes are too big for this project. Maybe next time.)|
|Components in place, working on the ADC code and testing battery life once more|
|Adding the LCD display|
While making progress with the firmware for the Arduino I started to notice unpredictable network connection dropouts and sometimes complete processor freezes. I tried a lot of debugging and could not really get any real results. After some research on the net I quickly found out that this seems to be quite a common problem of the CC3000 chip, and that there was very little I could do about it.
I really thought I was stuck at this point, but since the remote was working fine as long as the network was stable, I did not really want to scrap the whole project. Luckily, I stumbled across a new wireless development platform: enter the Spark Photon, featuring a 120MHz processor with integrated WiFi on an incredibly small form factor. There is also a handy battery shield available from SparkFun that is designed to run the Photon from a single-cell LiPo battery, plus the power consumption of the Photon is lower compared to the Arduino / CC3000 combo. A lot of advantages for the project at hand. Even porting the code was pretty simple, since the Photon uses C as the Arduino does, and all the libraries I used so far were available as well.
At this point I added a few more buttons to be able to trigger macros or effects, and I hid a LiPo that was originally intended to run an iPod under the main board. That little battery gives me 6-8 hours of uptime, which is plenty.
I did a pretty awful job with the openings of the top of the case once more... I still have no idea how to get a proper case done without a CNC machine or 3D printer unfortunately. But hey, it's working!
A few things are still to be done, though: The charging circuit still needs an external power connector, right now I have to fiddle a USB cable into the circuitry to charge it up. And I'd like to light up the buttons to be able to show whether something is turned on or off. I guess I'll be using another PCA9685 for that job, with it's 16 PWM outputs it would be perfect to put an RGB LED onto each one of the buttons, and with the last channel I might even be able to dim the LCD backlight.