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

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

+ +Audio module, an embedded ESP32 player + +
+ +An audio playback module for MicroCoaster layouts. An ESP32 reads tracks stored on a microSD card and sends them out over I2S to an amplifier. Playback is triggered remotely by the controller, over WebSocket, to line the sound up with what is happening on the layout: a train leaving, a pass through the station, the sound effect of an element. + +Like the other modules, it is configured on first boot through a captive portal, then joins the server. + +**Version 0.0.0** + +01 How it works + +The module knows nothing about the layout. It receives a track name, finds it on the card, plays it. It is the controller that knows at what point of the ride a sound should fire. + +Order received: the controller sends the name of the track to play. Track found: decoding, then I2S out to the DAC and on to the amplifier. Track missing: reported to the server, silence and a lost module look far too alike to be left ambiguous. + +The files go at the root of the microSD card. + +02 Hardware + +Two buses share the board. I2S carries the sound to the DAC, SPI goes and fetches the files from the microSD card. Mixing them onto the same pins is the number one cause of choppy playback. + +Audio out on the I2S bus: GPIO 26 BCLK bit clock, GPIO 25 LRC word select, GPIO 22 DIN samples to the DAC, GPIO 2 status LED playback running. Storage on the SPI bus: GPIO 13 SD CS card select, GPIO 23 MOSI data to the card, GPIO 19 MISO data from the card, GPIO 18 SCK bus clock. + +The I2S output stays digital all the way to the DAC, which avoids running a weak analogue signal alongside the power lines of the other modules. + +03 Protocol + +The module authenticates on connection, then talks JSON, like every other module on the layout. + +```json +{ + "type": "module_identify", + "moduleId": "MC-0001-AU", + "moduleType": "audio", + "uptime": 12345 +} +``` + +The controller sends the name of the track to play, and the module replies once playback has started, or reports that the file cannot be found. + +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 contents of data/ 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 WiFi 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 +esphome/ESP32-audioI2S ; decoding and audio output +ayresnet/AyresWiFiManager ; captive portal and reconnection +``` + +Module under development: playback and the WebSocket link work, what remains is remote volume control and queueing several tracks. + +Embedded filesystem: **LittleFS**, which holds the portal pages. The common base for every module is the [WiFi Manager](https://github.com/Microcoaster/MicroCoaster_WifiManager), 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 43c3343..211b630 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@
+

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

+ Module Audio, lecteur embarqué ESP32
diff --git a/docs/en/banniere.png b/docs/en/banniere.png new file mode 100644 index 0000000..5140a18 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..f1f5d29 Binary files /dev/null and b/docs/en/schemas/brochage.png differ diff --git a/docs/en/schemas/principe.png b/docs/en/schemas/principe.png new file mode 100644 index 0000000..c786175 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..be96a30 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..620156c 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..b80fc50 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..24cc0dd 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..2f3cbd6 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