English summary: Episode 3 of the "CAN Bus in Practice" series moves from Arduino to the PC. Six posts (2024–2025) become one story: the PCAN-USB and PCAN-Basic C# sample, turning it into a custom sniffer (why a 100 ms timer measures 109 ms on Windows), a dual-channel MDI monitor with two PeakCAN adapters, reading the 17-character VIN with multi-frame ISO-TP and the missing Flow Control frame, reading DTCs with a small dashboard, and letting AI explain trouble codes safely: look up the standard definition first, then ask.
這是「CAN Bus 實戰」系列的第三集,把部落格 2024~2025 年六篇 PeakCAN 文章整理成一條線:從官方 C# 範例開始,改成自己的 Sniffer、接兩台做雙通道,解開「VIN 只回三個字」的多幀之謎,最後讓 AI 解釋故障碼,並看看它會不會講錯。影片約 20 分鐘,有章節可以跳著看。
English summary: Episode 2 of the "CAN Bus in Practice" series combines four 2023 posts into one story: using an ECU simulator as a safe practice target (OBD-II modes, six knobs = six PIDs, 7DF/7E8 vs 29-bit IDs), decoding Mode 01 live data byte by byte, sniffing what a cheap ELM327 + Torque app actually puts on the bus, taking a 682 NT toolkit to a real car (listen-only mode, gateways), and decoding diagnostic trouble codes (two bytes per DTC, Modes 03/07/0A/04/02).
為什麼要「主動送」?翻了前一天的實機 log,車機只在每次 Linux 開機完成、報上 External Device ID 之後,跟 GO 要 1 次 GO 資料,之後就不再要了(一天 7 次,全部都是開機當下)。它每 10 秒送一次 protobuf,但對照 Geotab 官方的 iox_messaging.proto,最外層欄位編號對不上,不是標準的訂閱訊息,所以也不是在訂閱車速。照標準流程,車機只會拿到開機那一刻的車速;要即時車速只能由 GO 主動送,但這不在規格裡,車機收不收要實測。
using System.ClientModel;
using OpenAI;
using OpenAI.Chat;
// 雲端 OpenAI:金鑰從環境變數讀
ChatClient cloud = new("gpt-4.1-mini",
Environment.GetEnvironmentVariable("OPENAI_API_KEY"));
// 本機 Ollama(GX10):金鑰隨便填,不會檢查
ChatClient local = new("gemma4:12b",
new ApiKeyCredential("ollama"),
new OpenAIClientOptions { Endpoint = new Uri("http://GX10的IP:11434/v1") });
本專題利用ESP32+MCP2515 CAN Bus module搭配CANHacker軟體和Torque APP去分析接收到ECU Simulator的診斷錯誤碼的PID資料. This topic uses the ESP32+MCP2515 CAN Bus module with CANHacker software and Torque APP to analyze the PID data of the diagnostic trouble codes received from the ECU Simulator.
In this project it will be demonstrated that the ELM327 (Bluetooth interface), ECU emulator and ESP32 + MCP2515 module communicate with each other through the Controller Area Network (CAN) bus in the car's OBD-II (On-Board Diagnostics 2) connector.
The ELM327 is a multi-protocol adapter that allows a pc or other device to communicate with a car's OBD-II engine management system through the Controller Area Network (CAN) bus. The ELM327 OBD2 interface is a great tool for any car owner, and it will help you keep on top of any issues that may arise with your vehicle.