Sounds like you’re gearing up for the classic “ESP32 + MCP2515 → J1939 CAN → Display” build! To make sure I give you exactly what you need, a couple of quick questions:
-
Which display are you planning on using?
• OLED (SSD1306 via I2C)?
• SPI TFT (ILI9341, ST7735, etc.)?
• Touchscreen?
-
What bus are you tapping into?
• Vehicle OBD-II (pins 6/14)?
• DB9 / industrial CAN?
-
Which J1939 parameters (PGNs/SPNs) are you most interested in?
• Engine RPM (PGN 61444)
• Coolant Temp (PGN 65262)
• Fuel Level, Vehicle Speed, Distance, etc.?
Once I know your display & the data you need, I’ll tailor:
• A simple wiring diagram
• Minimal Arduino-style code for CAN + J1939 parsing
• Display-update loop
—
In the meantime, here’s a skeleton outline so you can start wiring up:
-
Hardware
• ESP32 VSPI → MCP2515 (SPI_CS, INT, CANH/CANL)
• ESP32 VSPI or I2C → Display (CS/DC/RST or SDA/SCL)
• 5 V → MCP2515 VCC, 3.3 V → ESP32 & display (if 3.3 V)
• CAN termination: 120 Ω at each bus end
-
Libraries
• “mcp_can_lib” for MCP2515
• Your display’s library: e.g. Adafruit_SSD1306 + Adafruit_GFX or TFT_eSPI
-
Code Skeleton
#include <SPI.h>
#include <mcp_can.h>
#include <YourDisplayLib.h>
// MCP2515 pins
#define CAN_CS 5
#define CAN_INT 2
MCP_CAN CAN(CAN_CS);
// Display object (fill in your pins & driver)
YourDisplayClass display(/*cd*/ , /*cs*/, /*rst*/);
void setup() {
Serial.begin(115200);
SPI.begin();
// Init CAN @250kbps
while (CAN_OK != CAN.begin(MCP_STDEXT, CAN_250KBPS, MCP_8MHZ))
delay(100), Serial.println("CAN init failed");
// Init Display
display.begin();
display.clear();
}
void loop() {
if (CAN_MSGAVAIL == CAN.checkReceive()) {
uint8_t len, buf[8];
uint32_t id;
CAN.readMsgBuf(&len, buf);
id = CAN.getCanId();
// parse extended ID, extract PGN, SPNs…
// e.g. if PGN==0xF004 → RPM = ((buf[3]<<8)|buf[2])*0.125
}
// update display with latest values…
}
Reply with your display choice and PGNs, and I’ll drop in the full wiring + code! 🚀