AutoPID logger to csv #665
sbaliko
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
WiCAN Data Logger v3 — Auto-Discovery Edition
Overview
WiCAN Data Logger v3 is a standalone Python 3 script that automatically discovers a WiCAN Pro device on the local network, polls its AutoPID data endpoint at configurable intervals, and writes all received parameters to a timestamped CSV file.
The script uses zero external dependencies — only the Python standard library (
urllib,ssl,csv,json,socket,concurrent.futures).Primary use case: real-time logging of OBD-II diagnostic data from electric vehicles (tested with the Hyundai Ioniq Electric 2021 38 kWh) via the WiCAN Pro's HTTP API.
Features
Requirements
Installation
No installation required. Clone or download the script:
git clone https://github.com/sbaliko/wican-data-logger.git cd wican-data-loggerUsage
The script will auto-discover the WiCAN device and begin logging. Press
Ctrl+Cto stop — a summary of all captured fields and the output file path will be printed on exit.Configuration
All configuration is done via constants at the top of the script. No command-line arguments needed.
WICAN_IP""WICAN_HOSTNAMES["wican.local", "wican"]SCAN_SUBNETS[]WICAN_PORT80OUTPUT_FILEwican_log_YYYYMMDD_HHMMSS.csvINTERVAL1DISPLAY_MODE"all""all","compact", or"key".Network Auto-Discovery
When
WICAN_IPis left empty, the script runs a three-phase discovery:wican.localandwicanvia DNS, then verifies the/autopid_dataendpoint.192.168.8.102) in parallel with 10 threads.qto quit.Display Modes
allcompactkeyOutput Format
The output is a standard CSV file (
wican_log_YYYYMMDD_HHMMSS.csv):timestampin ISO 8601 formatExample columns for a Hyundai Ioniq Electric:
SOC_pct,HV_Voltage_V,HV_Current_A,HV_Power_kW,Cell_V_01–Cell_V_96,BMS_Batt_Temp_C, etc.Function Reference
get_local_ip()get_subnets_to_scan()check_wican(ip, timeout)/autopid_dataand verifies valid JSON response.scan_subnet(subnet, start, end)discover_wican()fetch_data()/autopid_datawith 5s timeout. Returns parsed JSON orNone.rewrite_csv(filepath, fieldnames, all_rows)format_value(key, value)print_all_data(...)print_compact_data(...)main()Troubleshooting
Device not found:
WiCAN_XXXXXX)WICAN_IPin the scriptEmpty or missing data:
http://<device-ip>to confirm data flowCSV has inconsistent columns:
License
Provided as-is for personal and educational use in automotive diagnostics research.
Credits
Script and documentation created with the assistance of Claude by Anthropic.
Beta Was this translation helpful? Give feedback.
All reactions