For a while now, I've wanted Banu to do interviews of makers of things with free and open designs. Being a fan of PingMag MAKE, it was apparent that there was a lot of hard work, learning, fun and satisfaction to be had in making. It's too bad that PingMag shutdown, but they still inspire. So when the ColorHug comes along—an open hardware product related to graphics—there's no better time to start interviewing. Solder when the iron's hot!
The ColorHug is a colorimeter
that can be used to calibrate computer displays. It was created
by Richard Hughes
hughsie). It is a fully open hardware project, and the
design, drivers and firmware are available on the Gitorious
code hosting website. From the branches and commit logs it appears that
others have taken an interest in its development too, and have begun to
contribute to it.
Without further ado, here's Richard Hughes.
Who are you? What have you been doing so far? How did you get interested in computers, electronics and building stuff?
My name is Richard Hughes, and I'm a programmer in the desktop group at Red Hat. I created and now maintain the following projects: upower, PackageKit, colord, shared-color-profiles, shared-color-targets, gnome-color-manager, gnome-power-manager and gnome-packagekit. From right since I was a little child, I was always taking things apart and making new things, and so my degree choice of Electronic Engineering shocked none of my friends or family. Whilst at University I got into writing code, and specifically open source code. I started hacking on low level userspace bits and the kernel, and then after my masters had finished I took a job at a large UK defence contractor. It was pretty much the opposite environment to open source, and as soon as Red Hat asked if wanted to hack on cool stuff full time I jumped at the chance. Although I'm hugely privileged to spend all day writing free software, I've always missed making things, and I figured I could do something with open hardware as a hobby.
How did you end up in computer graphics / color management?
When I bought a digital SLR camera, my wife paid for me to go on a course to learn how to use the camera properly. During this course I used OSX for the first time, and came to the realisation that the color stuff just worked. No messing around on the command line, no technical jargon, it just worked. Color Management on Linux was in sorry state of affairs then, and I thought I could do something about that.
What is the ColorHug? What is a colorimeter?
A colorimeter is a device that attaches to the screen and measures the actual colors output by the computer. It allows us to see what color is actually being shown to the user, rather than what color the computer thinks it's showing the user. Using lots of these samples, we can apply a correction profile to the screen to make images look as they ought to look. As LCD panels get older, they get yellow and dull, and even CRT monitors have phosphors that degrade over time. This means you have to calibrate every few months to ensure that the colors match what they should.
The ColorHug is an open source colorimeter. It's designed from scratch, and every part is 100% open source. All the other colorimeters you can buy in shops have proprietary code that means we have to reverse engineer the hardware to make it work on Linux, and then we can't modify the hardware to do something else, or fix bugs and add features like you can with open source hardware.
What information is in color profiles?
A color profile is really just a binary blob of data that describes the color response of an input or output device. You can have color profiles that just encode the curves of colors as a set of matrices, or you can have color profiles that are made up of of huge lookup tables. You can also store arbitrary data in a profile, and so you normally store a lot of extra useful stuff there too like the model number of the device or the paper type for the printer.
What are the tech specs of the ColorHug? Does it use USB? Does it need a battery?
The device is a small USB peripheral that connects to the host computer and takes XYZ measurements of a specified accuracy. Longer measurements lead to a more accurate result, but take more time. The ColorHug has no battery and takes the few hundred milliamps it needs from the USB bus. The device has two LEDs that can either be switched on or off, or be programmed to do a repeated flashing with specified on and off durations. The device supports up to 64 calibration matrices, and by default 3 are provided which are mapped to LCD, CRT and projector, with 3 additional reserved types.
Tell us about the ColorHug's design.
The ColorHug is actually a PIC microcontroller that is interfaced with a TCS3200 light to frequency chip. The frequency is proportional to the amount of light, and so by enabling the red, green and blue photodiodes in the sensor we can combine these with a bit of clever maths into an XYZ color value. The PIC just controls the sensor and accurately counts pulses at high speed, and then responds to requests from the USB host to do different low level things.
What data structures / file formats do you work with?
Bit of an odd question, the answer is LOTS.
What are some of the unique algorithms used in the ColorHug?
I'm pretty sure there's nothing unique in the device, it's really simple hardware along with some school vector and matrix maths. The ColorHug is able to store custom CCMX matrices on the device, which is something that I was surprised that no other colorimeter vendor seems to do.
Can you walk us through the software path through various components of a Linux stack, when using typical ColorHug facilities?
Well, just taking a sample in
gcm-picker is a good
gcm-picker opens the ColorHug device
using colord, and asks
colord for a number of XYZ
samples. colord opens the device, and sets up some initial
parameters (e.g. sample time) and then does a write to the USB
device. When the write is complete, the host then reads the data back
from the USB device and transports it back to the application
What hardware tools do you need to build/debug/test this device?
To build and test the device, I need:
What software tools did you use to build this?
I used gEDA to design the schematic and PCB, and from someone that's used very expensive PCB design software like Mentor Graphics, it was super easy. The gEDA guys are doing a really good job. From a software side I use the "free" (but not open) Windows MPLAB compiler and then wrote all the firmware loader software myself.
What skills did you have to use in this project? Is this your first hardware project?
I used to work on designing test equipment for military flight computers, so I've got a fair bit of experience doing moderately clever things with very small components. That said, a few people have built the ColorHug board now who are just hobbyists, and it's refreshing to know the board is easy to build.
How did you go about building this project?
The "hello world" program is often the hardest part of a project. I probably spent about 3 weeks working with a PIC evaluation board just to turn on a LED from custom flashed firmware before I could be happy that the processor was suitable for the job. The other bits are easy, once you have that first flashing LED. I soldered the sensor onto a SOIC8 → DIP8 convertor board and then used some breadboard to wire it onto the evaluation board. From there I got the sensor working, and could sense the different colors.
What are the main components of the ColorHug? What are their roles?
How does the main IC sensor work? How does light get transformed into values you can use?
The sensor is actually an array of 64 smaller sensors, which are arranged in a grid of Red, Green, Blue and White. When the PIC reads the frequency counts for a given sample, it converts then into 3 deviceRGB numbers, which are converted using a calibration 3×3 matrix into the XYZ values. The XYZ values can also undergo another 3×3 matrix on the device, which converts the numbers to a given set of display primaries. This lets the ColorHug be calibrated against an sRGB screen and used on wide-gamut displays.
How do you calibrate ColorHugs?
Calibration involves taking about 500 samples of dRGB and then using
the Argyll CMS
ccxxmake to crunch the numbers into the best
calibration matrix. This adapts the dRGB color into an XYZ value.
How did you design the enclosure?
The enclosure is a standard black ABS box from Hammond, with two cut outs that I do with several wooden and metal jigs. When I've got a bit of profit, I'm hoping to buy some equipment to do the holes in a better and quicker way.
How does the hardware process commands sent via USB by the software?
From a device point of view it just sits and waits for an input
packet (64-byte buffer) and then parses the input. It then does whatever
is required and then writes out an output packet. Much more details
about what kind of data is sent is available in the firmware
specification header file
Here's a basic flow chart:
Client: set the sensor multiplier (the frequency divider) to 100% Hardware: OK Client: set the sensor integral time to 65000 processor cycles Hardware: OK Client: flash the green LED twice Hardware: OK Client: take an XYZ reading with the default XYZ matrix for an LCD display Hardware: OK, 123.45 67.89 34.56 Client: set the sensor multiplier to 0% (to turn the sensor off) Hardware: OK
Is ColorHug free hardware? What did you keep in mind when designing it so that it was easily hackable?
It's all 100% free. When designing the PCB, I had to keep in mind that people who wanted to build the PCB themselves were probably not experts in SMD rework. So, the PCB is larger than it could be, and I've deliberately used large 0805 components rather than the more standard 0603 size. The code is designed for accidental shorts, for instance the spare processor pins are wired up as inputs, and there's a watchdog timer to stop the hardware getting wedged. The LEDs help enormously when debugging, as they output Morse code in event of a hardware error.
What is Hughski Limited? How did you decide to start it?
Hughski Limited is a tiny company I set up to reduce the amount of personal liability I had. I'm naturally quite a risk-averse person, and so if some crazy lawyer decided to sue the company because his ColorHug poisoned his cat and ran away with his wife then they could claim all £66 of profit in the business rather than risking my personal savings. It's also a good way to work out how much tax you've got to pay at the end of the year if you try to keep the business and private finances separate.
I see that it's a UK registered company. What challenges did you face in creating this company? How much work was it? Are there other employees than you?
Actually creating the company is very easy and only a few hundred pounds. The hard bit is setting up the tax and getting all the permits you need to start trading. There are technically no paid employees, although I solder the boards and my wife sticks on stickers and screws the units together.
How do you intend to attract more people to use the ColorHug?
At the moment, there is a waiting list to buy the ColorHug, and so I'm not intending to advertise at all. I'm hoping that when people get their ColorHug and tell their friends, that will be all the advertising I need.
How do you source your components?
Most of the components are from China and Taiwan. Most are bought using big companies such as Mouser and Farnell, but some (like the IR cut-off filter) are custom made in China, and these are hard to obtain.
Do you intend to do other devices in the future?
I'm playing with the idea of making an open source three axis CNC machine, as I've found the hardest part of making the ColorHug was actually drilling the case to any kind of precision.
How does it feel to work on free hardware?
It's a bit unreal really. I was only going to make 50 devices, and I hoped that I would not be left with devices spare. Now I've got a few hundred orders and the community is starting to grow. That bit feel great.
Are the software parts entirely free? Are there any closed tools which you have to use?
I use the closed source MPLAB to compile the bootloader and firmware, but only because the open source SDCC compiler didn't work for me. At some point I'll have to put in the hours and fix SDCC, but until then I just need to get hardware out of the door.
Now that you have completed this project, what observations did you make in retrospect?
Well, the amount of cash it took to make a professional looking product is huge. The main problem is that most companies have a minimum order quantity of about 10,000 units, which is a ton of money for me on a project with no precedence. I've been lucky to find local companies that will take on small orders at reasonable prices.
In hindsight, I should have also worked longer on the prototype unit before announcing it to the world, as it takes quite a long time to convert a design designed for one unit, to a design that can be made in batches of 100. In the amazon-one-click world we live in, people don't like it when you announce its going to be 12 weeks until they get hardware.
Did you have fun? Does the ColorHug rock?
I'm still having fun, and the hardware seems to work for people, which is the main thing. Hopefully soon I can afford to pay myself something for my time, as up until now I've been buillding the units for free.
I am a GIMP user. Assuming GIMP supports a color managed workflow, how does one configure and use ColorHug on a Linux desktop?
If you're new to all this color management stuff, just fire up
gnome-control-center and click the color panel. Then click
"Learn more" and read
all the documentation I wrote for GNOME 3.2. The ColorHug is just
another supported device, so there's really nothing special you need to
Where it all happens
GNOME developer and free hardware hacker
That is all, readers. We hope you enjoyed this interview. If you have someone in mind to be interviewed, or you yourself want to be interviewed about your free hardware or software project, please email me the details or tweet @banubears. The ColorHug is offered for purchase at £48 currently. If you use Linux and are into graphics or hardware hacking, buy one and support its development. Happy hacking!