{"id":26178974,"url":"https://github.com/askrejans/speeduino-serial-sim","last_synced_at":"2026-03-03T23:00:27.177Z","repository":{"id":215994753,"uuid":"740206450","full_name":"askrejans/speeduino-serial-sim","owner":"askrejans","description":"Simple Speeduino ECU serial interface simulator for Arduino. Currently supports basic real time data simulation.","archived":false,"fork":false,"pushed_at":"2026-03-03T13:04:52.000Z","size":69,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-03T17:09:02.566Z","etag":null,"topics":["arduino","ecu","serial-data","simulator","speeduino"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/askrejans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-07T20:33:01.000Z","updated_at":"2026-03-03T13:04:56.000Z","dependencies_parsed_at":"2024-01-14T22:24:15.192Z","dependency_job_id":"53a3ed41-9a77-4e77-b7f3-3d5642cbc2e0","html_url":"https://github.com/askrejans/speeduino-serial-sim","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"c90acac42ad7271db64057885e6f915e51a269c3"},"previous_names":["askrejans/speeduino-serial-sim"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/askrejans/speeduino-serial-sim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askrejans%2Fspeeduino-serial-sim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askrejans%2Fspeeduino-serial-sim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askrejans%2Fspeeduino-serial-sim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askrejans%2Fspeeduino-serial-sim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/askrejans","download_url":"https://codeload.github.com/askrejans/speeduino-serial-sim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askrejans%2Fspeeduino-serial-sim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30064763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","ecu","serial-data","simulator","speeduino"],"created_at":"2025-03-11T21:48:15.900Z","updated_at":"2026-03-03T23:00:27.171Z","avatar_url":"https://github.com/askrejans.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Speeduino Serial Simulator - v2.1.0\n\nA cross-platform Speeduino ECU serial interface simulator with realistic I4 engine simulation, supporting Arduino AVR, ESP32, and ESP8266. Tested more on ESP32 for now.\n\n## 🚀 Features\n\n### Core Features\n- **Realistic Engine Simulation**: Physics-based I4 2.0L engine model with correlated parameters\n- **Speeduino Protocol Compatible**: Implements 5 most common commands (A, Q, V, S, n)\n- **Cross-Platform**: Arduino AVR, ESP32, ESP8266\n\n### Platform-Specific Features\n\n#### Arduino AVR (Minimal Mode)\n- Basic engine simulation\n- Serial protocol support\n- Optimized for 2KB RAM / 32KB flash\n- Status LED feedback\n\n#### ESP32/ESP8266 (Full Features)\n- Advanced realistic engine physics\n- WiFi connectivity\n- Web-based dashboard\n- Real-time parameter monitoring\n- Remote control via REST API\n- mDNS support (speeduino-sim.local)\n- WiFi Serial Socket (ESP32-S3 default): TCP/IP serial communication on port 5000\n\n### WiFi Serial Socket (NEW in v2.1.0)\n\nThe feature enables serial communication over TCP/IP instead of hardware UART. This allows remote applications to connect over the network.\n\n**Enabling WiFi Serial:**\n- Add `-D ENABLE_WIFI_SERIAL` to your build flags in [platformio.ini](platformio.ini#L119)\n- Enabled by default on ESP32-S3\n- Available on all ESP32 and ESP8266 builds\n\n**Usage:**\n1. Build and flash with WiFi serial enabled\n2. Connect to WiFi AP \"SpeeduinoSim\" (password: `speeduino123`)\n3. Note the device IP address (shown in serial monitor or web dashboard)\n4. Configure your serial application to connect to `\u003cIP\u003e:5000` via TCP/IP\n   - **TunerStudio**: Use TCP/IP connection type instead of COM port\n   - **Custom tools**: Connect TCP socket to port 5000\n\n**How it works:**\n- Hardware UART (Serial) is used for debug logging/monitoring\n- TCP socket on port 5000 handles Speeduino protocol commands\n- Web interface remains on port 80 (HTTP)\n- Simultaneous web dashboard + remote serial access\n\n## 📋 Requirements\n\n### Hardware\n- **Arduino**: Uno, Mega, Nano (ATmega328P/2560)\n- **ESP32**: DevKit, WROOM, WROVER, S2, S3\n- **ESP8266**: NodeMCU, D1 Mini\n\n### Software\n- PlatformIO Core or PlatformIO IDE\n\n## 🔧 Installation\n\n### Quick Start with PlatformIO\n\n```bash\n# Clone repository\ngit clone https://github.com/askrejans/speeduino-serial-sim.git\ncd speeduino-serial-sim\n\n# Build for Arduino Uno\npio run -e uno\n\n# Build for ESP32\npio run -e esp32\n\n# Upload to device\npio run -e uno -t upload\n\n# Monitor serial output\npio device monitor\n```\n\n### Arduino IDE (Legacy Support)\n\nThe project is now PlatformIO-based. For Arduino IDE users:\n1. Copy all files from `include/` and `src/` into a single sketch folder\n2. Rename `main.cpp` to match your sketch name\n3. Note: Web interface and advanced features require PlatformIO\n\n## 📡 Usage\n\n### Serial Communication\n\nConnect to device via serial port at **115200 baud**:\n\n```bash\n# Linux/Mac\nscreen /dev/ttyUSB0 115200\n\n# Windows - Use PuTTY or Arduino Serial Monitor\n```\n\n#### Supported Commands\n\n| Command | Description | Response Size |\n|---------|-------------|---------------|\n| `A` | Get real-time engine data | 79 bytes |\n| `Q` | ECU status | 4 bytes |\n| `V` | Firmware version | Variable |\n| `S` | ECU signature | 20 bytes |\n| `n` | Configuration page sizes | 7 bytes |\n\n### Web Interface (ESP32/ESP8266 Only)\n\n**Default Access (First Boot):**\n1. **Power on device** - Creates WiFi AP \"SpeeduinoSim\"\n2. **Connect** with password: `speeduino123`\n3. **Open browser** to `http://192.168.4.1` (port 80)\n4. **Monitor** real-time engine parameters\n5. **Control** simulation mode (Idle, Acceleration, WOT, etc.)\n\n**WiFi Configuration:**\nThe device supports two WiFi modes with automatic fallback:\n- **Access Point (AP) Mode**: Default mode, creates its own network at 192.168.4.1\n- **Station (STA) Mode**: Connects to your existing WiFi network\n\nTo configure WiFi:\n1. Access the web interface at `http://192.168.4.1` in AP mode\n2. Click \"WiFi Settings\" button\n3. Scan for available networks or manually enter SSID\n4. Enter password and enable \"Station Mode\"\n5. Restart the device\n6. If connection fails, device automatically falls back to AP mode\n7. Find new IP address from serial monitor or connect to AP and check settings\n\n**Ports:**\n- **80**: HTTP web dashboard\n- **5000**: Speeduino serial protocol (if ENABLE_WIFI_SERIAL is defined)\n\n#### REST API Endpoints\n\n```bash\n# Get real-time data (JSON)\ncurl http://192.168.4.1/api/realtime\n\n# Get status\ncurl http://192.168.4.1/api/status\n\n# Set engine mode\ncurl -X POST http://192.168.4.1/api/setmode -d \"mode=wot\"\n\n# Available modes: idle, light_load, acceleration, high_rpm, wot\n\n# WiFi configuration endpoints\ncurl http://192.168.4.1/api/wifi/scan\ncurl -X POST http://192.168.4.1/api/wifi/save -d \"ssid=MyNetwork\u0026password=mypass\u0026enable=true\"\ncurl -X POST http://192.168.4.1/api/wifi/reset\ncurl -X POST http://192.168.4.1/api/restart\n```\n\n### Testing WiFi Serial (TCP Socket on Port 5000)\n\nWhen `ENABLE_WIFI_SERIAL` is defined, you can test Speeduino protocol commands over TCP:\n\n```bash\n# Using netcat (nc)\nnc 192.168.4.1 5000\n# Then type commands: A, V, Q, S, n\n\n# Using telnet\ntelnet 192.168.4.1 5000\n# Then type commands\n\n# Test with echo and nc (send 'A' command)\necho -n \"A\" | nc 192.168.4.1 5000 | xxd\n\n# Test version command\necho -n \"V\" | nc 192.168.4.1 5000\n\n# Continuous real-time parsed data (send 'A' every 0.1 second)\nwhile true; do   ts=$(date '+%Y-%m-%d %H:%M:%S.%3N');    exec 3\u003c\u003e/dev/tcp/192.168.4.1/5000;   printf \"A\" \u003e\u00263;    frame=$(dd bs=79 count=1 \u003c\u00263 2\u003e/dev/null | xxd -p -c 79);   exec 3\u003e\u0026-;    if [ ${#frame} -eq 158 ]; then     rpm=$(( 0x${frame:32:2}${frame:30:2} ));     echo \"$ts RPM=$rpm\";   else     echo \"$ts BAD_FRAME\";   fi;    sleep 0.1; done\n```\n\n## 🧪 Testing\n\n### Unit Tests\n\nRun comprehensive embedded tests (40+ test cases):\n\n```bash\n# Run all tests on ESP32-S3 (includes WiFi/TCP tests)\nplatformio test -e esp32s3 --upload-port /dev/cu.usbmodem11101 --test-port /dev/cu.usbmodem11101\n\n# Run on ESP32-S2 (WiFi tests, no serial socket)\nplatformio test -e esp32s2\n\n# Run on Arduino Uno (basic tests only)\nplatformio test -e uno\n\n# Verbose output for debugging\nplatformio test -e esp32s3 -vvv\n```\n\nSee [test/README.md](test/README.md) for detailed test documentation.\n\n## 📊 Engine Simulation\n\n### Physical Model\n\nSimulates a **2.0L Inline-4 engine** with:\n- **RPM Range**: 0-7000 RPM (redline at 6800)\n- **Thermal Model**: Realistic coolant/intake temps\n- **Volumetric Efficiency**: Peak at 4000-5000 RPM\n- **Fuel Delivery**: Calculated from MAP, RPM, VE, temps\n- **Ignition Timing**: 15-35° BTDC based on RPM/load\n- **AFR Control**: Stoich (14.7:1) cruise, rich (12.5:1) WOT\n\n### Operating Modes\n\nSTARTUP → WARMUP → IDLE ⇄ LIGHT_LOAD ⇄ ACCELERATION → HIGH_RPM → DECELERATION → IDLE\n\n## 🔧 Configuration\n\nEdit `include/Config.h`:\n\n```cpp\n#define SERIAL_BAUD_RATE 115200\n#define ENGINE_DISPLACEMENT 2000  // cc\n#define RPM_MAX 7000\n#define WIFI_SSID \"SpeeduinoSim\"\n#define WIFI_PASSWORD \"speeduino123\"\n```\n\n## 📈 Performance\n\n| Platform | Flash | RAM | Update Rate | Response Time |\n|----------|-------|-----|-------------|---------------|\n| Arduino Uno | ~18 KB | ~1.2 KB | 20 Hz | \u003c5 ms |\n| ESP32 | ~45 KB | ~15 KB | 20 Hz | \u003c2 ms |\n| ESP8266 | ~40 KB | ~12 KB | 20 Hz | \u003c3 ms |\n\n## 🐛 Troubleshooting\n\n**Serial Issues**: Check baud rate (115200), verify port  \n**WiFi Issues**: Connect to AP \"SpeeduinoSim\", use 192.168.4.1  \n**Compilation**: Use PlatformIO for best results\n\n## 📝 Architecture\n\n```\nmain.cpp → EngineSimulator (Physics) → SpeeduinoProtocol (Serial)\n                ↓                              ↓\n        WebInterface (ESP)            Platform Adapters\n```\n\nKey components:\n- **EngineSimulator**: Realistic I4 physics\n- **SpeeduinoProtocol**: Serial command handler  \n- **WebInterface**: HTTP server (ESP only)\n- **Platform Adapters**: Hardware abstraction\n\n## Use Cases\n\n- Testing [speeduino-to-mqtt](https://github.com/askrejans/speeduino-to-mqtt)\n- Development with [golf86-info](https://github.com/askrejans/golf86-info) LED displays\n- TunerStudio integration testing\n- ECU logging software development\n- Educational demonstrations\n\n## 📜 License\n\nMIT License - See [LICENSE](LICENSE)\n\n## 📧 Contact\n\n- **GitHub**: [@askrejans](https://github.com/askrejans)\n\n---\n\n**Version**: 2.1.0\n**Major Changes**:\n- **v2.1.0**: WiFi serial socket support (TCP/IP alternative to hardware UART), WiFi station mode added\n- **v2.0.0**: Complete rewrite with realistic physics, multi-platform support, web interface, comprehensive tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faskrejans%2Fspeeduino-serial-sim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faskrejans%2Fspeeduino-serial-sim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faskrejans%2Fspeeduino-serial-sim/lists"}