Auto brightness!

A project log for NeoPixel SmartWatch

A first attempt at a wearable that interacts with Android notifications and has a few other neat features.

dominicDominic 04/26/2015 at 15:310 Comments

The neopixel leds are really really bright at full power. While this is great for readability outside, it quickly gets distracting indoors. Manually changing brightness with a sequence of button presses works but still requires me to interact with the watch whenever I step outside or the lights are turned off. With the SI1145 sensor I bought, I'm able to measure visible, ir, and uv light. I experimented with sampling visible and ir light in different environments to adjust the neopixel output brightness. Unfortunately, at low light levels the values can be a bit inconsistent. Visible light readings were especially bad, so I decided to use ir values for now. To filter out the inconsistencies I take the average of 5 readings. This repeats every 2 seconds. For some reason when I take more than 5 readings in a short period of time, the sensor stops working until the sketch is reset. Adding delays in the 'for' loop that read the values has no effect. Anyways, if the average value is greater or less than the range of values for the current brightness, the neopixels are redrawn with the new brightness level.

Lastly, I added an override for manual brightness control. Holding the button down for over 3 seconds toggles between low, high, and auto brightness. This is mostly for situations where the light level is such that the auto brightness keeps rapidly toggling the neopixel brightness.