THE HISTORY
pimcw project need some background history, let me tell briefly.
Some time ago my wife was doing some 'scrapbooking' craftwork on her spare time. One day he talked to me about letters built with carton, and showed me some pictures on Google. On one of these pictures there was a carton letter filled with some bulb lights that looks very nice. These carton letters was just filled with many lights following the letter shape and simply connected in parallel to some voltage source. I thought we could do it better:
Why not to build these letters and add some 'electronics' to control its lights? That seemed a cool idea and finally pimcw (Pi Meets CraftWork) was born as a project.
In that moment i thought on a system able to control some Led lights using standard electronics so anyone who needs to add Led control on a model or any kind of craftwork or modelism could be able to do easily.
The must-do list:
-pimcw must be able to control some independent LED, and it's intensity.
-pimcw must be have possibility to perform some sequence on it's LED.
-pimcw must be able to be used as ambient light also, so remote control is also need.
My wife never built these carton letters...
LOOKING FOR THE BEST SOLUTION
At this time I have already developed some applications for Raspi using Qt platform and C++. So the base device was Raspi again plus a PCA9685 Ardafruit board to have some PWM channels able to drive Leds directly.
For the sequencing subsystem I choosed MIDI because I always have thought that MIDI could be perfectly used for automations due its number of channels and velocity parameter. Also the idea was to able everyone to use its favourite MIDI sequencer or DAW. In this case velocity controls the PWM duty cycle and MIDI note messages controls the PWM channel ON and OFF. Perfect match.
THE IMPLEMENTATION
This solution have 2 parts. One, 'toniManero' application, runs in Raspi and controls PWM on PCA9685 outputs by i2C according to incoming MIDI data through Ethernet UDP Socket.
The other part 'discoFever' is able to get MIDI data and send to 'toniManero' through Ethernet UDP Socket. 'discoFever' in my case is a Windows application. And for the MIDI to 'discoFever' link i have used an amazing virtualMIDI driver from Tobias Erichsen. This driver allows to create virtual MIDI devices at runtime that you can interface from your favourite MIDI Sequencer or DAW.
Here is a big picture about:
And as a last requirement 'toniManero' had to permit to be used as ambient light controler (not light sequences all the time!), so it also has a built in web server with a simple interface to control outputs individually with intensity control.
THE CODE
All the code is available on Github except Tobias Erichsen stuff. You have to go to his page and get the driver and SDK in order to compile and test. All has developed upon Qt 5.X with no special requirements.
Binary files for Raspi are also available, so you can easy have a web based PCA9685 controller without write a line of code.
THE CURRENT USAGE
Currently I am using 'toniManero' to control some lights at home. You will find in the /hardware/schematics folder a schematic for a PWM to 220VAC capable to control standard incandescent light bulbs.
An this is very usefull. As 'toniManero' has also a built in RPC server you can control it via its own embedded web or either by curl calls. You have an script example like I am using with crontab to automate the lights in /release/arm folder.