Track Your UV Exposure In Real Time With This DIY Meter

Know when you’ve had enough sun before you get burned

5 min read
Illustration of a person looking at a UV meter.
Illustration: James Provost

While editing an article about skin cancer early in my career, I learned many not-so-cheerful facts about how ultraviolet light causes molecular disruptions in DNA—how the damage is typically incurred early in life, and how people are particularly susceptible when they live closer to the equator than their forebears, as I do. Since then, I've tended to avoid the sun rather than revel in it. Now, however, with a little bit of home-brewed technological help, I have a device that lets me get the major benefit of solar rays without worrying about ill effects.

The impetus for revisiting my long-standing aversion to the sun was reading about a small-scale study in Spain of patients admitted to a hospital for COVID-19. They were randomly divided into two groups, one of which was administered calcifediol, a prehormone the body normally produces from vitamin D. Of the people in that group, only 2 percent deteriorated to the point of needing intensive care. For those who were not given calcifediol, 50 percent ended up in the ICU.

Doctors have found other evidence, too, that vitamin D might help to protect against COVID. Vitamin D also keeps bones strong, and deficiencies in vitamin D are associated with various diseases, including schizophrenia. While people can get vitamin D from the food they eat, a major source is its synthesis in the skin when exposed to sufficient amounts of ultraviolet light. So, when it comes to getting out in the sun, it seems that you're damned if you do and damned if you don't.

Illustration of the components of the UV meter.  Sensor Stack: An Arduino Pro Micro provides the brains of my exposure meter, integrating raw data from a UV sensor that measures the intensity of UV-A and UV-B light. The integrated results are displayed on a monochrome LCD screen originally created for Nokia feature phones. Illustration James Provost

In an effort to seek the right balance, I hunted for guidance about how much sun would be enough but not too much. A lot of what I read was hopelessly vague, but I eventually stumbled on a scholarly article by Richard L. McKenzie and others that provided concrete guidance. The article told me that, as you might expect, your chance of skin damage scales up with the intensity of UV radiation and duration of exposure, factors that also raise your ability to produce vitamin D. But it also said you can reduce the UV intensity and duration needed to produce the required amount of vitamin D simply by exposing more skin area.

Just walking the dog in my skivvies didn't seem a reasonable strategy, though. I figured I needed a quantitative—and portable—way to gauge whether I was getting enough sunlight to produce a healthy amount of vitamin D without getting burned. While you can find generalized charts that provide estimates of what is called the UV index for your latitude at different times of the day and year, I wanted to know exactly what the prevailing UV index was as I moved in and out of shadows and clouds passed overhead.

The solution involved a US $7.50 UV-sensor board I bought from SparkFun. It measures both UV-A and UV-B radiation (although only the latter wavelength range is involved in the production of vitamin D). I wired this sensor to an $18 Arduino Pro Micro, which integrated the sensor readings to measure my total exposure. A diminutive $10 graphical display connected to the Pro Micro shows at a glance when I've likely taken in enough sunlight to get my daily dose of vitamin D and when my exposure might be approaching the danger level.

A chart of showing when sunburn would occur. Burn Notice: The red area in the chart (adapted from a paper by Richard L. McKenzie et al.) shows when sunburn will occur for a given UV index (plotted horizontally) and amount of time (plotted vertically). People with lighter skin will burn more quickly than people with darker skin. The green line shows the amount of exposure required for people to produce sufficient vitamin D while exposing only face and hands; the blue line represents the threshold when exposing the full body. Illustration James Provost

The packaging is less elegant than I would have liked, but has the advantage of being light: I attached the three boards together and wrapped the ensemble with duct tape, cutting a small window in the tape for the sensor. The contraption is powered by a palm-sized lithium-ion battery pack. The first pack I bought for this purpose proved a bust because the power draw of my electronics was so low that the pack would quickly turn itself off. So I replaced it with a pack that boasted an always-on feature.

I programmed the Arduino to graphically display my exposure using a scale of zero to 200 accumulated “UV index–minutes." This a unit of convenience I invented to summarize a key chart in the McKenzie paper, a version of which is shown here.

As the chart shows, with full-body exposure, about 10 UV index–minutes should be sufficient for someone like me with “Type II" skin, which burns easily, to produce my daily quota of vitamin D. I'm more the baggies type than the Speedo type, so figured my personal “full-body exposure" value was probably something like 20 UV index–minutes. And with only hands and face exposed, I'd likely need from 100 to 150 UV index–minutes to produce my daily quota of vitamin D. The danger level for someone with my skin type with any amount of skin exposed comes at about 180 UV index–minutes. So I had the Arduino plot minimum and maximum lines at the appropriate levels.

People with darker skin would, of course, need to adjust these numbers upward, as the chart shows. According to the publication I was using for guidance, those with a Mediterranean skin type (Type IV) should double the values I adopted. People with skin that is darker still should use values five to 10 times as large.

While I've yet to figure out how useful these integrated-exposure results will be, just having a gizmo that can tell you the instantaneous UV index is very helpful in gauging whether there's even a possibility of getting enough vitamin D. When the UV index is below 1.0 outside, forget it—I'd get a burn (or more likely the sun would set!) before my skin could produce enough.

At the time of this writing, in early March, most days offer a slim chance of burning. But I am looking forward to the coming of spring, when the sun passes over the equator, the dogwood begins to bloom, and I can transition from chewing on vitamin-D gummies to using an Arduino-based UV-index meter to stay healthy.

This article appears in the April 2021 print issue as “Don't Get Burned!"

The Conversation (0)

From WinZips to Cat GIFs, Jacob Ziv’s Algorithms Have Powered Decades of Compression

The lossless-compression pioneer received the 2021 IEEE Medal of Honor

11 min read
Photo: Rami Shlush

Lossless data compression seems a bit like a magic trick. Its cousin, lossy compression, is easier to comprehend. Lossy algorithms are used to get music into the popular MP3 format and turn a digital image into a standard JPEG file. They do this by selectively removing bits, taking what scientists know about the way we see and hear to determine which bits we'd least miss. But no one can make the case that the resulting file is a perfect replica of the original.

Not so with lossless data compression. Bits do disappear, making the data file dramatically smaller and thus easier to store and transmit. The important difference is that the bits reappear on command. It's as if the bits are rabbits in a magician's act, disappearing and then reappearing from inside a hat at the wave of a wand.

Keep Reading ↓ Show less