Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Teensy 4.0 GUVA-S12SD: Rechargeable UV Index Meter | ShillehTek

July 30, 2026 4 views

Teensy 4.0 GUVA-S12SD: Rechargeable UV Index Meter | ShillehTek
Project

Build a Teensy 4.0 GUVA-S12SD rechargeable UV index meter with an ST7789 color LCD, battery gauge, and USB charging using parts from ShillehTek.

Advanced (soldering, 3D prin4 parts

Project Overview

Teensy 4.0 + GUVA-S12SD UV sensor rechargeable UV index meter: This build uses a GUVA-S12SD true-UV photodiode module and a Teensy 4.0 to calculate a live UV index and render it on an ST7789 color LCD, along with safe sun-exposure time, a battery gauge, and a face graphic that gets redder as UV increases. A TP4056 charging board makes it USB-rechargeable, and a sloped 3D-printed enclosure keeps the sensor pointed at the sky while the screen stays readable.

  • Time: A weekend (3D printing + soldering + assembly)
  • Skill level: Advanced (soldering, 3D printing, some CAD)
  • What you will build: A pocketable, rechargeable UV index meter with a color display.
Finished Teensy-based rechargeable UV index meter with GUVA-S12SD sensor and color LCD
The finished meter: UV index, safe-exposure time, and battery gauge at a glance.
ST7789 color LCD showing UV index, battery gauge, and face graphic on the UV meter
The face graphic gets redder as the UV index rises.

Parts List

From ShillehTek

External

  • Teensy 4.0 (any 3.3V Arduino-compatible with a couple of analog pins works with code tweaks)
  • ST7789 1.3" color LCD (SPI)
  • 3.7V LiPo battery + S7V8F3 3.3V regulator + rocker switch
  • Fused quartz plate (UV-transparent sensor window), 1/8" acrylic, M2 screws, 22 AWG wire
  • 3D printer, soldering iron, hot glue

Note: The GUVA-S12SD outputs a voltage proportional to UV photodiode current - divide the output voltage by 0.1 and you have the UV index. That one-line conversion is what makes this sensor so pleasant to work with.

Step-by-Step Guide

Step 1 - Design the Circuit

Goal: Understand the power and signal paths.

What to do: The microcontroller drives the ST7789 over 4-wire SPI (SCL, SDA, RES, DC). The GUVA-S12SD runs from 3.3V and feeds one analog input; its output equals 4.3× the photodiode current in µA, so UV index = output voltage ÷ 0.1.

Power flows from the LiPo through the TP4056 (for charging) and a rocker switch into the 3.3V regulator. One more analog pin (A3) watches the battery through a 2:1 voltage divider made of two 10K resistors. The divider is required because a full LiPo sits at 4.2V, above the 3.3V analog pin limit.

Wiring diagram showing Teensy 4.0 connected to GUVA-S12SD UV sensor, ST7789 SPI LCD, TP4056 charger, switch, and 3.3V regulator
Sensor to analog in, screen on SPI, TP4056 + regulator + switch for power.

Expected result: A clear schematic before any soldering.

Step 2 - Load the Firmware

Goal: Understand the code you are flashing.

What to do: The firmware uses the Adafruit GFX and ST7789 libraries (install via the IDE's Library Manager). The main loop reads battery percentage and UV index once per second and only redraws the parts of the screen that changed to eliminate display lag:

Code:

#include "TFT_display.h"
#include "battery.h"
#include "UV_sensor.h"
float last_percent = 100;
float last_index = 100;
float percent_now;
float index_now;

void setup(void) {
  Serial.begin(9600);
  init_screen();
}

void loop() {
  percent_now = bat_percentage();
  index_now = UV_index();

  // only update the screen if a reading changed
  if (percent_now != last_percent) {
    display_battery(percent_now);
    last_percent = percent_now;
  }
  if (index_now != last_index) {
    display_texts(index_now);
    display_pic(index_now);
    last_index = index_now;
  }
  delay(1000);
}

The signature feature is the sunburn-simulating face: the bitmap's red channel is scaled by the UV index. Each 16-bit pixel packs red in the top 5 bits, so the code extracts it, boosts it proportionally to the index, clamps it, and writes it back:

Code:

uint16_t adjust_redness(uint16_t color, int index) {
  // color format: RRRRR-GGGGGG-BBBBB
  int r = color >> 11;
  int new_r = r + (r * index / 5);
  if (new_r > 0b11111) {
    new_r = 0b11111; // don't overflow the 5 red bits
  }
  uint16_t new_color = (color & 0b0000011111111111) | (new_r << 11);
  return new_color;
}

Battery percentage comes from reading the divided battery voltage and running it through a piecewise-linear LiPo discharge curve. It is not lab-grade, but consistently within about ±10%.

Firmware diagram showing UV sensor conversion, battery model, and ST7789 display update loop for the Teensy UV meter
Main loop, display module, battery model, and UV conversion.

Expected result: Firmware compiled and flashed; the full source and CAD files are in the original author's repository (see credits).

Step 3 - Print the Enclosure

Goal: A dustproof, ergonomic case.

What to do: Print the main housing and back plate in PLA (0.15 mm layers, no supports, display opening face-down). The top is sloped at about 42 degrees so you can read the screen comfortably while the sensor opening points straight up.

An acrylic window protects the LCD, and a fused quartz plate covers the sensor. Quartz passes about 90% of UV, so the sensor still reads accurately behind it.

3D CAD model of a sloped enclosure for a rechargeable UV index meter
The full CAD model of the enclosure.
CAD view showing the 42-degree sloped top that keeps the GUVA-S12SD sensor aimed upward while the LCD is readable
The 42° slope: screen readable, sensor skyward, no self-shading.
CAD close-up of the UV sensor opening designed for a fused quartz UV-transparent cover
The sensor window gets a UV-transparent quartz cover.

Expected result: Printed parts ready for assembly.

Step 4 - The Details That Make It Usable

Goal: Switch, charging port, and anti-loss touches.

What to do: The rocker switch sits recessed into the case so it cannot toggle accidentally in a bag. The micro-USB charging port hides behind a tiny snap-fit plug printed at finer 0.1 mm resolution for a crisp fit. The plug is tethered to the case with a short wire so it does not get lost.

CAD detail showing a recessed rocker power switch pocket in the UV meter enclosure
Recessed switch = no accidental power-ons.
CAD detail of a snap-fit micro-USB charging port plug for a TP4056-based rechargeable UV meter
The snap-fit charging-port plug.

Expected result: All mechanical details accounted for before assembly.

Step 5 - Solder the Electronics

Goal: Fit everything onto one small solder board.

What to do: Solder the microcontroller and regulator to the underside of the board and the TP4056 on top along the last row. The LCD and UV sensor get direct wire runs (no room for Dupont connectors).

Important sequencing tip: push the rocker switch into the housing before soldering its wires, or it will not fit through the hole.

Top view of prototype PCB with TP4056 LiPo charging board mounted for the UV meter
TP4056 on top of the solder board.
Bottom view showing Teensy 4.0 and 3.3V regulator soldered under the prototype PCB
Microcontroller and regulator tucked underneath.
Direct soldered wiring between ST7789 SPI LCD, GUVA-S12SD sensor module, and the main PCB
Direct wire runs to the LCD and UV sensor.
Rocker switch installed in the enclosure and wired to the power path for the rechargeable UV index meter
Switch in the housing first, then solder.

Expected result: A compact, working electronics stack.

Step 6 - Assemble the Case

Goal: Put it all together safely.

What to do: Hot-glue the quartz plate and acrylic window into the housing (keep glue off the visible quartz because it would block UV). Screw the sensor and LCD down with M2×5mm screws, then the solder board with M2×10mm.

Put electrical tape between the LiPo and the board and trim protruding header pins so nothing can puncture the battery. Tether the USB plug, close the back plate, and screw it shut.

Hot-gluing fused quartz over the GUVA-S12SD sensor window and acrylic over the LCD opening
Quartz over the sensor, acrylic over the screen.
Securing the UV sensor module, ST7789 LCD, and main PCB to the 3D-printed enclosure using M2 screws
Self-threading M2 screws hold everything to the printed posts.
Micro-USB charging port cover tethered to the UV meter case to prevent losing the plug
The tethered port plug - impossible to lose.

Expected result: A sealed, pocketable UV meter.

Step 7 - Charge and Go

Goal: Keep it running for beach season.

What to do: Pop the port plug and connect micro USB: a red glow means charging, blue means full (courtesy of the TP4056's CHRG and STDBY LEDs). The case is dustproof but not waterproof, so keep it out of the pool. Then take it outside and watch the index.

TP4056 charger LED showing red while the rechargeable UV meter battery is charging
Red = charging.
TP4056 charger LED showing blue when the rechargeable UV meter battery is fully charged
Blue = fully charged.
Using the rechargeable GUVA-S12SD UV index meter outdoors in sunlight
Sunbathe responsibly - with data.

Expected result: A rechargeable UV companion that tells you when to reapply sunscreen or head for shade.

Conclusion

You built a complete gadget around the GUVA-S12SD: UV sensing converted to a live UV index, an ST7789 color display with dynamic graphics, and LiPo power with USB recharging via a TP4056. The sloped 3D-printed enclosure makes it practical to use outdoors without shading the sensor.

Credits: the photos and the original project inspiration came from Instructables by Bill Yen (billyen33).

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.