Skip to content

Windows Setup

Tanmay Patil edited this page Sep 15, 2026 · 2 revisions

Windows setup

Everything in this repo runs on Windows. Two tracks: the simulation needs only Python; the firmware needs Arduino IDE + the ESP32 core + real boards.

Track 1 — the simulation

Install Python. Grab the installer from python.org (3.11+; any recent one works). On the first installer screen tick "Add python.exe to PATH" — the one checkbox everyone forgets, and the reason python "isn't recognized" in cmd. Verify in a new terminal:

python --version

If that prints a version, you are done installing. The sim uses only the standard library — there is no pip install step.

Get the repo:

git clone https://github.com/tanm-sys/floorcan.git
cd floorcan\sim

(or download ZIP from GitHub → extract → open a terminal in floorcan\sim).

Run it:

python can_sim.py --serve

Open http://localhost:8765 in any browser. The schematic is the sim; click the buttons on either floor.

Headless mode (prints the console + candump-style trace, no browser):

python can_sim.py

Windows-specific notes:

  • If your browser says the connection was refused, the server did not start; scroll up in the terminal for the actual error.
  • Port 8765 in use? Edit the last line of server.py (main(port=8765) → any free port) and open that port instead.
  • Windows Firewall may ask about Python listening on localhost; allowing it is fine since it only serves 127.0.0.1.
  • Ctrl+C in the terminal stops the server.

Track 2 — the firmware on real boards

1. Arduino IDE. Install Arduino IDE 2.x from arduino.cc. In File → Preferences → Additional boards manager URLs add:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

then Tools → Board → Boards Manager → search esp32 → install esp32 by Espressif (3.x). The TWAI driver (driver/twai.h) ships inside that core — nothing else to install.

2. USB drivers. Most devkits use a CP2102 or CH340 USB-UART chip. Windows 11 usually installs CP2102 on its own; if the board shows up as an unknown device or not at all, grab the driver from Silicon Labs (CP210x) or the CH340 vendor package, then replug.

3. Find the COM port. Device Manager → Ports (COM & LPT): the board appears as "USB-SERIAL" / "Silicon Labs CP210x" with a COM number. Not sure which one it is? Unplug and replug — the one that disappears is yours.

4. Build settings. Open firmware\can_node.ino.

  • Board: ESP32 Dev Module (classic) or ESP32S3 Dev Module (S3)
  • Port: your COM port
  • Set NODE_ID/PEER_ID at the top of the sketch, upload to board 1; flip the two values, upload to board 2.

5. Watch it work. Tools → Serial Monitor, 115200 baud. Press a button on one board; the other board's serial prints RX id=0x... -> RELAYx = ... and its relay/LED changes.

Trouble uploading? Hold BOOT, tap EN/RESET, release BOOT, retry; that puts the chip in download mode. If the port vanishes entirely, try a different USB cable — it turns out a lot of them are charge-only, which is the #1 cause.

Common Windows gotchas, collected

Symptom Usual cause
'python' is not recognized PATH box unticked during install; reinstall or add it manually
Board not in ports list USB-UART driver missing, or a charge-only cable
A fatal error occurred: Failed to connect hold BOOT during upload
Sketch compiles, no CAN traffic almost always wiring; see troubleshooting.md
Serial monitor shows garbage wrong baud rate (115200)

Clone this wiki locally