Skip to the content
2 layers83.8 × 80.8 mmPCB main, the printed circuit board in 3D

Lightweight, deployable embedded sensor hub built on ESP32. With hot-swappable sensor ports, on site SD card logging.

Size
83.8 × 80.8 mm
Copper layers
2
Thickness
1.6 mm
Parts
48
Nets
49
Pads
226
Tracks, vias
386, 72
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
15 Jun 2025
Updated
23 Jun 2025

Overview

PCB main is an open-source printed circuit board by varunsaireddyv, from the varunsaireddyv/modular-esp32-sensor-hub- repository on GitHub, published under the MIT licence. It is a 2-layer board of 83.8 × 80.8 mm with 48 parts on 49 nets, routed with 386 tracks and 72 vias.

It is built around the CH340C and AMS1117-3.3. Its parts include 17 resistors, 6 capacitors, 3 ICs, 2 diodes and 2 connectors. It belongs with the sensors and measurement boards of this library.

Main components

2

README

README.md

modular-esp32-sensor-hub-

Introduction:

This project is a modular ESP32-based sensor hub designed for rapid prototyping and monitoring environements. It supports a wide range of sensors through hot-swappable connectors, with onboard SD card logging, and runs off a 5v li-ion battery. The goal is to offer a deployable, plug-and-play embedded system that’s both scalable and user-friendly.

Primary Design Goals:

Modularity:hot-swappable sensor ports for analog, digital, and I2C devices, swapable power source, programable ESP board

Deployability:standalone and swapable power and onboard storage, light weight custom ESP 32 WROOM 32D board

Plug-and-play:Firmware pre installed and no user input required exept for conecting sensors to premaped sensor pins


Features

  • ESP32-WROOM-32D core (Wi-Fi + BLE)
  • 13 modular sensor ports: digital, analog, and I2C
  • MicroSD card support (SPI) for data logging
  • 0.96" OLED screen support via I2C
  • Shared I2C bus (GPIO21/GPIO22) with pull-up planning
  • Dual voltage rails: 5V (VBUS) and 3.3V (via AMS1117 regulator)
  • USB or Li-ion battery input with diode-based auto-switching
  • Ground stitched bottom layer with dedicated signal routing on top
  • Wide traces (1mm) for power, separate analog and digital zones
  • Modular firmware (coming soon)

Pin Mapping

FunctionGPIO Pin
I2C SDAGPIO21
I2C SCLGPIO22
SD Card CSGPIO5
SD Card CLKGPIO18
SD Card MOSIGPIO23
SD Card MISOGPIO19
Analog Sensor 1GPIO32
Analog Sensor 2GPIO33
Digital Sensor 1GPIO25
Digital Sensor 2GPIO26
Digital Sensor 3GPIO27
Digital Sensor 4GPIO14
Digital Sensor 5GPIO12
Digital Sensor 6GPIO13
OLED (I2C)Shared
I2C Misc Ports 1-2Shared

All analog lines use 1k/2k voltage dividers to drop from 5V to 3.3V safe levels for the ESP32. All sensors are routed through XH-3P connectors with GND, VCC, and Signal/I2C.


Supported Sensors(Default in Firmware)

Analog / Digital Sensors

  • MQ135 (Air Quality)
  • DHT22 (Temp & Humidity)
  • Raindrop Sensor
  • Sound Sensor (x2)
  • Soil Moisture
  • LDR (Light)
  • IR Receiver

I2C Sensors & Modules

  • MPU6050 (Accel + Gyro)
  • BME280 (Temp + Pressure + Humidity)
  • BH1750 (Light)
  • OLED Display

Included Files/Folders

  • Schematic: ESP32_WROOM_D.kicad_sch
  • Board Layout: PCB_main.kicad_pcb
  • Schematic PNG preview: Schemtaic.png
  • 3D render: PCB.png
  • 3D render front: PCB_F.png
  • 3D render back: PCB_B.png
  • License: MIT
  • Firmware: src/, include/, lib/, "platform.ini"
  • Documents: "ERC", "DRC", "Datasheet", "Pin_mapping"

Firmware flow

main.cpp : -Calls SensorManager.begin() → initializes I2C, sets up pins -Calls SensorManager.detectConnectedSensors() → auto-detects attached sensors -Calls SensorManager.readAll() repeatedly inside loop() to read & print sensor data

sensormanger.cpp/.h : -Defines bool flags for each supported sensor -Each sensor has its own analogRead() or I2C detection logic -readAll() only reads sensors that were marked as detected(bool=true)

pins.h : -Central place to edit pin numbers (for future boards or remapping) -Also includes notes on analog/digital/I2C mappings


Adding own sensors

You can plug in any new sensor to unused analog/digital/I2C ports. Here’s how to support it in firmware:

Step 1 : Wiring :

-Connect the sensor to a free port (check Pin Mapping table) -Use correct GND/VCC/SIG (XH-3P)

step 2 : Modify "sensormanger.h" :

-Add a flag for presence detection :

text
extern bool NEW_SENSOR_present;

step 3 : Modify "pins.h" :

-define your sensor with its GIO pin :

text
#define NEW_SENSOR_PIN ##   //replace ## with GIO pin(can be found in sensor data sheet)

step 4 : Modify "sensormanger.cpp" :

-In detectConnectedSensors add :

text
-if (analogRead(NEW_SENSOR_PIN) > 50) NEW_SENSOR_present = true;   //(for analog sensors)
-if (analogRead(NEW_SENSOR_PIN) > 50) NEW_SENSOR_present = true;   //(for digital sensors)
-Check sensor library for I2C (differs from sensor to sensor reffer sesnormanager.cpp for refrence)

-In readAll add :

text
-if (NEW_SENSOR_present) {
  int val = analogRead(NEW_SENSOR_PIN);   //(for analog)
  }
-if (NEW_SENSOR_present) {
  int val = digitalRead(NEW_SENSOR_PIN);   //(for analog)
    }
  -Check sensor library for I2C (differs from sensor to sensor reffer sesnormanager.cpp for refrence)


  

step 5 : SD card logging

-5.1 : Update sdlogger.h :

-In sdlogger.h, go to the writeRow() function declaration. Add your new sensor’s argument at the end:

text
void writeRow(
    String timestamp,
    ...
    String BH1750,
    String NEW_SENSOR      //<-- Add this
) ;

5.2 : Update sdlogger.cpp :

-Update the writeRow() definition: -Add the new parameter to the function like:

text
void writeRow(
    String timestamp,
    ...
    String BH1750,
    String NEW_SENSOR       //<-- Add here too
) {

-Add it to the file write block: -Scroll to where values are written into the file. Append this:

text
file.print(NEW_SENSOR); file.println();    //<-- Just before file.close();

-Update the CSV header: -Only needed once, in the same file (inside if (!SD.exists("/logs.csv"))):

text
file.println("Time stamp,MQ135-D,MQ135-A,DHT22,RAIN-A,RAIN-D,SOUND-A,SOUND-D,SOIL-A,SOIL-D,MPU6050,BMP180,BH1750,NEW_SENSOR");

5.3 : Modify readAll() in SensorManager : -If your sensor is optional/detectable:

text
String newSensorValue = "NA";
if (NEW_SENSOR_present) {
  int val = analogRead(NEW_SENSOR_PIN);  // or digitalRead / I2C
  newSensorValue = String(val);

-Then pass it to the logger:

text
SdLogger::writeRow(
  timestamp,
  mq135_d, mq135_a,
  dht22,
  rain_a, rain_d,
  sound_a, sound_d,
  soil_a, soil_d,
  mpu6050,
  bmp180,
  bh1750,
  newSensorValue       //<-- Final argument
);
}

Flashing the Board (PlatformIO)

To upload firmware to the ESP32 board:

  1. Install PlatformIO:

    -VSCode + PlatformIO extension -Or via CLI: https://platformio.org/install/cli

  2. Clone this repo:

    -git clone https://github.com/varunsaireddyv/modular-esp32-sensor-hub-.git -cd modular-esp32-sensor-hub-

  3. Plug in the board via USB

  4. Build and upload -pio run --target upload


Hardware Design Notes

  • 2-layer PCB: Top for signals, Bottom for full GND plane
  • GND stitching via multiple vias across zones
  • AMS1117 regulator outputs 3.3V rail, with thick trace routing
  • Diode-logic used to auto-select between USB or battery power
  • All connectors: XH-3P format for modularity
  • I2C pull-up resistors placed close to MCU

License

This project is licensed under the MIT License. See LICENSE file for full terms. You may freely modify, distribute, or use this project in your own designs.

For hire !!

reach out at : varunbillas@gmail.com

Parts

48
QtyValueFootprintReferences
10Conn_01x03Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ_DHT, LDR, MQ135_A, MQ135_D, Rain_A, Rain_D, Soil_A, Soil_D, Sound_A, Sound_D
810kΩResistor_SMD:R_0603_1608MetricR1, R2, R4, R6, R8, R10, R12, R14
66.2kΩResistor_SMD:R_0603_1608MetricR5, R7, R9, R11, R13, R15
6Conn_01x04Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalBH1750, BMP180, misc1, misc2, MPU6050, oled1
2100nFCapacitor_SMD:C_0201_0603MetricC5, C6
21N5819Diode_THT:D_DO-41_SOD81_P10.16mm_HorizontalD1, D2
24.7kΩResistor_SMD:R_0603_1608MetricR16, R17
10.1uFCapacitor_SMD:C_0201_0603MetricC2
110uFCapacitor_SMD:C_0201_0603MetricC1
110uFCapacitor_SMD:C_0603_1608MetricC4
122uFCapacitor_SMD:C_0603_1608MetricC3
15.1kΩResistor_SMD:R_0603_1608MetricR3
1AMS1117-3.3Package_TO_SOT_SMD:SOT-223-3_TabPin2U3
1BOOT OPTIONButton_Switch_SMD:SW_MEC_5GSH9SW1
1CH340CPackage_SO:SOIC-16_3.9x9.9mm_P1.27mmU2
1Conn_01x02Connector_JST:JST_PH_S2B-PH-K_1x02_P2.00mm_HorizontalJ1
1Conn_01x06Connector_PinHeader_1.27mm:PinHeader_1x06_P1.27mm_VerticalSD1
1USB_C_Plug_USB2.0Connector_USB:USB_C_Receptacle_HRO_TYPE-C-31-M-12P1
1exp32wroomdesp32:ESP32-WROOM-32DU1

Similar boards

  • 2 layers85 × 56 mmHB RF ETH, the printed circuit board in 3D

    HB RF ETH

    alexreinert/PCB

    Some of my PCBs

    96 parts104
  • 2 layers90.2 × 90 mmSra dev board 2026, the printed circuit board in 3D

    Sra dev board 2026

    SRA-VJTI/sra-board-hardware-design

    ESP32-based Development Board for Robotics and Embedded Applications

    219 parts81MIT
  • 4 layers101.6 × 53.3 mmZ80ctrlng, the printed circuit board in 3D

    Z80ctrlng

    jblang/z80ctrl

    AVR-based bootloader, I/O, and debugging for Z80-based computers

    65 parts73
  • 4 layers62.5 × 60 mmUnijoysticle2 c64, the printed circuit board in 3D

    Unijoysticle2 c64

    ricardoquesada/unijoysticle2

    Bluetooth gamepad support for the Commodore 64 / Atari / Amiga, etc.

    58 parts62
  • 2 layers99.5 × 90.5 mmMRR ESPA, the printed circuit board in 3D

    MRR ESPA

    maplerainresearch/MRR_ESPA

    A basic 3D printer control board based on ESP32

    130 parts59
  • 2 layers102 × 102 mmMRR ESPE, the printed circuit board in 3D

    MRR ESPE

    maplerainresearch/MRR_ESPE

    MRR ESPE 3D printer control board

    168 parts39
  • 2 layers139.7 × 88.9 mmCharge Controller, the printed circuit board in 3D

    Charge Controller

    jharvey/Charge_Controller

    MPPT hardware which uses FUGU firmware

    163 parts24
  • 4 layers65.9 × 52.9 mmEX CSB1, the printed circuit board in 3D

    EX CSB1

    DCC-EX/EX-CSB1

    Open source EX-CSB1 CommandStation / Booster

    103 parts13

Questions

How big is the PCB main PCB?

It measures 83.8 × 80.8 mm and has 2 copper layers, 1.6 mm thick.

What parts does the PCB main use?

48 parts, built around the CH340C and AMS1117-3.3. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the PCB main KiCad files?

From the varunsaireddyv/modular-esp32-sensor-hub- repository on GitHub, at the commit this page was made from: the board is Hardware/pcb/PCB_main.kicad_pcb and its schematic Hardware/schematics/ESP32_WROOM_D.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the PCB main design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).