I’m experimenting with Netduino Plus, primarily for learning how .NET Micro Framework and C# can be used for control, sensing, telematics etc applications.
The first project I sketched out is about controlling an RGB LED for color effects. That sounds rather dull right, but with a few layers of abstraction it became slightly more interesting.
The following is the abstraction I applied to the solution, most of them split up in individual classes:
- Perform a sequence of patterns cyclically, controlled by pattern and duration
- Perform a pattern cyclically, controlled by individual/parallel waves for hue, saturation and brightness, currently with the hopefully self-explanatory patterns Pause, SpectrumSlow, SpectrumFast, Fire, Candle, Chaos, PulseWhite, PulseRed, PulseGreen, PulseBlue, PulseSpectrum, PulseWhiteFast and FlagSwedish.
- Perform a wave, controlled by time signature, wave type (flat, square, ramp up, ramp down, triangle, sine or random), period, coarseness, offset and amplitude
- Set the color using hue, saturation and brightness (HSB)
- Set the color using red, green and blue (RGB)
- Set the pulse width modulation (PWM) ports for the red, green and blue pins of the RGB LED
I used floating point whenever it made sense, to get enough precision, but still with performance in mind. Netduino is fast enough for floating point operations, despite it being implemented in software. For commercialization I would have to replace all that with integer math to be able to move to a much smaller and more cost-effective MCU solution. E.g. Atmel has 6-pin MCUs with PWM ports, that would fit nicely for this solution. Pre-configured sequences and patterns could then be selected via thumb wheel switches.
New patterns and wave types can be added, but at least in terms of waves I’ve covered the most useful.
The ARM7-based Atmel AT91SAM7X512 used in Netduino is a really nice 32/16 bit MCU with a lot more ports than the ATMega MCUs used in original Arduino boards, enabling much more advanced applications, and fits well with the bigger form factor of .NET Microsoft Framework and programs written in C#. I just wish Netduino ran Linux, as there’s really no OS in Netduino, only a call library.
I will start looking at the support for TCP/IP and Micro SD now, to see how I can use those features in projects. For instance I’ve considered making a LAN-attached MIDI device, so that MIDI instruments could be accessed over wired or wireless LAN, extending the reach substantially.
This video shows a sequence of all currently existing patterns. At night time and with a full diffuse cover it looks much more impressive.