diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..757582a --- /dev/null +++ b/README.en.md @@ -0,0 +1,96 @@ +
+ +

+ Lire cette page en français + English, page shown +

+ +Switch Track, the points module + +
+ +A motorised switch for MicroCoaster layouts. An electric actuator moves the movable section of track to the left or to the right, two LEDs show the position, and the order arrives from the controller over WebSocket. + +Like the other modules, it is configured on first boot through a captive portal, then joins the server. + +**Version 2.0.0** + +01 How it works + +The module decides nothing. It receives a position order, drives the actuator, checks that the position is reached, and reports back. It is the controller that knows whether the track downstream is clear and whether the change is allowed. + +Order received: the server sends switch_left or switch_right. Actuator driven: the direction is handed to the DRV8871, which flips the polarity. Position reached: the matching LED lights up and the reply goes back to the server. With no order: the actuator does not move, the position is held. + +The current position is reported on every connection and on every change, so the server never drifts out of step with what the layout is actually doing. + +02 Hardware + +Actuator DRV8871: GPIO 21 for IN1, actuator clockwise; GPIO 22 for IN2, actuator anticlockwise. Position signalling: GPIO 2 for the left LED, diverging route live; GPIO 4 for the right LED, straight route live. + +The DRV8871 is an H-bridge: it pulls `IN1` or `IN2` high to reverse the polarity across the actuator, and both low to stop it. Its thermal protection and current limiting keep the actuator from being damaged if the track is jammed. + +03 Protocol + +The module authenticates on connection, then talks JSON. + +**Identification, module to server** + +```json +{ + "type": "module_identify", + "moduleId": "MC-0001-ST", + "password": "", + "moduleType": "switch-track", + "uptime": 12345, + "position": "left" +} +``` + +**Command, server to module** + +```json +{ + "type": "command", + "data": { "command": "switch_left" } +} +``` + +switch_left: throws the track to the left, also accepts left and switch_to_A. switch_right: throws the track to the right, also accepts right and switch_to_B. get_position: returns the current position without driving the actuator. + +The module answers every command and sends periodic telemetry with its position and its uptime. + +`SERVER_USE_SSL` chooses between `ws` and `wss`. On a local development network, `ws` is enough. In production, or as soon as the server is reachable beyond the home network, switch to `wss`: without encryption, the module's authentication secret travels in the clear. + +04 Bringing it up + +First copy [`include/env.h.example`](include/env.h.example) to `include/env.h` and fill it in: fallback portal credentials, the module identity and its secret. That file is not in git, and without it the firmware does not compile. + +Requires [PlatformIO](https://platformio.org/) inside Visual Studio Code. + +```bash +pio run # build +pio run -t upload # upload the firmware +pio run -t uploadfs # upload the portal to LittleFS +pio device monitor # serial console, 115200 baud +``` + +1. Power the module. It creates a WiFi access point. +2. Connect to it and open `http://192.168.4.1`. +3. Enter the target network. +4. The module reboots, joins the network and announces itself to the server. + +The WiFi credentials stay in the module's memory, never in the repository. + +05 Ecosystem + +```ini +links2004/WebSockets ; link to the controller +bblanchon/ArduinoJson ; the messages exchanged +ayresnet/AyresWiFiManager ; captive portal and reconnection +``` + +Embedded filesystem: **LittleFS**, which holds the portal pages. The common base for every module is the [WiFi Manager](https://github.com/Microcoaster/MicroCoaster_WifiManager), the [LED bench](https://github.com/Microcoaster/ESP-32-led) is its test version without the mechanics, and the driving is done from the [WebApp](https://github.com/Microcoaster/MicroCoasterWebApp). + +--- + +MicroCoaster · Author: Cybertrist diff --git a/README.md b/README.md index f085e7e..48d1837 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@
+

+ Français, page affichée + Read this page in English +

+ Switch Track, module d'aiguillage
diff --git a/docs/en/banniere.png b/docs/en/banniere.png new file mode 100644 index 0000000..c7d2c1e Binary files /dev/null and b/docs/en/banniere.png differ diff --git a/docs/en/schemas/brochage.png b/docs/en/schemas/brochage.png new file mode 100644 index 0000000..122dc9b Binary files /dev/null and b/docs/en/schemas/brochage.png differ diff --git a/docs/en/schemas/commandes.png b/docs/en/schemas/commandes.png new file mode 100644 index 0000000..0c6ff2a Binary files /dev/null and b/docs/en/schemas/commandes.png differ diff --git a/docs/en/schemas/principe.png b/docs/en/schemas/principe.png new file mode 100644 index 0000000..811d10e Binary files /dev/null and b/docs/en/schemas/principe.png differ diff --git a/docs/en/sections/s01.png b/docs/en/sections/s01.png new file mode 100644 index 0000000..c2249fd Binary files /dev/null and b/docs/en/sections/s01.png differ diff --git a/docs/en/sections/s02.png b/docs/en/sections/s02.png new file mode 100644 index 0000000..ef6cb08 Binary files /dev/null and b/docs/en/sections/s02.png differ diff --git a/docs/en/sections/s03.png b/docs/en/sections/s03.png new file mode 100644 index 0000000..9a1099c Binary files /dev/null and b/docs/en/sections/s03.png differ diff --git a/docs/en/sections/s04.png b/docs/en/sections/s04.png new file mode 100644 index 0000000..4376b69 Binary files /dev/null and b/docs/en/sections/s04.png differ diff --git a/docs/en/sections/s05.png b/docs/en/sections/s05.png new file mode 100644 index 0000000..23b4958 Binary files /dev/null and b/docs/en/sections/s05.png differ diff --git a/docs/langues/en-off.png b/docs/langues/en-off.png new file mode 100644 index 0000000..77ea9ec Binary files /dev/null and b/docs/langues/en-off.png differ diff --git a/docs/langues/en-on.png b/docs/langues/en-on.png new file mode 100644 index 0000000..c9dbf28 Binary files /dev/null and b/docs/langues/en-on.png differ diff --git a/docs/langues/fr-off.png b/docs/langues/fr-off.png new file mode 100644 index 0000000..41f4335 Binary files /dev/null and b/docs/langues/fr-off.png differ diff --git a/docs/langues/fr-on.png b/docs/langues/fr-on.png new file mode 100644 index 0000000..4e1cb47 Binary files /dev/null and b/docs/langues/fr-on.png differ