Week 9: Input Devices
Overview
This week I will be working towards adding another aspect to my final project. I want my project to build on it's purpose by being able to digitally provide aspects of evolvong wellness concepts.Group Assignment
- Probe an input device(s)'s analog levels and digital signals (As a minimum, you should demonstrate the use of a multimeter and an oscilloscope.)
- Document your work on the group work page and reflect on your individual page what you learned.
Individual Assignment
- Measure something: add a sensor to a microcontroller board that you have designed and read it.
Remote Student Note on Group Assignment
I am a remote student, so I am coordinating with my instructor on how the group probing and the oscilloscope/multimeter requirement are handled for my node.
My Input Device : A UV Sensor
Why a UV sensor?
My final project, is a reflective journaling companion for the people who think for a living: educators, inventors, and makers. The whole interaction lives through your body and your hand, not just on a screen.
This week adds the part of the system that senses the user's environmental settings. The wristband already senses the user's touch; the console will be able to sense the user's environment. One slice of that environment, daylight, is measurably tied to how people feel.
There was no room left in the wristband for more components, so this sensor belongs on the console, which is what the user holds at the moment of reflection. For this week I am prototyping that console input on my existing milled RP2040 board, used as a test bench.
Understanding Light and Wellbeing
There are three real documented relationships between sulight and wellbeing.
| Mechanism | What it Is | Relation to Final Project |
| Circadian Rythm | Daylight sets the body's master clock. Low daylight desynchronizes it. | "Have you seen daylight today?" is a meaningful question for a reflective device. |
| Seasonal Shifts | Reduced light in darker months is associated with seasonal low mood; bright light is part of managing it. | Tracking daylight over time showcases seasonal patterns a user can't feel from inside. |
| Vitamin D (UVB) | UVB drives vitamin D synthesis in skin; vitamin D status is linked to mood regulation. | This is the band a UV sensor is reading. It ties the sensor to the biochemistry, not just brightness. |
Why UV specifically and not just a plain light sensor
A lux/ambient-light sensor can't tell bright office lighting from actual sun, it only sees general brightness.
A UV sensor responds meaningfully only to real daylight, making it a cleaner marker of genuine outdoor sun exposure. For a device whose provides a prompt like "are you actually getting daylight?", UV is arguably the more honest signal.
IMPORTANT NOTE: This is NOT a medical instrument.
This serves as a wellbeing nudge and not a medical instrument and is not to be used in the place of medical advice.
- Clinical light therapy uses visible bright light and deliberately filters UV out, because UV is the harmful part of sunlight, not the therapeutic part.
- This sensor does not measure a "light-therapy dose." What it measures is sun exposure to measure time spent outdoors in daylight and time outdoors as an association with possible mood improvements.
The payoff for the journal is the feedback loop. A plain journal is a passive record. Within my final project, the moment each reflective entry is paired with an environmental signal the console can expose a pattern the writer can see. It showcases patterns like a flat mood week that might align with days of near-zero sun to brighter tones on days the user spends outdoors.
This feedback turns the journaling into a mirror with similar logic to the haptic wristband in sensing the user's environmental settings instead of just their touch.
The Board: Week 4 and 8 of my Fabacademy Journey
Within the requirements for this week, students are asked to add a sensor to a board that we designed and fabricated in a previous week rather than designing a new one.
The board i'm using is the custome milled PCB featuring the Seeed Studio Xiao RP2040
What changed this week
- Nothing on the textile button path. It will stay the same on the D0 pin.
- The UV sensor will be added to the free analog pin GP29 which is currently unconnected on the board.
How the sensor works
The Adafruit 1918 breakout is built around a GUVA-S12SD UV photodiode. The photodiode detects light in the 240–370nm range, which covers UVB and most of UVA.
The current it produces is tiny — nano-ampere level — so the breakout adds an op-amp to amplify that into a usable analog voltage on the OUT pin.
It does one thing and hands back a voltage I can read straight off an ADC pin.
From light to a number
The breakout's output voltage relates to the diode photocurrent as VO = 4.3 X (diode current) and that voltage maps to UV index by dividing it by 0.1v.
It needs real UV to test
:- The sensor reads 240-370nm so the common 400nm purple UV leds and phone flashlights are outside its range and wont move the reading.
- Actual sunlight or a UV lamp (like a reptile lamp) is the reliable test source. Because of this I'll be testing first at my window and then directly outdoors.
Circuit and Wiring
BOM (this week's addition)
| Component | Part | Interface |
| UV sensor breakout | Adafruit 1918 — GUVA-S12SD analog UV sensor | "Have you seen daylight today?" is a meaningful question for a reflective device. |
| Host Board | Reduced light in darker months is associated with seasonal low mood; bright light is part of managing it.Milled XIAO RP2040 board (Week 8) | N/A |
Connections
| Pin on UV | Connects To This on PCB | Note |
| V+ | 3V3 | Not 5v (see notes below) |
| GND | GND | Common Gnd |
| OUT | GP29 | Free ADC pin. Keep in mind, the textile button will be connected to D0 on the PCB |
Source Code Updated with UV Sensor
// ─────────────────────────────────────────────────────────────
// Fab Academy Week 9 — Input Devices
// Board: Seeed Studio XIAO RP2040 (custom milled PCB, Week 8)
// Input: Adafruit 1918 GUVA-S12SD analog UV sensor on A3
// Note: velostat acknowledgment sensor stays on A0/D0 (unchanged)
// Output: UV value streamed over USB serial at 115200 baud
// ─────────────────────────────────────────────────────────────
const int uvPin = A3; // GUVA-S12SD analog OUT — free ADC pin
void setup() {
Serial.begin(115200);
analogReadResolution(12); // RP2040 ADC full range: 0–4095
Serial.println("Week 9 — UV sensor ready");
}
void loop() {
int raw = analogRead(uvPin); // 0–4095
float voltage = raw * (3.3 / 4095.0); // ADC reference is 3.3V
float uvIndex = voltage / 0.1; // GUVA: UV index ≈ Vout / 0.1V
Serial.print("raw="); Serial.print(raw);
Serial.print(" V="); Serial.print(voltage, 3);
Serial.print(" UV index="); Serial.println(uvIndex, 1);
delay(500); // sample twice a second
}