Bringing state-of-the-art LED Lighting to Hobbyists

Saiko5 Firmware

The firmware used in the Saiko5 WiFi LED Light Fixture is open source and freely available on our Downloads page. It is designed to run on either the arduino, or the maple hobbyist systems, and to integrate with the Light Shield WiFi extension board. The code is originally based on the async_labs WiShield, but with modifications to improve stability as well as add Open Sound Control library support to allow the board to receive commands over UDP in the Open Sound Control format.

To make use of the firmware files, download the saiko5 repository, as well as the WiShield repository and make sure that the WiShield repository is correctly placed in the libraries directory of the arduino-sketchbook folder. The arduino environment must be configured to use the arduino-sketchbook folder as it's sketchbook in order to ensure that the libraries are properly located.

In the arduino-sketchbook folder, located at /saiko5/firmware/arduino-sketchbook/, there are two project examples along with the libraries.

smooth_fade

smooth_fade is a very basic example adapted from the arduino fading tutorial by David Mellis. In this simple program example, the way to change the PWM output connected to a red, green, and blue LED is demonstrated.

#define delaytime 5
#define fadestep 1
#define redPin 3
#define greenPin 5
#define bluePin 6

This block of code sets up the basic configuration variables. redPin, greenPin, and bluePin are defined to correspond to the arduino/maple pins which are connected to the LED light fixture through the five pin header on the Light Shield board. If you are not using this firmware with the Light Shield board, you can change which pins are used here. fadestep is the brightness increment per timestep, and delaytime is the delay per timestep. The remainder of the smooth_fade program fades the LED light from red to green to blue using the analogWrite function to set the PWM value on each output.

LightBrick

The LightBrick folder contains the two primary files for the Saiko5 firmware that is actually used in production, along with the liblo and WiShield libraries found in the libraries folder. The file LightBrick.pde contains all of the basic configuration and startup, including network configuration. In order to configure a device to connect to your own wireless network, the configuration information here must be updated. The setup function tells the light to initially shine low power red light, followed by WiFi initialization, and once WiFi initialization is finished and the device has successfully connected, it briefly flashed blue before turning off light output. Subsequently, it runs the WiFi.run() program to handle packet reception.

The file udpapp.c contains the actual event handler for receiving a UDP packet on port 2222. Not in particular the function udpapp_init, which configures the UDP server. The default setting tells the light fixture to only accept UDP packets on port 2222, originating from the IP address 192.168.1.2. If your actual server is located at another IP address, this *must* be changed or else the lights will ignore the data being sent to them.

After initial configuration of the network stack to accept packets as needed, the parse_msg function actually handles parsing UDP packets that are received. First, the incoming packet is deserialised using lo_message_deserialize, which converts the UDP packet into an OSC message. If the deserialization fails (i.e. a bad packet was received, or a non-OSC packet was received), it does nothing. Otherwise, the firmware pulls out the three floats attached to the OSC packet and puts them into the fRed, fGreen, and fBlue float values. Next, this value is written to the output pins using analogWrite. In the case of the Arduino, this value is made into an 8-bit integer by multiplying by 0xFF and recasting as an unsigned char. However, the Maple is also capable of 16-bit PWM, so this can be modified to multiplying by 0xFFFF for higher resolution PWM. The use of the Maple in 16-bit PWM mode allows for 281 trillion distinct colors to be produced, compared to the 17 million colors which are typical of 8-bit PWM displays (and most computer monitors). In our experience, 8-bit color generally looks "fine", but the smoothness of fades is better with 16-bit colors, especially for low intensities.

Installing firmware

To install the firmware, you will need to first install the Arduino or Maple development environments. Please see the instructions and basic usage information available from the manufacturers for more information. In the case of a full Saiko5 fixture, the arduino programming USB port is exposed on the side of the case for easy modification.

All Content Copyright © 2010 saikoLED, LLC or Brian Neltner
All Rights Reserved