Heading into the summer months in the Northern Hemisphere means that many of us will be spending a lot more time outdoors soaking up the sun. Getting outside for some recreation after a long winter can be great for both body and mind. Too much sun, however, can be very detrimental to our health. The ill effects of excessive sun exposure are often overlooked, but considering the magnitude of the issue, deserve more awareness. 90 percent of non-melanoma skin cancers are caused by exposure to ultraviolet (UV) radiation from the sun, and 5,400 people die from this type of cancer each month worldwide. Excessive UV radiation takes a toll on our physical appearance as well, with ninety percent of skin aging being caused by sun exposure.
These problems are all easily avoidable by using sunscreen, wearing appropriate clothing, or just ducking into the shade for a while. The issue seems to be that we often get wrapped up in what we are doing, and just forget about the risk we are taking. Kutluhan Aktar recently came up with the idea of building a device that is capable of tracking certain environmental factors and translating them into a risk level for sun damage. He built it into a smartwatch-like form factor so that it would be convenient to bring along while on the go. By using a tiny microcontroller and a machine learning model built with Edge Impulse, this smartwatch keeps the wearer informed about their risk for sun damage in real-time, so that they can take action before damage occurs.
Aktar began by digging into research papers on the topic of sun damage risk. This led him to select UV index, temperature, pressure, and altitude measurements as good candidate metrics for estimating sun exposure risk levels. The interactions between these factors can be very complex, so it is not straightforward to develop an algorithm that can map them to specific levels of risk. As such, Aktar built a neural network classifier with Edge Impulse and trained it to learn these relationships.
A powerful, yet small, low-power platform was needed to run the algorithms, and also check all the boxes for a smartwatch form factor device. For this reason, a XIAO BLE nRF52840 development board, with an Arm Cortex-M4 processor and Bluetooth Low Energy connectivity, was selected. A Grove UV sensor, and a BMP180 precision sensor were added to the design to capture the necessary environmental parameters. These components were fitted inside a 3D case, which is intentionally large because of Aktar’s interest in science fiction, however, since the hardware components are quite small, it would be possible to design a much smaller case that would be more widely acceptable.
In order to train the model, example data was needed that links sensor measurements to sun damage risk levels. By leaving the smartwatch outside for twenty days, then later manually adding classes to each set of measurements, Aktar built the needed training data set, which he then uploaded to Edge Impulse. After training the model, a set of test data — that was not present in the training data — was used for validation. A very impressive classification accuracy of 90.91% was observed.
The machine learning pipeline was ready for real world use at this point, so Edge Impulse’s deployment tools were used to export it as an Arduino library. This allowed the entire pipeline to be included in an Arduino sketch with a few clicks, and a few lines of code. By running everything locally on the smartwatch, no Internet connectivity is needed while out and about.
The final piece of this project involved building a smartphone app that communicates with the watch via Bluetooth. The results of model inferences are transmitted to the app, where a user can check in on their current risk of sun damage. This empowers the wearer of the device to take proactive steps to protect themselves from sun damage before it is too late and the damage is already done. This watch would be smart for anyone to use, but a device like this may be especially useful to those at higher risk for skin cancers or sun-related eye problems. We look forward to seeing Aktar continue to refine this smartwatch in the future.
Grab some sunscreen and head over to the project write-up before you hit the beach this summer.
Want to see Edge Impulse in action? Schedule a demo today.