This project is a complete rebuild of the original idea. It is no longer just a wooden monitor shelf. The riser now combines an actual Waveshare ESP32-S3 touchscreen board, true CO₂ sensing, temperature and humidity monitoring, a physical focus-timer control, addressable ambient lighting and a separate powered USB hub.
The design intentionally uses modules that can be bought individually. No custom PCB is required for the first build, and every electronic subsystem can be replaced independently.
What the Smart Monitor Riser Does
- Raises the monitor to a more comfortable viewing height.
- Shows a focus timer, CO₂, temperature and humidity on a 3.5-inch display.
- Uses a rotary encoder to set, start and pause focus sessions.
- Changes ambient lighting according to focus state and air quality.
- Adds convenient front USB ports using a real powered USB-hub board.
- Runs the desk functions locally on the ESP32-S3 with no cloud service required.
Main Controller
The build uses the Waveshare ESP32-S3-Touch-LCD-3.5. This single board combines an ESP32-S3R8, 3.5-inch 320×480 capacitive IPS display, 8 MB PSRAM, 16 MB flash, Wi-Fi, Bluetooth LE, USB-C, RTC, IMU, TF-card slot, audio hardware and a 32-pin expansion header.
Waveshare’s official Arduino examples define the LCD connections as MOSI GPIO 1, MISO GPIO 2, DC GPIO 3, SPI clock GPIO 5 and backlight GPIO 6. The shared board I²C bus is SDA GPIO 8 and SCL GPIO 7. This project keeps those official assignments.
Bill of Materials
| Part | Qty | Specification | Purpose |
|---|---|---|---|
| Waveshare ESP32-S3-Touch-LCD-3.5 | 1 | 3.5-inch IPS, 320×480, ESP32-S3R8, 8 MB PSRAM, 16 MB flash | Main controller and display |
| Sensirion SCD41 breakout | 1 | I²C, address 0x62; use a breakout intended for maker wiring | True CO₂ measurement |
| SHT31-D breakout | 1 | I²C, default address 0x44; approximately ±0.3°C / ±2% RH class | Temperature and humidity |
| EC11 rotary encoder with push switch | 1 | Standard incremental encoder, preferably on a breakout | Timer and menu control |
| WS2812B LED strip | 0.5–1 m | 5 V, 30 LEDs/m is sufficient | Ambient/status lighting |
| 74AHCT125 level shifter | 1 | 5 V logic buffer | Reliable 3.3 V-to-5 V WS2812B data conversion |
| 330–470 Ω resistor | 1 | Series resistor on LED data | Signal protection |
| 1000 µF electrolytic capacitor | 1 | Across LED 5 V/GND near strip input | Power transient suppression |
| Powered 4-port USB hub module | 1 | Real upstream USB connection plus dedicated 5 V input | Front USB expansion |
| 5 V / 5 A regulated power supply | 1 | Quality enclosed or certified external supply | Main low-voltage power source |
| Inline fuse / fused distribution | 1 | Size to the final wiring and expected load | Main power protection |
| Wood or plywood panels | as needed | 12–18 mm top panel recommended | Riser enclosure |
| M2.5/M3 standoffs, screws, wire, cable glands | set | Standard hardware | Mounting and wiring |
Suggested Dimensions
A practical single-monitor starting point is around 600 × 240 × 105 mm. Measure your monitor base and keyboard before cutting material.
- Top panel: roughly 600 × 240 mm.
- Height: 95–120 mm depending on desk ergonomics.
- Leave at least 25–35 mm clear space behind the display PCB.
- Add ventilation openings close to the SCD41 and SHT31-D.
Recommended Internal Layout
Mount the display near the center of the front panel and the encoder next to it. Place the USB hub toward one side so short cables do not cross the display. Put the CO₂ sensor beside a ventilated opening, away from the display regulator, USB hub and LED power wiring.
Verified Wiring Plan
| Function | GPIO | Why |
|---|---|---|
| LCD MOSI | GPIO 1 | Official Waveshare Arduino mapping |
| LCD MISO | GPIO 2 | Official Waveshare Arduino mapping |
| LCD DC | GPIO 3 | Official Waveshare Arduino mapping |
| LCD SPI clock | GPIO 5 | Official Waveshare Arduino mapping |
| LCD backlight | GPIO 6 | Official Waveshare Arduino mapping |
| I²C SCL | GPIO 7 | Board I²C header / official example |
| I²C SDA | GPIO 8 | Board I²C header / official example |
| WS2812B data | GPIO 38 | Exposed expansion-header GPIO |
| Encoder A | GPIO 39 | Exposed expansion-header GPIO |
| Encoder B | GPIO 40 | Exposed expansion-header GPIO |
| Encoder switch | GPIO 41 | Exposed expansion-header GPIO |
Board revision check: before soldering, compare the labels on your exact board with the current Waveshare pinout. GPIO 38–41 are used here because they are brought to the expansion header. If you attach optional hardware that also needs one of these pins, remap the project first.
SCD41
- VIN → the voltage specified by your breakout (3.3 V is safe for common maker breakouts)
- GND → GND
- SDA → GPIO 8
- SCL → GPIO 7
SHT31-D
- VIN → 3.3 V
- GND → GND
- SDA → GPIO 8
- SCL → GPIO 7
SCD4x uses I²C address 0x62; SHT31-D normally uses 0x44, so both can share the same bus.
EC11 encoder
- A / CLK → GPIO 39
- B / DT → GPIO 40
- Push switch → GPIO 41
- Common → GND
WS2812B strip
- 5 V → dedicated fused 5 V branch
- GND → common power ground
- ESP32 GPIO 38 → 74AHCT125 → 330–470 Ω resistor → DIN
- 1000 µF capacitor across 5 V/GND close to the first LED
Power Architecture
Do not power the complete build through an ESP32 GPIO or 3.3 V pin. Use one regulated 5 V supply with separate branches:
- ESP32 display board: feed through its documented USB-C / power input.
- USB hub: give the hub its own 5 V branch.
- LED strip: give the strip its own fused 5 V branch.
- Sensors: power from the appropriate regulated output specified by each breakout.
Join grounds correctly where signals are shared. Do not back-feed 5 V into the board’s 3.3 V rail.
Step-by-Step Build
1. Confirm the mechanical size
Place the monitor and keyboard on the desk, measure the required width and clearance, then cut the top and side panels. Dry-fit the structure before making electronics openings.
2. Cut the front panel
Use the physical display board and USB-hub board as templates. Cut separate openings for the screen, encoder shaft and USB connectors. Leave enough material around the openings so the front panel stays rigid.
3. Mount boards on standoffs
Use screws and standoffs rather than permanently gluing boards to wood. Keep the ESP32 USB-C connector and hub upstream connector accessible for service.
4. Vent the environmental sensors
Cut several small ventilation slots next to the SCD41. Do not bury the sensor in a warm sealed cavity. Mount the SHT31-D in the same airflow but away from regulators and LEDs.
5. Test the display alone
Before connecting anything else, upload Waveshare’s official 08_gfx_helloworld example. Confirm the LCD, reset sequence and backlight work.
6. Add the sensors
Connect SCD41 and SHT31-D to GPIO 7/8. Run an I²C scanner and confirm the expected addresses before continuing.
7. Add the encoder
Connect the encoder to GPIO 39, 40 and 41. Test both directions and the push switch. If rotation is reversed, swap the A and B definitions in firmware.
8. Add lighting
Wire GPIO 38 through a 74AHCT125 level shifter and the series resistor to WS2812B DIN. Start with low brightness. Power the LED strip directly from the 5 V lighting branch, not through the ESP32 board.
9. Install the USB hub
The hub upstream connector goes to the computer like any normal hub. Its 5 V input goes to the dedicated power branch. Confirm normal hub operation before closing the case.
10. Run a 30-minute load test
Turn on the display and LEDs, run the sensors and connect several low-power USB devices. Check voltage stability, regulator temperature and cable temperature. Only then close the enclosure.
Firmware
The code below uses Waveshare’s official LCD/I²C pin assignments and the current Sensirion SCD4x API. It implements the dashboard, CO₂ reading, optional SHT31-D reading, focus timer, rotary control and ambient status lighting.
Arduino libraries
- GFX Library for Arduino (
Arduino_GFX) - TCA9554 library supplied/recommended by Waveshare for this board
- Sensirion I2C SCD4x
- Adafruit SHT31 Library
- Adafruit NeoPixel
#include <Arduino.h>
#include <Wire.h>
#include <Arduino_GFX_Library.h>
#include "TCA9554.h"
#include <SensirionI2cScd4x.h>
#include <Adafruit_SHT31.h>
#include <Adafruit_NeoPixel.h>
// Waveshare ESP32-S3-Touch-LCD-3.5 official LCD / I2C mapping
#define LCD_BL 6
#define LCD_MISO 2
#define LCD_MOSI 1
#define LCD_SCLK 5
#define LCD_CS -1
#define LCD_DC 3
#define LCD_RST -1
#define I2C_SDA 8
#define I2C_SCL 7
// Free expansion-header GPIOs used by this project
#define LED_PIN 38
#define ENC_A 39
#define ENC_B 40
#define ENC_SW 41
#define LED_COUNT 18
TCA9554 tca(0x20);
Arduino_DataBus *bus = new Arduino_ESP32SPI(
LCD_DC, LCD_CS, LCD_SCLK, LCD_MOSI, LCD_MISO
);
Arduino_GFX *gfx = new Arduino_ST7796(
bus, LCD_RST, 0, true, 320, 480
);
SensirionI2cScd4x scd4x;
Adafruit_SHT31 sht31 = Adafruit_SHT31();
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
bool scdOk = false;
bool shtOk = false;
uint16_t co2ppm = 0;
float temperatureC = NAN;
float humidityRH = NAN;
int focusMinutes = 25;
uint32_t focusSeconds = 25 * 60;
bool focusRunning = false;
uint32_t lastSecondTick = 0;
uint32_t lastSensorPoll = 0;
uint32_t lastScreenDraw = 0;
int lastEncA = HIGH;
bool lastButton = HIGH;
uint32_t lastButtonChange = 0;
void lcdReset() {
tca.write1(1, 1);
delay(10);
tca.write1(1, 0);
delay(10);
tca.write1(1, 1);
delay(200);
}
void setAmbient(uint8_t r, uint8_t g, uint8_t b) {
for (int i = 0; i < LED_COUNT; i++) {
strip.setPixelColor(i, strip.Color(r, g, b));
}
strip.show();
}
void updateAmbient() {
if (co2ppm >= 1500) {
setAmbient(140, 0, 0); // red: ventilate now
} else if (co2ppm >= 1000) {
setAmbient(150, 45, 0); // amber: air getting stale
} else if (focusRunning) {
setAmbient(0, 30, 140); // blue: focus session
} else {
setAmbient(100, 48, 12); // warm desk light
}
}
String mmss(uint32_t sec) {
char buf[8];
snprintf(buf, sizeof(buf), "%02lu:%02lu",
(unsigned long)(sec / 60),
(unsigned long)(sec % 60));
return String(buf);
}
void drawCard(
int x, int y, int w, int h,
const char *label,
const String &value,
uint16_t accent
) {
gfx->fillRoundRect(x, y, w, h, 10, gfx->color565(10, 24, 47));
gfx->drawRoundRect(x, y, w, h, 10, accent);
gfx->setTextColor(gfx->color565(150, 180, 210));
gfx->setTextSize(1);
gfx->setCursor(x + 10, y + 12);
gfx->print(label);
gfx->setTextColor(gfx->color565(245, 250, 255));
gfx->setTextSize(2);
gfx->setCursor(x + 10, y + 34);
gfx->print(value);
}
void drawDashboard() {
gfx->fillScreen(gfx->color565(3, 10, 24));
gfx->setTextColor(gfx->color565(78, 220, 255));
gfx->setTextSize(2);
gfx->setCursor(18, 18);
gfx->print("SMART MONITOR RISER");
gfx->setTextColor(gfx->color565(245, 250, 255));
gfx->setTextSize(4);
gfx->setCursor(18, 58);
gfx->print(mmss(focusSeconds));
gfx->setTextSize(1);
gfx->setTextColor(
focusRunning
? gfx->color565(80, 235, 150)
: gfx->color565(160, 180, 200)
);
gfx->setCursor(20, 105);
gfx->print(focusRunning ? "FOCUS RUNNING" : "PRESS KNOB TO START");
String tempText =
isnan(temperatureC) ? "--.- C" : String(temperatureC, 1) + " C";
String humText =
isnan(humidityRH) ? "-- %" : String(humidityRH, 0) + " %";
String co2Text =
co2ppm ? String(co2ppm) + " ppm" : "warming up";
drawCard(
18, 135, 135, 78,
"TEMPERATURE",
tempText,
gfx->color565(70, 170, 255)
);
drawCard(
172, 135, 135, 78,
"HUMIDITY",
humText,
gfx->color565(70, 230, 190)
);
drawCard(
326, 135, 135, 78,
"CO2",
co2Text,
co2ppm >= 1500
? gfx->color565(255, 80, 60)
: co2ppm >= 1000
? gfx->color565(255, 170, 50)
: gfx->color565(75, 230, 150)
);
gfx->setTextColor(gfx->color565(150, 175, 200));
gfx->setTextSize(1);
gfx->setCursor(18, 252);
gfx->print("Turn knob: set focus length");
gfx->setCursor(18, 269);
gfx->print("Press: start / pause");
gfx->setCursor(18, 286);
gfx->print("CO2 <1000 good | 1000-1499 stale | >=1500 ventilate");
}
void readSensors() {
bool dataReady = false;
int16_t err = scd4x.getDataReadyStatus(dataReady);
if (err == 0 && dataReady) {
float scdTemp = 0;
float scdHumidity = 0;
uint16_t ppm = 0;
err = scd4x.readMeasurement(ppm, scdTemp, scdHumidity);
if (err == 0 && ppm > 0) {
co2ppm = ppm;
// SCD41 can provide T/RH too.
// Use those values as fallback if no SHT31-D is installed.
if (!shtOk) {
temperatureC = scdTemp;
humidityRH = scdHumidity;
}
}
}
if (shtOk) {
float t = sht31.readTemperature();
float h = sht31.readHumidity();
if (!isnan(t)) temperatureC = t;
if (!isnan(h)) humidityRH = h;
}
updateAmbient();
}
void handleEncoder() {
int a = digitalRead(ENC_A);
if (a != lastEncA && a == HIGH && !focusRunning) {
bool clockwise = digitalRead(ENC_B) != a;
focusMinutes += clockwise ? 5 : -5;
focusMinutes = constrain(focusMinutes, 5, 90);
focusSeconds = focusMinutes * 60;
}
lastEncA = a;
bool button = digitalRead(ENC_SW);
if (button != lastButton && millis() - lastButtonChange > 35) {
lastButtonChange = millis();
lastButton = button;
if (button == LOW) {
if (focusSeconds == 0) {
focusSeconds = focusMinutes * 60;
}
focusRunning = !focusRunning;
updateAmbient();
}
}
}
void setup() {
Serial.begin(115200);
// Shared onboard I2C bus
Wire.begin(I2C_SDA, I2C_SCL);
// Waveshare LCD reset is controlled through TCA9554
tca.begin();
tca.pinMode1(1, OUTPUT);
lcdReset();
if (!gfx->begin()) {
Serial.println("Display init failed");
}
// Landscape orientation: 480 x 320
gfx->setRotation(1);
pinMode(LCD_BL, OUTPUT);
digitalWrite(LCD_BL, HIGH);
pinMode(ENC_A, INPUT_PULLUP);
pinMode(ENC_B, INPUT_PULLUP);
pinMode(ENC_SW, INPUT_PULLUP);
lastEncA = digitalRead(ENC_A);
strip.begin();
strip.setBrightness(50);
strip.show();
// SCD41 / SCD40 use address 0x62.
scd4x.begin(Wire, SCD41_I2C_ADDR_62);
scd4x.wakeUp();
delay(30);
scd4x.stopPeriodicMeasurement();
scd4x.reinit();
scdOk = (scd4x.startPeriodicMeasurement() == 0);
// Optional dedicated temperature/humidity sensor.
shtOk = sht31.begin(0x44);
Serial.printf("SCD4x: %s\n", scdOk ? "OK" : "not detected");
Serial.printf("SHT31-D: %s\n", shtOk ? "OK" : "not detected");
updateAmbient();
drawDashboard();
}
void loop() {
handleEncoder();
if (focusRunning && millis() - lastSecondTick >= 1000) {
lastSecondTick += 1000;
if (focusSeconds > 0) {
focusSeconds--;
}
if (focusSeconds == 0) {
focusRunning = false;
setAmbient(0, 130, 35);
}
} else if (!focusRunning) {
lastSecondTick = millis();
}
if (millis() - lastSensorPoll >= 5000) {
lastSensorPoll = millis();
if (scdOk || shtOk) {
readSensors();
}
}
if (millis() - lastScreenDraw >= 500) {
lastScreenDraw = millis();
drawDashboard();
}
delay(5);
}
How It Behaves
- Turn the encoder while stopped to select a focus session from 5 to 90 minutes.
- Press the encoder to start or pause.
- Blue underglow means focus mode.
- Amber means CO₂ has reached the ventilation-warning range.
- Red means CO₂ is high and the room should be ventilated.
- The screen continuously shows timer, temperature, humidity and CO₂.
First-Boot Checklist
- Power only the Waveshare board and confirm the official display example works.
- Open Serial Monitor at 115200 baud and check that the board is stable.
- Add SCD41 and wait for its first periodic sample.
- Add SHT31-D and verify plausible temperature/humidity values.
- Test the encoder.
- Add the LED level shifter and strip at low brightness.
- Connect the powered USB hub last.
Troubleshooting
Black display
Run the untouched Waveshare display example first. The panel reset line is handled through the onboard TCA9554 expander, so omitting that reset sequence can leave the panel blank.
SCD41 not found
Check for I²C address 0x62, verify SDA GPIO 8 / SCL GPIO 7, and confirm the breakout’s supply requirement. A bare sensor and a regulated breakout are not wired the same way.
Temperature reads too high
Move the sensor farther from the display board, USB hub and LED power wiring, and improve airflow through the riser.
ESP32 resets when LEDs get bright
The 5 V supply or wiring is undersized, or LED current is being routed through the controller board. Use the dedicated LED branch and common ground.
USB devices disconnect
Treat this as a USB-hub/power issue. Verify the hub supports external 5 V power and that the supply has enough current for attached devices.
Useful Upgrades
- NTP time synchronization over Wi-Fi.
- CO₂ history logging to the onboard TF card.
- Presence sensing to dim the display when the desk is empty.
- Local web page for timer presets and LED brightness.
- Use the board’s audio hardware for quiet timer alerts.
Reference Documentation
- Waveshare ESP32-S3-Touch-LCD-3.5 documentation
- Official Waveshare Arduino examples
- Sensirion SCD41 documentation
Final Result
The finished Smart Monitor Riser is now a genuine electronics project: it combines a real ESP32-S3 touchscreen, true CO₂ sensing, temperature/humidity monitoring, a physical focus timer, controlled ambient lighting and a proper powered USB hub in one practical desk accessory.

