Whether you're monitoring plant health, logging neighborhood noise, or running classroom experiments, the Wio Terminal makes it easy to record ambient conditions with its built-in sensors and microSD slot. Let’s dive into a complete walkthrough: hardware, code, real-world use cases—and ideas to expand it further.
🔧 What You’re Working With🧠 Wio TerminalAn all-in-one embedded board from Seeed Studio packed with features:
- Display: 2.4” LCD for live feedback
- Sensors: Built-in light sensor (A0) and microphone (A2)
- Connectivity: Wi-Fi, BLE, USB-C, microSD slot
- Processor: ATSAMD51 ARM Cortex-M4F @ 120 MHz
- Easily programmable via Arduino IDE or CircuitPython
A photodiode connected to A0, sensing ambient light levels.
- Range: Analog 0–1023 (via
analogRead
) - Perfect for tracking sunlight cycles, lighting conditions, or plant environments.
An analog MEMS mic connected to A2 measuring sound amplitude—not full audio, just “how loud”.
- Use it for detecting noise patterns, claps, spikes, and loud events.
- Analog output—no speech recognition, but great for threshold alerts.
You must check out PCBWAY for ordering PCBs online for cheap!
You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Also, check out this useful blog on PCBWay Plugin for KiCad from here. Using this plugin, you can directly order PCBs in just one click after completing your design in KiCad.
🛠️ Step-by-Step Build: Logging Light & Sound🪛 Hardware Checklist
📦 Arduino Setup
Install Seeed Boards Add to Arduino Preferences: https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
Install Libraries via Library Manager
Seeed_FS
SD
Select Board & Port
- Board: Wio Terminal
- Port: Your USB device
Use this simple Arduino sketch to read the Light and Sound sensor data then show it via Serial Terminal.
#define LIGHT_PIN A0
#define MIC_PIN A2
void setup() {
Serial.begin(115200); // Start Serial Monitor
pinMode(LIGHT_PIN, INPUT);
pinMode(MIC_PIN, INPUT);
}
void loop() {
int lightVal = analogRead(LIGHT_PIN);
int micVal = analogRead(MIC_PIN);
Serial.print("Ambient Light: ");
Serial.print(lightVal);
Serial.print(" | Sound Level: ");
Serial.println(micVal);
delay(1000); // Update every second
}
Here’s a detailed and clean Arduino sketch to create a graphical interface using the Wio Terminal’s LCD:
#include <TFT_eSPI.h>
#define LIGHT_PIN A0
#define MIC_PIN A2
TFT_eSPI tft;
void setup() {
Serial.begin(115200);
pinMode(LIGHT_PIN, INPUT);
pinMode(MIC_PIN, INPUT);
tft.begin();
tft.setRotation(3);
tft.fillScreen(TFT_BLACK);
// Title
tft.setTextSize(2);
tft.setTextColor(TFT_WHITE);
tft.setCursor(50, 20);
tft.println("Sensor Dashboard");
// Static box outlines
tft.drawRect(30, 70, 260, 40, TFT_YELLOW); // Light box
tft.drawRect(30, 130, 260, 40, TFT_CYAN); // Sound box
}
void loop() {
int lightVal = analogRead(LIGHT_PIN);
int micVal = analogRead(MIC_PIN);
// Box background refresh
tft.fillRect(31, 71, 258, 38, TFT_DARKGREY); // Light box fill
tft.fillRect(31, 131, 258, 38, TFT_DARKGREY); // Sound box fill
// Display Light Value
tft.setTextColor(TFT_YELLOW, TFT_DARKGREY);
tft.setTextSize(2);
tft.setCursor(40, 80);
tft.printf("Light Level: %4d", lightVal);
// Display Sound Value
tft.setTextColor(TFT_CYAN, TFT_DARKGREY);
tft.setCursor(40, 140);
tft.printf("Sound Level: %4d", micVal);
delay(500);
}
Here’s a detailed and clean Arduino sketch to create a graphical interface using the Wio Terminal’s LCD:
#include <SPI.h>
#include "Seeed_FS.h"
#include "SD/Seeed_SD.h"
File testFile;
void setup() {
Serial.begin(115200);
while (!Serial); // Wait for Serial Monitor
Serial.println("=== Wio Terminal SD Card Check ===");
// Initialize SD card
if (!SD.begin(SDCARD_SS_PIN, SDCARD_SPI)) {
Serial.println("ERROR: SD card initialization failed.");
return;
}
Serial.println("SD card initialized successfully.");
// Detect card type
uint8_t cardType = SD.cardType();
Serial.print("Card Type: ");
switch (cardType) {
case CARD_MMC: Serial.println("MMC"); break;
case CARD_SD: Serial.println("SDSC"); break;
case CARD_SDHC: Serial.println("SDHC"); break;
default: Serial.println("Unknown"); break;
}
// Show card size (safe casting)
uint64_t cardSize = SD.cardSize(); // bytes
Serial.print("Card Size: ");
Serial.print((unsigned long)(cardSize / (1024 * 1024))); // in MB
Serial.println(" MB");
// Write test
testFile = SD.open("/test.txt", FILE_WRITE);
if (testFile) {
testFile.println("Wio SD Write Test OK");
testFile.close();
Serial.println("Write test: SUCCESS");
} else {
Serial.println("Write test: FAILED");
}
// Read test
testFile = SD.open("/test.txt");
if (testFile) {
Serial.println("Read test: SUCCESS");
Serial.println("Contents of test.txt:");
while (testFile.available()) {
Serial.write(testFile.read());
}
testFile.close();
} else {
Serial.println("Read test: FAILED");
}
}
void loop() {
// No loop needed for this test
}
Here's a full Arduino sketch that reads the light and sound sensor values from the Wio Terminal and records them to an SD card file named env_log.txt
every second. It’s modular, reliable, and ready for field deployment.
#include <SPI.h>
#include "Seeed_FS.h"
#include "SD/Seeed_SD.h"
#include <TFT_eSPI.h>
#define LIGHT_PIN A0
#define MIC_PIN A2
TFT_eSPI tft;
File dataFile;
void setup() {
Serial.begin(115200);
pinMode(LIGHT_PIN, INPUT);
pinMode(MIC_PIN, INPUT);
// Initialize LCD
tft.begin();
tft.setRotation(3);
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2.5);
tft.setTextColor(TFT_WHITE);
tft.setCursor(50, 20);
tft.println("Sensor Dashboard");
// Draw box outlines
tft.drawRect(30, 70, 260, 40, TFT_YELLOW); // Light box
tft.drawRect(30, 130, 260, 40, TFT_CYAN); // Sound box
// Initialize SD
if (!SD.begin(SDCARD_SS_PIN, SDCARD_SPI)) {
Serial.println("ERROR: SD Card init failed.");
tft.setCursor(50, 200);
tft.setTextColor(TFT_RED);
tft.println("SD Card Error");
} else {
Serial.println("SD Card ready.");
tft.setCursor(50, 200);
tft.setTextColor(TFT_GREEN);
tft.println("SD Card Ready");
}
}
void loop() {
int lightVal = analogRead(LIGHT_PIN);
int micVal = analogRead(MIC_PIN);
// Format log entry
String logEntry = "Light: " + String(lightVal) + ", Sound: " + String(micVal);
// Log to SD
dataFile = SD.open("/env_log.txt", FILE_WRITE);
if (dataFile) {
dataFile.println(logEntry);
dataFile.close();
Serial.println("Logged: " + logEntry);
}
// Refresh GUI boxes
tft.fillRect(31, 71, 258, 38, TFT_DARKGREY);
tft.fillRect(31, 131, 258, 38, TFT_DARKGREY);
// Display light value
tft.setTextColor(TFT_YELLOW, TFT_DARKGREY);
tft.setTextSize(2);
tft.setCursor(40, 80);
tft.printf("Light Level: %4d", lightVal);
// Display sound value
tft.setTextColor(TFT_CYAN, TFT_DARKGREY);
tft.setCursor(40, 140);
tft.printf("Sound Level: %4d", micVal);
delay(1000);
}
Now let's review the data in the excel file.
🌱 Environmental Monitoring
- Track light levels near windows or plants over time
- Log sound levels around traffic-heavy or industrial areas
🏠 Smart Home Logging
- Detect sudden light changes (open doors/windows)
- Trigger actions when loud sounds are detected (e.g. clap = turn light on)
🧪 Education & STEM
- Use as a classroom demo for analog sensors
- Teach how to record and visualize data trends with CSV/Excel
After logging:
- Remove the SD card, open
env_log.txt
- Save as
.csv
- Open in Excel or Google Sheets
- Plot light vs sound values over time
You could even build time-stamp logic using an RTC or millis()
and add thresholds to trigger alerts.
- Add visual feedback on the Wio Terminal screen
- Trigger events via Telegram alerts using Wi-Fi
- Sync data to Qubitro cloud for real-time dashboards
- Use Blues Wireless Notecard to offload logs over cellular IoT
With just one device and a few lines of code, you've built a powerful light + sound data logger with real environmental applications. Whether you're studying noise patterns or watching daylight cycles, this setup makes exploration super simple—and it's fully expandable for IoT and edge AI magic.
Comments