Data Logger

I’ll finish the remaining schematic wiring, verify the design, and update the key project docs with any open risks or bring-up notes.
Finished the schematic phase: USB-C, CAN/OBD2, RTC/I2C, microSD, UART, ADC, buttons, LED, power, and no-connect handling are wired, and the checked ERC categories are clean.
Created docs:
Open items before layout/manufacturing:
  • Verify OBD2 connector mechanical gender/fit.
  • Review 3.3 V LDO thermals under ESP32 + microSD + WiFi load.
  • Replace/approve the provisional P-channel MOSFET with an automotive-qualified part if robustness matters.
Suggested next steps:
  1. Set board size, stackup, and layout rules.
  2. Place components with automotive/USB/CAN/antenna constraints.
  3. Route the PCB and clear DRC/airwires.
Layout and fixes
Start PCB layout
Verify OBD2 fit
Review LDO thermals
Replace MOSFET

Refine this doc
Ask about this doc
Firmware Starter — ESP32-S3 OBD2 Data Logger
Platform
  • MCU/module: ESP32-S3-WROOM-2-N32R16V
  • Recommended framework: Arduino for ESP32 via PlatformIO
  • Supply: 3.3 V logic
Pin Map

Table


FunctionESP32-S3 GPIONetConnected To
USB D-GPIO19USB_D_N_MCUJ2 via R16 22Ω and U6 ESD
USB D+GPIO20USB_D_P_MCUJ2 via R17 22Ω and U6 ESD
CAN TXGPIO4CAN_TXU4 TJA1049 TXD
CAN RXGPIO5CAN_RXU4 TJA1049 RXD
CAN STBGPIO6CAN_STBU4 STB, R5 pull-up
I2C SDAGPIO8I2C_SDAU5 DS3231 + J4 + R9 4.7k
I2C SCLGPIO9I2C_SCLU5 DS3231 + J4 + R10 4.7k
RTC resetGPIO7RTC_RSTU5 ~RST
RTC interruptGPIO15RTC_INTU5 INT/SQW, R6 pull-up
SD SCKGPIO10SD_SCK_MCUR18 33Ω to J3 CLK
SD MOSI/CMDGPIO11SD_MOSI_MCUR19 33Ω to J3 CMD
SD MISO/DAT0GPIO12SD_MISO_MCUR20 33Ω from J3 DAT0
SD CS/DAT3GPIO13SD_CS_DAT3J3 CD/DAT3, R12 pull-up
BOOTGPIO0BOOT_IO0SW3 + R8 pull-up
User buttonGPIO14USER_BUTTONSW4 + R21 pulldown
Status LEDGPIO21STATUS_LEDR11 + D4
UART TXGPIO17UART_TXJ5 pin 2
UART RXGPIO18UART_RXJ5 pin 3
ADC AGPIO1ADC1_CH0J6 pin 2, R22 pulldown
ADC BGPIO2ADC1_CH1J6 pin 3
platformio.ini

Ini


[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
lib_deps =
  adafruit/RTClib@^2.1.4
  sandeepmistry/CAN@^0.3.1
Starter Source

Cpp


#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <RTClib.h>
#include <CAN.h>

constexpr int PIN_CAN_TX = 4;
constexpr int PIN_CAN_RX = 5;
constexpr int PIN_CAN_STB = 6;
constexpr int PIN_I2C_SDA = 8;
constexpr int PIN_I2C_SCL = 9;
constexpr int PIN_SD_SCK = 10;
constexpr int PIN_SD_MOSI = 11;
constexpr int PIN_SD_MISO = 12;
constexpr int PIN_SD_CS = 13;
constexpr int PIN_USER_BUTTON = 14;
constexpr int PIN_RTC_INT = 15;
constexpr int PIN_STATUS_LED = 21;
constexpr int PIN_UART_TX = 17;
constexpr int PIN_UART_RX = 18;
constexpr int PIN_ADC0 = 1;
constexpr int PIN_ADC1 = 2;

RTC_DS3231 rtc;
SPIClass sdSPI(FSPI);
HardwareSerial PortB(1);

void setup() {
  Serial.begin(115200);
  pinMode(PIN_STATUS_LED, OUTPUT);
  pinMode(PIN_CAN_STB, OUTPUT);
  pinMode(PIN_USER_BUTTON, INPUT);
  digitalWrite(PIN_CAN_STB, LOW); // normal CAN mode

  Wire.begin(PIN_I2C_SDA, PIN_I2C_SCL);
  if (!rtc.begin()) Serial.println("DS3231 not found");

  sdSPI.begin(PIN_SD_SCK, PIN_SD_MISO, PIN_SD_MOSI, PIN_SD_CS);
  if (!SD.begin(PIN_SD_CS, sdSPI)) Serial.println("microSD init failed");

  CAN.setPins(PIN_CAN_RX, PIN_CAN_TX);
  if (!CAN.begin(500E3)) Serial.println("CAN init failed");

  PortB.begin(115200, SERIAL_8N1, PIN_UART_RX, PIN_UART_TX);
  Serial.println("OBD2 logger starter running");
}

void loop() {
  digitalWrite(PIN_STATUS_LED, millis() / 500 % 2);
  int packetSize = CAN.parsePacket();
  if (packetSize) {
    File f = SD.open("/canlog.csv", FILE_APPEND);
    DateTime now = rtc.now();
    if (f) {
      f.printf("%lu,%04d-%02d-%02dT%02d:%02d:%02d,0x%lX,", millis(), now.year(), now.month(), now.day(), now.hour(), now.minute(), now.second(), CAN.packetId());
      while (CAN.available()) f.printf("%02X ", CAN.read());
      f.println();
      f.close();
    }
  }
  delay(5);
}
Flash Notes
Use USB-C native USB. Hold BOOT (SW3), tap RESET (SW2), release BOOT if manual bootloader entry is needed.
  • Platform

  • Pin Map

  • platformio.ini

  • Starter Source

  • Flash Notes

Documents

  • Project Specification — ESP32-S3 OBD2 Data Logger

  • Power Budget — ESP32-S3 OBD2 Data Logger

  • Firmware Starter — ESP32-S3 OBD2 Data Logger

  • Board Bring-Up Plan — ESP32-S3 OBD2 Data Logger

  • Regulatory and Automotive Notes — ESP32-S3 OBD2 Data Logger

Assets

Assets are files uploaded to this project which can be used in various ways.

ESP32-S3 OBD2 Data Logger thumbnail
Automotive OBD2 data logger based on ESP32-S3-WROOM-2 with robust 12–24V input protection, USB-C, CAN transceiver, microSD storage, RTC, and expansion ports.

Properties

Pricing & Availability

Distributor

Qty 1

Arrow

$13.38–$23.17

Digi-Key

$29.12–$29.52

HQonline

$8.87–$9.02

LCSC

$22.92–$24.48

Mouser

$41.14–$41.57

TME

$3.08

Verical

$12.67–$82.22

Controls