Vagrearg Logo  
 
OSAA Skilt 2.0
Dioder plus Softwarehack equals Lightshow
At the local hackerspace OSAA, Brix made a Plexiglas sign with a milled logo late last summer and had the brilliant idea of using the Ikea DIODER gadget. Then, Rohde made the first software hack and a solder-less programming interface (see below). He reprogrammed the gadget to show some colors, but the project stalled soon thereafter. Writing software is hard work.
There have been several hacks using the dioder gadget (again recently at hackaday), referring to a nice description of the hardware by Christian Amsüss. However, all these hacks lack a feature rich software replacement. Sure you can write it yourself, but writing software is hard and requires a lot of time.

Then I decided that there was significant need for over engineering and suggested some ideas. With a "What?" reception of my vision and a "You do it" attitude, I started coding.
osaa-skilt pin-programmer-dioder

The features envisioned:
  • Full 256 step PWM for each of the RGB channels
  • Additional LED indicators on free I/O pins
  • RS232 serial interface (RX only)
  • Multiple modes of operation
    • RGB ramp
    • Static step fixed colors
    • Random RGB color
    • HSV cone circling
    • Single HSV fixed color
    • Serial mode
    • Off
  • Speed and direction control for changing color schemes
  • Saturation/Value control for HSV cone circling
  • Hue/Saturation/Value control for fixed color
  • Store/restore set values
  • Internet control via serial interface

Index

Hacking the gadget is not easy when you need to program it many times. Especially the "real thing" is in circuit and not easily accessible. But when I wanted to buy a new one at the local furniture pusher, they were sold out, sigh. Then I remembered that the Pickit2 came with a dev-board with a PIC16F690, which is basically the same as the PIC16F684 (which is used in the dioder), just has a few more pins and modules. I decided to make a mock-up version on my breadboard to hack the software while relaxed at home.
test-circuit
The mock-up has RGB LEDs on the output, three switches, potentiometer for analog input, extra LEDs on the unused pins and a serial input from a RS232 level shifter. It is directly powered from the Pickit2 and can be reprogrammed on the fly, without any fuss.

The schematic diagram including the modifications:

ikea-dioder-control
Schematic as PDF.
Schematic gschem source.

First implemented change was the addition of the extra LEDs (IND[1..4]). A couple of 0805 smd LEDs and resistors are soldered on a small veroboard piece and placed beneath the plastic. The PCB is held in place with a bit of hot-glue. The LEDs are luminous enough to be clearly seen through the case.
leds-mounted-back leds-mounted-front
leds-on-a-board  

Running Modes

Button S2 advances the running mode (cyclic) from the list below. Mode-settings can be changed with the wheel while holding down indicated buttons.
The buttons are mapped from left-to-right: S3, S2, S1 (as seen with the buttons at the bottom).
ID Mode Description
0 off All LEDs are off
1 rampage LEDs cycle through rainbow colors at full strength
S3set speed
S1reverse direction
2 step A fixed set of colors is displayed sequentially
S3set speed
S1reverse direction
3 random A pseudo random set of colors is displayed
S3set speed
4 wheel LEDs cycle through the HSV cone, the buttons S1 and S3 are used to select the color with the wheel:
S3set speed
S3+S1set value
S1set saturation
direction depends on previous setting
5 fixed A fixed color is selected, the buttons S1 and S3 are used to select the color with the wheel:
S3set hue
S3+S1set value
S1set saturation
6 serial Only serial input changes the colors
7 unused advances to mode off

Serial Protocol

A two-byte sequence is used for communication, where the first byte (command) has the highest bit set and the second byte (data) has the highest bit cleared. The serial speed and format is 1200 Baud 8N1 (2400 is possible but not 100% reliable; any faster is not reliable at all).
The host sends a command-byte followed by one or more data-byte(s). Each command is executed at the reception of the data byte. If multiple data bytes are sent, then the previous command remains in place and is used. The ommision of the command byte reduces the communication overhead for fast changing data.
Cmd Byte 0 Byte 1 Size Range Description
1 10000--- 0-------     Nop
2 11000000 0-hsvrgb 6 mask Swap active and shadow values
3 11000001 0DMd-mmm 1/3 0..1/0..7 Set direction/running mode
4 1100001d 0ddddddd 8 0..255 Set running speed
5 110001-- 0-------     Nop
6 1a001--r 0rrrrrrr 8 0..255 Set Red
7 1a010--g 0ggggggg 8 0..255 Set Green
8 1a011--b 0bbbbbbb 8 0..255 Set Blue
9 1a10hhhh 0hhhhhhh 11 0..1541 Set Hue
10 1a110--s 0sssssss 8 0..255 Set Saturation
11 1a111--v 0vvvvvvv 8 0..255 Set Value
Legend
-don't care, should be set to 0
a0: store in shadow register
 1: activate immediately
D0: ignore direction bit
 1: set direction
M0: ignore mode bits
 1: set mode
Note 1: The data values of the commands are split where the lower 7 bits are in the data-byte and the upper bit(s) are in the command-byte.
Note 2: multiple data bytes are only useful if the initial command byte has the "activate immediately" bit set and the high bit(s) of the data does not change (except for direction or swap-command).

Now that the software is running, more images of the inner life.
leds-serial-usb
usb-connector


Software

The entire stack is at OSAA's GitHub repo https://github.com/openspaceaarhus/ikea-sign.
The firmware is complete and functional. It should run on any DIODER gadget with or without the additional hardware. The firmware uses the EEPROM to store the configuration (yes, you can configure it). Parameters include startup mode, speed, direction and color. Speed, color and directional information is stored in the EEPROM on each change. Storing the startup mode requires you to press B2 (holding down) and then additionally B1 and B3.

Bugs: the added indicator LEDs do not change correctly when sending mode change commands over the serial port on the PIC16F684. This bug is not present on the PIC16F690 (my test chip). There is no functional impairment, just missing the correct visual indicators. So far, this bug has been classified under "programmer's brain-cells not smart enough to see the error".

And, of course, a QT test-app to control the DIODER via the serial port (only reliably scans ttyUSBx devices):
iqdhctl-screenshot

Todo: get the PC running with a daemon and a camera. Then show the world how they change the colors ;-)

Posted: 2012-01-04
Updated: 2012-01-04

 
 
Overengineering @ request