Wednesday, September 15, 2010

Learning PWM with Illuminato Genesis and TouchShield Slide

With the relaunch of the Illuminato Genesis (which was featured on Make Blog a while back), I figured I'd whip together an app that showed off the what the Illuminato Genesis can do. I've been spending a lot of time with the BeagleBoard recently, and that's clearly a top end type device, but the Arduino and Illuminato Genesis plus TouchShield Slide make a nice gadget at the lower end of the spectrum, especially for smaller handheld apps.

I've wrapped everything up into an app on the Open Source App Store over here. The app includes 3 files:

  1. - This should be dropped into folder: hardware\arduino\cores\genesis\src\components\library
  2. TouchShield_Pulsing_Sleep.pde - This is a sketch that implements the PWM duty cycle value to the Illuminato Genesis, using the bling() function
  3. Illuminato_Serial_Bling.pde - Listens for PWM duty cycle value from the TouchShield and controls the virtual bling LEDs on the front of the TouchShield Slide
The Illuminato Genesis has an array of gold-rimmed LEDs on the backside of the board, which can be called using a function in the Antipasto Arduino IDE library called bling(). bling(1) turns the LEDs on, and bling(0) turns them off.

So the first step was to implement PWM light control, which is accomplished with this snippet of code:

/* Software PWM modulation routine */
void pwm_bling(char duty) {
  int duration;

  duration = (millis() - pTime);

  if (duration <= duty) {
  } else {

  if (duration >= period ) {
    pTime = millis();

Then, using serial communications between the Illuminato Genesis and the TouchShield Slide, the PWM'ing is synchronized so that both boards are pulsing at the same speed. The effect is pretty cool looking, if you ask me. On the one hand, you have real LED's on the back of the Illuminato pulsing, and then you have virtual LED's on the TouchShield Slide's OLED pulsing.

Here's the video:

And here are some other pictures:

No comments: