Simulate real CAN Bus protocol in C for automotive testing – complete with 8 ECUs, React dashboard, fuzzing, and anomaly detection.
Perfect for devs building embedded systems without expensive hardware.
- About / Overview
- Key Features
- Tech Stack
- Getting Started
- Usage
- Project Structure
- Contributing
- License
Hey there! CANBusSimulator is your go-to tool for testing automotive systems without needing real CAN hardware. Written in efficient C, it faithfully recreates the CAN Bus protocol – arbitration, error handling, bit stuffing, and all. Imagine spinning up 8 virtual ECUs (Engine, ABS, Airbag, etc.) that talk over a simulated bus, complete with fuzzing attacks and anomaly detection.
This solves a huge pain point for embedded devs, automotive engineers, and HIL (Hardware-in-the-Loop) testers. No more waiting for physical buses or pricey tools – just compile, run, and test your algorithms locally. What sets it apart? A slick React dashboard for real-time visualization, candump-compatible logs, and security layers with 5 attack types. It's battle-tested for fuzzing and detection, making it ideal for research or production validation.
Whether you're prototyping ECUs, training ML models on CAN traffic, or hunting bus-off conditions, this sim has you covered. Created April 17, 2026 – fresh and ready to roll!
✨ 8 Simulated ECUs — Engine, ABS, Airbag, Climate, Steering, Cabin, Tires, Dashboard with realistic message IDs and filters.
✨ Full CAN Protocol Stack — Arbitration, broadcast, bit stuffing, encode/decode via CANFrame struct.
✨ Error Handling & States — Error counters, NORMAL → ERROR-ACTIVE → BUS-OFF transitions per node.
✨ Security Testing — CANFuzzer with 5 attack types (fuzzing, replay, etc.) + CANDetector with 4 anomaly rules, logs to logs/anomali.log.
✨ High-Perf Bus Layer — 32-slot ring buffer for low-latency simulation.
✨ React Dashboard — Live visualization via dashboard/public/can_dashboard.json.
✨ CAN Tools Suite — Logger (candump format to logs/can_traffic.log), Parser (filter/stats), JSON exporter.
✨ Turkish Support — Bilingual docs for global automotive teams.
- GCC or any C compiler (tested with GCC 12+)
- Node.js 18+ (for React dashboard)
- make (for building)
- Linux/macOS recommended; Windows via WSL
-
Clone the repo:
git clone https://github.com/semyhist/CANBusSimulator.git cd CANBusSimulator -
Build the C simulator:
make
-
Start the React dashboard (in a new terminal):
cd dashboard npm install npm start
💡 Tip: Run
make cleanto rebuild from scratch.
Launch 8 ECUs on the virtual bus:
./can_simulator -n 8 -t 60 # Run 8 nodes for 60 secondsGenerates logs/can_traffic.log in candump format.
Test security layers:
./can_simulator -fuzz replay -d detect -o logs/anomali.log📊 View in Dashboard: Dashboard auto-loads
can_dashboard.jsonfor live ECU stats, arbitration wins, and anomaly alerts.
./can_parser logs/can_traffic.log --filter=0x100 --statsCANBusSimulator/
├── src/
│ ├── can_node.c # ECU logic, filters, error states
│ ├── can_bus.c # Ring buffer, arbitration
│ ├── can_frame.c # Encode/decode, bit stuffing
│ ├── can_fuzzer.c # 5 attack types
│ └── can_detector.c # 4 anomaly rules
├── tools/
│ ├── can_logger.c
│ ├── can_parser.c
│ └── can_json.c
├── dashboard/ # React app
│ └── public/can_dashboard.json
├── logs/
│ ├── can_traffic.log
│ └── anomali.log
├── Makefile
└── README.md
Love the project? Help make it even better!
- Fork the repo and create your branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request – mention any related issues.
🙌 Questions? Open an issue at semyhist/CANBusSimulator/issues.
Distributed under the MIT License. See LICENSE for more info.
Created by Semih Aydın