The Hardware

As of 08/03/2023 the sunscreen tester machine gets a cooling system upgrade. See this post as to what this means for test results, past and future!

Below, I explain the reasoning behind why I selected the components and how I designed the sunscreen testing machine. There is a bit of background science on ultraviolet wavelengths beforehand because those wavelengths determine the parameters the machine is designed around. If you just want to skip to the seeing the machine itself, click here.

What equipment is typically used to test sunscreen SPF?

The FDA guidelines for testing sunscreen SPF require solar simulators which are either single or multiport units with total irradiance output of 1500 W/m2 for all wavelengths between 250 and 1400 nm. These solar simulators run in the thousands of dollars and output light over a very broad spectrum. Filters are then typically applied to the light output for the applicable wavelengths to be tested. Since the FDA is mostly concerned with ultraviolet light, the wavelengths they require to be tested with fall under the 290nm – 400nm spectrum.

What part of the ultraviolet spectrum are we concerned with?

The World Health Organization states that the ultraviolet radiation that causes the most immediate damage to us are those that have shorter wavelengths. This means UVC and UVB are the wavelengths most likely to cause burns to our skin. Thankfully the earth has an atmosphere which blocks most of the UVB and all of the UVC from reaching the earths surface. The UVB exposure which does get through the earths atmosphere, we typically receive during the summer months. What is left is a little bit of UVB, but mostly the UVA ultraviolet radiation. About 95% of the UV radiation which reaches earths surface is UVA.

UV radiation is reflected or scattered to varying extents by different surfaces, e.g. snow can reflect as much as 80% of UV radiation, dry beach sand about 15%, and sea foam about 25%.

-World Health Organization

Since I didn’t need to concern myself with measuring UVC irradiance, I just needed be able to test whether sunscreen could block ultraviolet UVA and UVB.

A more straightforward way to test sunscreen, using the UV Index

I chose to design my sunscreen testing contraption in a way which would allow me to compare the general effectiveness of one sunscreen against another by sensing how much UV light was still detected after passing through a layer of sunscreen. Because the UV index is an easily accessible and understandable reference, I would just need to calculate the UV index of the Ultraviolet light reaching the sensor after passing through the layer of sunscreen and whatever value that was could be compared to another sunscreen. The higher the detected UV light and resultant UV index, the less effective the sunscreen would be in the real world.

As such I didn’t try and duplicate the industrial solar simulators used for FDA specification and labeling verification, and chose to design something which could provide me with consistent UV values and the associated UV index result.

UV sunscreen testing station with additional case cooling fan mounted on cover

The sunscreen testing machine


This is what my sunscreen testing machine looks like. It has the additional cooling fan mounted on top for additional enclosure cooling.

An ST7789 220 x 220 LCD display is also attached which gives me the same data available as on its web interface.

What microcontroller for the UV sunscreen testing machine?

I chose to design the sunscreen testing station (the brains of the operation) around an Espressif ESP32 microcontroller. The ESP32 is a low power, high performance microcontroller featuring wifi and bluetooth connectivity options providing some flexibility in the future. It can be easily programmed to connect to numerous sensors should I require them, and allows for easy programming using the Arduino IDE. It is low cost and easy to integrate into smaller sized enclosures due to its small footprint.

Here is a shot of the machine without additional case cooling fan. Notice the blue heatsink and fan required to keep the UV LED from overheating.

To the left and right side of the enclosure are the additional exhaust fans which also help keep the inside of the testing chamber cool.

sunscreen testing machine without additional case cooling fan

What components are integrated into the testing machine to measure UV light?

Vishay VEML6075 UV light sensor

It so happens there is already a sensor available which measures UVB and UVA intensity which converts the readings into digital measurements, the VEML6075. Since the VEML6075 uses an I2C interface I would be able to easily connect it to a microcontroller of my choosing, and since it has a documented programming library available, it helps speed up development. An additional benefit is the Vishay VEML6075 has high temperature compensation (which is necessary since it would be used in an environment where heat from the UV light source would impact the measurements it takes).

View of the VEML6075 UV sensor
A view of the naked Vishay VEML6075 UV sensor

There are a few considerations involved when integrating this sensor into a project, but its mostly about fabricating a cover which blocks reflected light from entering the sides and bottom of the light sensor itself (it causes errant signals).

UV testing platform
The sensor and microscope slide platform with cover installed to block any stray reflected light into the Vishay VEML6075 ultraviolet sensor. The round probe on top is the DS18B20 temperature sensor.

50W 365nm UV LED

In order to accurately measure and compare the results of one sunscreen against another, I couldn’t just use the available sunlight on just any given day (not consistent). Instead, I settled on a 50W Ultraviolet LED in the 365nm wavelength. In my testing setup, it nominally radiates enough UV to output a UV index of 15-16, but with additional cooling I could probably observe much higher. Since we rarely see ultraviolet indexes of higher than 15-16 on a given day, I was content that this UV light source would provide enough power to be used as the ultraviolet light source.

Interior view with UV LED, DS18B20, enclosure fans, and microscope slide platform with cover installed.
Interior view of the testing chamber. The 50W 365nm UV LED is mounted on the top cover, and centered on the UV sensor. Notice the long DS18B20 probe affixed to the right of the microscope slide platform.

Some may be thinking…but 365nm is only UVA light! This is technically correct but as we know, LEDs are not perfect one wavelength emitting diodes. They have a peak output wavelength and from there light output attenuates or bleeds over to its neighboring wavelengths. I knew this LED would generate UVB light but concentrate most of its output in the UVA spectrum. Since UVB light only counts for about ~5% of the total UV irradiance that reaches earths surface, I was satisfied.

50W constant current 1500mA LED Driver (Power supply)

LEDs are constant current devices which mean the brightness depends on the amount of current they receive. In order to maintain as stable of a light output as possible, I needed a constant current power supply.

To glass or not to glass? The surface on which to apply sunscreen

I needed a surface on which to smear the sunscreen and debated whether or not to use a PMMA plate, quartz microscope slide (does not block UV light), or just a regular glass microscope slide. One issue of concern was whether or not the glass microscope slide would block the UVB wavelengths I wanted to measure. Microscope glass blocks UV wavelengths 300nm and lower which effectively cuts out any UVC, and some portion of the UVB spectrum. Being that UVB is 280nm – 315nm, using microscope glass would effectively block the wavelengths from 280nm – 300nm skewing my results. Upon a closer look at the VEML6075 datasheet however, peak UVB sensitivity for the sensor is right around 330nm, with very little sensitivity at 300nm and below. Because of this sensor limitation, I deemed it OK to use glass microscope slides since UV wavelengths detected at the 280nm-300nm spectrum would be minimal anyways.

Microscope slide UV sensing platform
The microscope slide with cover slip is placed on the sensor platform to obtain baseline readings before and after the test. A cover is placed on top to secure the glass pieces.

A little note about temperature

Temperature fluctuations and electronics are always a tricky thing. As it applies to this project, the hotter the LED runs, the lower the resultant light output. Because of the temperature effect on performance, I implemented an active cooling heatsink and fan to cool the LED and used an oversize fan to help cool the surrounding top case cover. Additionally, I installed smaller outlet fans on both the left and right sides of the test enclosure, as well as used a larger cooling fan to provide additional heatsink and top cover cooling ventilation. This does greatly regulate the temperature, but ambient temperature fluctuations still do affect enclosure and LED temperature which lead to slightly increased or decreased UV light output from the 50W ultraviolet LED. I explain a bit more about how I handle the test results in my overview for how I test sunscreen.

DS18B20 digital thermometer

To record temperature changes within the testing enclosure I integrated a Maxim DS18B20 temperature sensor. It is accurate to within ±0.5°C Accuracy from -10°C to +85°C.

Enclosure, Case, Holder, or Container?

Dealing with the harmful ultraviolet rays of UVA and UVB, I did not want large amounts of UV light escaping and causing damage over the short or long term (albeit minimal). I decided to contain the light within an enclosure and repurposed a case for a UV mobile phone sanitizer (which I found on a Facebook buy nothing group) to act as the enclosure for my UV testing unit. It worked out quite well in the end I think. It has the right dimensions, provides enough interior space to contain the testing electronics, and is portable and compact. The lid is self centering as there are raised flanges which guide the lid into the same resting position each time it is closed.

Side view of sunscreen testing machine with power distribution and plugs visible
Upon closer inspection, one will notice the enclosure is a repurposed phone sanitizing device (all original electronics removed). The fan power distribution board and power connections are visible in this picture.