## RGB colour correction

So I’ve been playing with different colour correction techniques for my LED’s.

So here’s a simple one. Square it. Well ok, square it then divide through by the upper value (square and scale.) So:
`unsigned int value = (i*i)/255;`

which sort of works. But it’s a little jumpy in the lower regions, as the mapping looks like,
(0,15)->0,
(16,22)->1,
(23,27)->2, ect….

The next I’m trying is something called Quadratic interpolation using a Lagrange Polynomial. BIG words for a curve of best fit. It works by generating a polynomial through a number of pre determined points. I have worked it out using 1->1, 255->255, and then 128->c. I can then change c, effectively changing the correction to the colour. Only problem is that it gets a little complex. So the maths formula is;

(-cx^2 +256cx -255c+128x^2 -16639x+32640)/(16129)

I attempted and failed to implement this as Arduino isn’t really the right platform for doing this kind of arithmetic. It works in excel ‘tho and produces a lovely graph.

A graph showing various possible curves

The Black curve in the graph is actually the square and scale method above. The other are for various choices of c.

So I quickly mapped the first 32 values i->x to the 32 LEDs I have and they are quite linear, from there on I found every bank to be quite similar. Which led me to the conclusion that for small values a one to one correspondence was ideal, then a kind of s curve would be ideal. I tried a few cubics but they were quite complex to implement and even tried a quartic.

So back to a basic square and scale I think for now.

## Gamma correction on RGB LED’s (or something like that).

So today I’ve been working with some RGB LED’s once again and I’ve notice (or rather re noticed) how non-linear LED’s appear.

A bit of background: I’m working with 5050 type LED’s with ws2803/1 drivers, so each LED gets 8bit PWM for Red, Green and Blue LED’s. The problem is that when you drive the LED’s with signal, zero is off, and 255 is the brightest, but 128 is brighter than half brightness. So in fact the input data to the perceived output level appears to be non linear.

So I could just work out a mapping of input values to output values, but that’s not very smart is it… I could use some primitive squaring to obtain a kind of gamma correction, of I could use some Maths (yes Maths is Maths and not Math!). The only problem there is that my ability to create a complex but awesome function way surpasses the abilities of the Arduino I’m using to drive the LED’s. Might have to get creative on this one…

Anyway here’s some LED’s to keep everyone happy,

## re-visiting racks

Today I’ve been tidying up some paperwork and I came across some old cut plans for making racks. The thing that I was working on was – how much can I get from a 8 by 4 sheet of 18mm ply?

My initial rambling drawings show that I can get 3 4u racks from a sheet or a 14u rack from a sheet. But I thought seeing as I have a few spare moments I’ll draw up the cut sheet and then I thought why not actually work out what the maximum size I could get would be? Lowe and behold apparently I can get 3 5u racks from a sheet or 1 18u rack, which is better than I thought possible.

Anyway – here’s a quick model I knocked up in SketchUp, and a pdf cut sheet for making three of the racks (with lids) from one sheet of ply.

5u rack model

5u cut sheet

## DMX opto isolator and booster

Today I made a prototype of my design for an opto-isolating booster for the DMX protocol. And well it worked so I’ll continue with designing a shell type booster. It uses a 6n137 opto-isolation chit and a 75176 RS485 bus driver chip.

Here’s what it looks like on the bread board.

opto isolation prototype

## Intelligent fixtures as follow spots part 2

I tried my Lego prototype today with a moving head. The results weren’t as good as I was hoping. After a bit of tweaking and jiggery pokery, managed to get the moving head to move in sync with me moving the tracking system. By ‘in sync’ I mean the same directions and speeds, but not scale yet (although it was close), and managed to use both of the handle encoders to change the dimmer of the fixture (individually and not both at the same time – that would be silly!).

Rite now there is one problem – it’s Lego. The problem is accuracy of movement to encoders and there is an error here. As you move the Lego, you have some play in the parts before the pots sense the movement, and this means it is not accurate. So until a more accurate device in the real world (out of laser cut wood, with 20bit or more AD’s) can be made, this project is on the back burner. (Plus I need to focus on my studies.)

For those interested in where I got to, have a look at the pictures in this post, and the code below – it is similar to the code for the simple DMX desk here.

#include <DmxSimple.h>

// this is the code for a track pod idea and it takes 4 analogue ins to
// a number of analgue outs.

// this code channels is for a mac 250 mode 2
// 1 strobe
// 2 dim
// 3 colour
// 4 gobo
// 5 gobo rotate
// 6 focus
// 7 prism
// 8 pan
// 9 pan fine
// 10 tilt
// 11 tilt fine

// two in’s are for pan and tilt – so the 10bit will need to be translated
// to 16 bit and split up and sent on channels 8+9/10+11,
// one will be used for dim and one will be used for focus. both will need
// 10->8bit reduction.

void setup() {
DmxSimple.usePin(3);
DmxSimple.maxChannel(512);
}

void loop() {
// read the value from the sensors:

//need to change from 10bit to 8bit
value3 = value3 / 4;
value4 = value4 / 4;

//spliting the 8bit output from the 10bits.
int valuep = value1 / 4;
int valuet = value2 / 4;

//spliting the 2bit output from the 10bits.
int valuepf = (value1 – (valuep * 4)) * 64;
int valuetf = (value2 – (valuet * 4)) * 64;

//output
DmxSimple.write(2, value3);
DmxSimple.write(6, value4);

DmxSimple.write(8, valuep);
DmxSimple.write(9, valuepf);
DmxSimple.write(10, valuet);
DmxSimple.write(11, valuetf);
}

## Intelligent fixtures as follow spots

The other night while working on an event I though about this and well – “how hard can it be?”

So i’m currently designing and looking at building a tracking system (similar to the Martin TrackPod) that will allow the user to change a moving head or scanner fixture into a follow spot over DMX. I plan to be using Arduino for this project and If I can get the maths to work this will become a very advanced and feature rich project.

Stage 1 will be to create a input system to track the users input and produce DMX from it. (Did I mention I like Lego?)
Stage 2 will be to increase the interface features and add extra use input such as basic mapping and dim/focus input parameters.
Stage 3 will be to introduce wall mapping and multi-fixture support.

Update: Lego prototype with 2 pots attached.

Lego TrackPod

Update: Lego prototype with 4 pots and cables attached. (A mess but it is only a prototype.)

Lego Trackpod with cables.

## General purpose flightcase from one sheet of ply.

So today i’ve been working on a general purpose flightcase that’s suitable for many things but some of the uses I imagine I will be using it for;

• Dual Mac 250 flightcase,
• 32 channel multi-core,
• Power and audio cables (maybe even 63/3)

Measurements (external) 800*500*588+wheels

Here’s a half way through taster pic… excuse the mess.

Part way through build

## A simple Arduino DMX controller

So recently i was testing some old Clay Paky Pin Scans with a friend and i reached for a simple 6 channel DMX controller we had in the workshop – only to find that it was broken :(. So i thought to myself how hard can it be to make one? After all it’s simply some faders (potentiometers) some A/D and a chip to read the values and convert them to DMX code and transmit them. SIMPLE.

Well actually yes it is. Arduino offeres an open source platform for doing this and best of all – the hard work has already be done. http://www.arduino.cc/playground/Learning/DMX shows work that others have done and DMXSimple is an install-able library that makes the sending of DMX well, simple! Continue reading