Adding Bluetooth LE

Bluetooth LE 4.0 module test rig

Bluetooth 4.0 LE (BLE) is a low energy, wireless protocol allowing communicating between devices. It only works well over a short distances, but that’s just great for a wearable device to be able to connect and synchronise with its wearers smart phone, tablet, laptop, or BLE enabled desktop computer (USB to BLE dongles are very cheap, just a few UK pounds).

When Lightlog project was first started BLE technology was too expensive to include, but after 6 months or so, lower cost modules started to appear on the market. Prices have now fallen past the point where it’s cheaper to include BLE than it is to use a USB solution (e.g. a USB cable and USB support circuitry needed on the device). There are some drawbacks with BLE as it complicates the software needed for both the Lightlog firmware, and the client app/application. BLE modules are also more power-hungry than using a physical USB connection, so extra attention is needed to make sure the battery life is not unduly affected.

Below is a close-up of the test setup for the HM-11 Bluetooth 4.0 LE part. The module is designed to be connected to a custom PCB board with surface mount pads, but here you see it manually soldered to individual breakout wires for testing on a breadboard. The connection pads on the module are tricky to solder to, any physical strain on the wires will easily rip a pad off. I managed to rip a pad off the first one I tried to test; not an auspicious start as back then they were about £10 each and I’d only managed to source 5 for early testing (now they are close to £5 each).


If you’re interested in some quick technical details… Apart from the usual power (2.5-3.7V) and ground, you only need two other pins to get it working, transmit and receive (RX and TX). The other two wires in the photo are only for testing and debug; one is a to a pull-up resistor to the reset pin (if you pull the pin down to ground for 100ms you can force a reset); the other connects to a small status LED that indicates if the BLE is in discovery mode (slow blink), or connected (solid on) – very handy while testing!

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.

Visualising Light Data

One of the goals of Lightlog is to help people engage with and reflect on light data they collect over time. Due to its size and power constraints, the physical Lightlog device has a minimal user interface (UI), just enough to display the daily light goal reached, and show if the current illumination is bright enough to be effective towards the daily goal (2,500 lux or above). Lightlog collects much more data than it can display alone, by synchronising to a device with a screen and more computing power, allows a rich, engaging, detailed views of your daily light profile, and the opportunity for additional analysis over the set of collected data.

The primary visualisation is designed around the full colour spectrum composing visible light. It’s an approximation of a full light spectrum as Lightlog records single sample points in the red (~614nm), green (~525nm), and blue (~468nm) frequencies; with a fourth sample unfiltered, capturing as much of the full spectrum energy as possible for lux calculation (an interesting future project could be to use many more sensors across the spectrum frequency to generate a high resolution spectrum with chemical absorption lines). For use with Winter Blues and Seasonal Affective Disorder, the three red, green, blue sensors provide useful information about the frequency of light exposure as some studies have shown shorter wavelength, blue light, is more effective, vs. longer wavelength red light.

Below shows an example image taken from real data displaying several days from November. Notice the relatively long nights and short Scottish days at this time of year.

Example Lightlog data for Nov 28-30

Below is a close-up view of November 30th; note the strong direct sunlight between 12:30 and 13:30, this would have been more than enough for the recommended daily amount of bright light.

Example Lightlog data for Nov 30

Measuring Colour

Colour temperature vs. tint

With seasonal affective disorder and winder blues, light lux (the total light energy in the human visible spectrum), is the main component needed to be measured and tracked over time. However, recording the light colour components also has important benefits for analysis. First, it allows improved automatic tagging for light environment types, where the colour temperature and colour tint allow a better characterisation of the kind of light you’re being exposed to (e.g. fluorescent office lighting vs. natural outdoor light, or bright but overcast days vs. clear blue sky days). This extra information can be used to generate high level, dashboard like views of each day, week, month and year – do you know how many hours of direct sunshine you had this week? The second use of colour data is in measuring the amount of the shorter wavelength (blue) light you are exposed to. Studies suggest blue light is more effective at triggering cells in your eye’s retina responsible for maintaining your circadian rhythm – stimulating serotonin production and inhibiting melatonin, keeping you alert and clear during waking hours. Avoiding blue wavelengths for a few hours before you try and sleep allows melatonin levels to naturally rise, helping you have restful, refreshing sleep.

Case Studies in Design Informatics

Design sketches

Professor Jon Oberlander, of the School of Informatics at Edinburgh University, kindly invited me to present Light Log as a case study to his design informatics group. The presentation, Light Log Case Studies in Design Informatics, is more detailed in nature, covering some of the background research material, prototype hardware, software, user interface, and design goals to date.