Introduction: Blue Light Project Part2

About: Lazy Old Geek

So in Blue Light Project Part1 I explained some of the steps I took to reduce insomnia by reducing evening blue light. I didn’t have an easy way of seeing how well it worked, so I decided to build a Color meter to measure how much blue light I was getting.

DISCLAIMER: These are my opinions only!

So this Lazy Old Geek (L.O.G.) decided to use a TCS34725 (see picture) color sensor. It can measure the Red, Green and Blue components of light and also white. Plus Adafruit has a nice Arduino library for it.

Here’s an Instructable for TCS34725 that has some good information:

I purchased mine from

I decided to use my current favorite Arduino, an Adafruit M4 Express(see picture) and my Adafruit 3.5” FeatherWing.

This setup would have the 3.5” display to show the results plus has a microSD card to be able to store data snapshots. Connecting the TCS34725 sensor would be relatively simple.

Step 1: Design

The 3.5” FeatherWing includes a microSD card reader and the M4Express will plug into it. Basically all I needed to connect was the TCS34725 color sensor and I decided to add a button when I wanted to write to the microSD card.

To make it ‘modular’(so I can easily detach it for other projects) I used male headers strips that plug into the extra rows of ‘breadboard’ female headers on the 3.5” board (see picture). The inner row of female headers is where the M4 Express is installed.

The red and black wires are connected to an 18650 battery holder. The M4 Express has a builtin LiIon charger that can charge the battery when it’s plugged into USB.

I soldered male header pins on the TCS34725 and soldered the wires to a female header in case I wanted to change the length. All the connections were soldered than coated with hot glue for strain relief.

Anyway, the schematic is attached.

The TCS34725 has a white LED to ‘illuminate’ the target. However, I am using it to look at active light sources so needed to turn it off. I use D12 to do this in software.

I attached the 3.5” FeatherWing display to plastic hinges which were bolted to a piece of plastic (see next picture) and glued the tac switch to this piece (see next picture).

The TCS34725 was placed on a wooden block, held down with masking tape.

Yes, I know this is just a quick and dirty solution but what I wanted was a portable (battery operated) fixture that I could move around to test and record various light sources.

Step 2: Arduino Sketch

My Arduino sketch was based on the Adafruit example, tcs34725autorange.ino.

I don’t know how accurate this is but it seems to work for my purpose in being able to compare the red, green and blue intensities.

To create the Bar Graph, I based my code on this:

Anyway my code is just hacked together. I’m not happy with it. But my coding skills are diminishing with age so since it does what I want it to do, I’ll use it (see attached) MTSautoRange2.ino

Basically, what the sketch does is reads the strengths of the red, green and blue, lux and color temperature, displays the values comparing the R G B, show the lux reading and more or less points to the color temperature on the color temperature bar ribbon.

Lux is basically the intensity of the light source.

Color temperature is a convoluted technical term. It’s often used in describing light bulbs, sometimes in terms of ‘cool’ or ‘warm’. If you’re interested you can research it. Personally, it’s too confusing to this OLD man.

When the button is pressed, it records the r,g,b, lux and ct to the microSD and increments the # right below the ct value. This is in a comma-delimited format so I can read it with Microsoft Excel.

I didn’t set up my delays very well, so the button has to be held down for a couple of seconds and may skip a #.

Step 3: Testing

Most of my testing was done in a windowless bathroom so I could eliminate extraneous light. See first picture. This is using one of my Wixann smart bulbs which I set to various conditions.

One thing I ‘learned’, though I should’ve know it already is in the next picture the Smart Life color screen shows the colors in a circle. What I was thinking is that if I stayed away from the blue, e.g., green, yellow, orange or red, I should see low blue. With testing what I realized is that this color wheel is for mixing colors. While the red and blue seem close as far as the color wheel goes, they are far a part in wavelength (see next picture).

What this means (to me) is that green is closer to the blue wavelength and seems to have more blue in it. I think, all light sources, bulbs and LEDs are not at a fixed wavelength. They are a range of frequencies sometimes with a peak.

There’s a lot of comments about the limitations of the TCS34725 only being able to get approximate ratios of RGB and not actual values, but I think this also extends to the RGB source LEDs, They are not a single frequency but a range with one only being predominate.

Bottom line to get minimum blue light, I need to stick with Red and Orange.

Next I tested a square yellow night light, see picture which is pretty low in blue.

Next I tested a round white night light which had about 22% blue.

I covered one with some translucent red tape and blue dropped to 12%.

This tape is designed tor repair red car taillights and actually does pretty good for my purposes.

Step 4: More Testing

Next I tested an old headlamp clear then with red tape. Well, the blue decrease wasn’t too bad, but what I wanted this for is to be able to look at things in the evening that wasn’t that clear in my no blue light conditions. This headlamp with the red tape isn’t very bright.

My thoughts were that during the evening when my lights are pretty dim and reddish, it’s hard to see details. Plus some of my rooms aren’t setup for no blue.

This isn’t the answer.

I did buy some rechargeable headlamps from AliExpress:

These are pretty bright, the round side I call XPE2, the oblong side, COB, I tested these with and without red tape. The red taped tests seem to be brighter than my old headlamp.

Also tested my night lamp with WS2812b LED strip. These are programmable R, G, B LEDs. Rough results, all Red is 93% red, all Green is about 63% Green 30% Blue, all Blue is about 77% Blue 22% Green.

Took a couple of samples from looking at outside daylight.

Step 5: Intermediate Conclusions

This is definitely very subjective conclusions.

Hardware issues: So when I was testing daylight, usually the ratios were strongly blue but occasionally, it was predominately green. Why that happened I’m not sure. I suspect that it might have something to do with the auto ranging. For my purposes, right now, I’m going to accept it. For future testing, I plan to take multiple readings.

I’ve enclosed a copy of my Excel test file. It’s probably of little value but shows what kind of data is in on the microSD card along with some comments and a little analysis of mine.

Wixann smart bulbs, to achieve least blue, I try to move away from Blue and Green, stay more in the Yellow-Orange-Red area.

Red transparent tape. It definitely passes mostly red but maybe more blue than I like.

Night Light. The round with red tape is probably fine. Right now I prefer the square Yellow ones as they seem brighter. Although my readouts say about the same Lux, these readings are more of a spot reading while the squares probably have more LEDs and thus brighter.

Headlamps. My old ones with red tape are just too dim. I like and will probably use the new headlamp with red tape. They still read 25-30% blue but I will only be using them for temporary lighting. The other thing is that these are worn on the forehead so the light is reflected instead of shining right in the eyes.

Now that I think about it that is true of most all of these sources, I don’t look at the light directly. The exceptions are computer monitors, smartphones and TV.

Anyway, even reflected light has a lot of the color spectrum of the light source.

INSOMNIA: Will right now my Fitbit sleep scores are jumping all over the place, 73 yesterday to 81 today. One thing I’m pretty sure about is when it’s over 80, I seem to be able to focus better, e.g., able to write up an Instructable!!

I am planning a Part 3 of this series.