Digital Colour Light Sensor

With the earlier efforts in halving the size of Lightlog also came a need to change the components used for sampling light. The previous designs using four light dependent resistors (LDRs) behind coloured filters, one for each red, green, blue, and a clear filter for white, takes up a large amount of the board space. The LDRs tolerances are also usually not all that close, perhaps up to 10% variation, so they each required calibration in software at testing at different levels of light intensity. Quite a manually intensive process when trying to build more than a handful of devices!

The solution to all this is to switch to an integrated digital light sensor that combines all colour sensors into a single chip, pre-calibrated, and in a tiny surface mounted package. After much searching and testing, the TAOS TCS34725FN seemed to be the best choice. It has a wide light dynamic range, and uses a built in infra-red (IR) filter to block IR from the sensors – preventing erroneous colour signals in some lighting situations as sunlight has lots of IR component. The sensor also connects directly to the existing I2C interface used by the 64Kbyte EEPROM memory already in Lightlog, this has the pleasant side effect of freeing up four pins on the micro-controller that can now be used for extra features.

The new sensor does need a fair amount of extra code to configure correctly, take readings, and then process the data, but it does give more consistent data that’s, at lest theoretically, much finer in resolution.

A Simple Light Logger

Basic components

So, what do you actually need to make a working light log? The simplest set of components would start with a sensor, something like a light dependent resistor (LDR) changes resistance as the amount of light shining on it varies. A photo transistor is another option as these generate a small voltage you can measure, the brighter the light, the higher the voltage. You then need a micro-controller to read your choice of sensor, perform some simple processing on the data and record it to memory, something like a PICAXE-08M2 is enough to get started. Low cost micro-controllers often only have a few kilobytes of internal memory at best, only good for keeping a day or two worth of logged data. Adding  extra memory storage is a reasonable decision – for prototyping, I’ve been using a 24LC512 64K EPROM (a type of memory that keeps its content even if power is lost). 64K is easily enough for a month or two of samples every 5 minutes. The circuit then needs an external interface to allow the data to be easily synchronised with a computer. This step is more tricky to do at a reasonable price, USB is one option but requires using a more expensive micro-controller supporting the USB standard; the same is true if you want to use the Bluetooth wireless standard, wireless can also be a drain on batteries unless you use the latest Bluetooth standard, BLE (which unfortunately is only compatible with newer phones and tablets). In the Light Log prototypes so far I’ve opted for a simple serial interface, easy to setup and use for testing – though it does require a somewhat more expensive serial to USB cable to connect to a laptop. Finally your circuit need a power source. The first prototypes used two AA batteries for a 3V supply, but this isn’t to practical if you want to clip them to your t-shirt :) Luckily you can get 3V coin cell batteries, about the size of a pound coin, much easier to attach. Coin cells store a lot less energy verses two AA batteries, but for a low power circuit like this, it should at least be good for several months use.

Breadboard prototype

Combined with a few extra resistors (10K, 4.7K and 22K ohm) these parts are enough to start logging basic light brightness data. The sensor will need calibration if you want to be able to indicate lux level values (a standard unit for visible illumination), and if you want to record colour temperature you’ll need a total of three sensors – one each for red, green, and blue.