Building an invention inspired by Dr. Andrew Huberman

Building an invention inspired by Dr. Andrew Huberman

Neuroscientist and podcaster, Dr. Andrew Huberman , is really big on the importance of sunlight exposure. Getting enough sunlight, especially early in the morning, provides benefits to sleep, mood, focus and overall health.

In an interview with Dr. Peter Attia, Huberman said it would be great if there was an invention to let the user know when they have achieved enough sunlight during the day. Furthermore, it should notify them if they are looking at too much light at night as nighttime light exposure has been linked to increased likelihood of psychiatric disorders .

I thought this was a cool idea, so I built a prototype to accomplish this.

Building the PCB

Sunlight Glasses PCB I wanted this device to operate off of a single 3V coin cell, but it also needed to be able to communicate wirelessly to a mobile app. WiFi was out of the question due to the huge power draw it requires. Therefore, BLE (bluetooth low energy) was my next choice. When it comes to BLE microcontrollers (MCU), the Nordic line of MCUs are king. These are the same MCUs that you can find in many BLE trackers like the Apple AirTags.

For reading the LUX, I used the VEML7700 ambient light sensor. At first, I was planning on using a plain photoresistor. However, after 1k LUX, the change in resistance of a photoresistor would be so small that you would need a lot of amplification just to get it to work. So let’s not re-invent the wheel and just use an out of the box solution. Veml7700 Sensor

Nothing fancy for the circuit design itself. I just followed the reference schematic as defined in the NRF52810 datasheet. NRF52810 Reference schematic

I used EasyEDA and JLPCB for designing and ordering the PCB. It came out to around $35 for two fully assembled PCBs. Pretty cheap! EasyEDA PCB

I also had to design a second board for the VEML7700 ambient light sensor. I think if this were to be turned into a real product, there would need to be a way to house the light sensor on the same board as the NRF52810 to cut down on assembly costs.

Firmware

When working with the latest line of Nordic MCUs, you will need to use Zephyr RTOS. Zephyr has a steep learning curve that I still don’t fully understand. However, I was able to get the sensor communicating very quickly thanks to the pre-written driven that was already available. Every second the MCU reads the LUX value from the sensor and broadcasts it to any connected device. Pretty straightforward.

But device trees and overlays are still very confusing to deal with. WTF is this

Bluetooth GATT

GATT stands for Generic ATTribute profile and defines the way two bluetooth low energy devices communicate with each other. The following graphic from Adafruit nicely visualizes the GATT service and characteristic hierarchy.

GATT Structure

For more information on GATT, I encourage you to read the nice write up from Adafruit .

For this device, I am using the Environmental Sensing Service and the Perceived Brightness characteristic. This is important because when I build the app in the next step, I am going to specifically looking for that service and characteristic.

IOS App

This was might first time really diving into IOS development. After years doing Android development, I found IOS development to have some delights and annoyances. But I’ll save that for another post. The important thing is that I wanted the app to read the LUX value from the glasses and calculate the average LUX over one minute. The app should also keep track of total LUX and the amount of time it would take to get to 100K LUX given the current LUX value.

XCODE App

Dr. Huberman previously used 100K LUX as the ideal value to get to. So suppose you got outside on a cloudy day. Perhaps you are only getting 20K LUX of light. If you stand there for 5 minutes, you would have received an accumulative value of 100K LUX of light exposure.

Once you get to 100K Lux, you will receive a notification iOS App Notification

I also implemented a night time mode. So if you are getting too much light at night, then you will also receive a notification warning you about it. Night Time Notification

3D Printing

For creating the glasses frame, I used Fusion360 and started out tracing a sketch of regular 2D glasses. From there, I just made adjustments until I got a design I wanted. I printed the glasses using PLA material on my Ender 3 Pro. Cad Model

Using the Glasses in Real Life

Using the Sunlight Glasses I always love invention ideas that I could possibly use in my everyday life. I was excited for this to be one of those idea. However, I soon realized that his is probably not ready to go to market anytime soon.

What I love

As someone who loves data, it is really cool to seem how much light I’m getting at any given moment. I also now understand why Dr. Huberman emphasizes looking up at the direction of the sun when you go outside. The amount of LUX that you receive from looking up at the sky compared to looking somewhere off in the distance can be a dramatic difference!

I also think that the night time functionality is really useful. I’m always up late doing stuff on the computer, so something that can actively tell me the amount of light my eyes are getting and whether its too much for this time of night is pretty neat.

Why I would not buy this

Despite the things that I love about this device, I probably would not buy it in its current form. I think the problem is that it does not take a long to get the daily 100K light exposure. So as a stand alone device, these don’t have a lot of value. Would I put on these glasses every time I leave the house, just to wear them for 5-10 minutes? Combined with my phone, and watch, this would be yet another thing that I would have to remember. This would make sense if it was a feature as part of another project like Google Glasses, Apple Vision Pro or those Rayband glasses.

Why not just use the Apple Watch

While I was developing this, I kept thinking to myself. You know, the Apple Watch has an ambient light sensor. I always have it on me. Couldn’t I just create an app that for the watch? Two problems with this.

  1. The watch is not positioned at the level of my eyes. Therefore, the watch could be covered by my sleeve or just in a position away from the sun.
  2. Apple does not allow access to the raw sensor data outside of research purposes. And even for that you would need to get direct approval from Apple for 🙄

Check out the gadget in action: https://www.youtube.com/watch?v=xIHv9QHtEUs

Source Code and Hardware Files: https://github.com/DaveBben/sunlight-glasses

Link to Huberman interview talking about Sunlight: https://www.youtube.com/watch?v=eU7VneEQayM&t=1283s