Add instruction to install with arduino-cli

This commit is contained in:
Léo Le Sommer 2026-01-29 20:20:03 +01:00
parent f9f509c619
commit a8a2c60a78

View file

@ -1,7 +1,9 @@
# The Bib O'Tron project # The Bib O'Tron project
A proof of concept for replacing the raspberry pi that is managing the bib button by an ESP32 microcontroller. A proof of concept for replacing the raspberry pi that is managing the bib button by an ESP32 microcontroller.
## Features ## Features
- Read the status of the bib button using a digital input - Read the status of the bib button using a digital input
- Display the state of the bib button using a trafic lights - Display the state of the bib button using a trafic lights
- Implement a HTTP server to serve : - Implement a HTTP server to serve :
@ -16,28 +18,35 @@ A proof of concept for replacing the raspberry pi that is managing the bib butto
- Can be powered by USB-C, using a 5V power supply connected to screw terminals or though the ethernet cable if the optional POE module is installed. - Can be powered by USB-C, using a 5V power supply connected to screw terminals or though the ethernet cable if the optional POE module is installed.
## Hardware ## Hardware
The microcontroller board used is a [Waveshare ESP32-S3-ETH](https://www.waveshare.com/wiki/ESP32-S3-ETH). The microcontroller board used is a [Waveshare ESP32-S3-ETH](https://www.waveshare.com/wiki/ESP32-S3-ETH).
The RGB LED is a WS2812 The RGB LED is a WS2812
## /!\ Warning /!\ ## /!\ Warning /!\
This board, doesn't have any protection between the USB 5V line and the POE 5V line. you MUST remove the POE module and/or disconnect the ethernet cable before plugging-in a USB cable, or else the proverbial magic smoke will be released!!! This board, doesn't have any protection between the USB 5V line and the POE 5V line. you MUST remove the POE module and/or disconnect the ethernet cable before plugging-in a USB cable, or else the proverbial magic smoke will be released!!!
(potentially on your computer side) (potentially on your computer side)
## Pictures ## Pictures
check [the pictures](doc/pictures.md) in the doc directory check [the pictures](doc/pictures.md) in the doc directory
## License ## License
[Creative Commons Zero v1.0 Universal](https://creativecommons.org/public-domain/cc0/)
[GNU AFFERO GENERAL PUBLIC LICENSE Version 3](https://www.gnu.org/licenses/agpl-3.0.en.html)
## User guide ## User guide
### Changing the bibutton state physically from Le Bib ### Changing the bibutton state physically from Le Bib
Juste operate the switch that is next to the traffic lighs. Juste operate the switch that is next to the traffic lighs.
**ToDo :** add a picture of the switch **ToDo :** add a picture of the switch
### Changing the bibutton state remotely ### Changing the bibutton state remotely
In case the person who last closed Le Bib has forgotten to switch the bibutton state to the closed position, or if the physical switch is broken, it is possible to call a remote API to force the button state. In case the person who last closed Le Bib has forgotten to switch the bibutton state to the closed position, or if the physical switch is broken, it is possible to call a remote API to force the button state.
This can be done from the command line with curl as below : This can be done from the command line with curl as below :
- To force the bibutton to the closed state : - To force the bibutton to the closed state :
``` ```
curl -i -u "${bibutton_user}:${bibutton_password}" --request POST --data "{forceState:0}" --header "Content-Type: application/json" ${TARGET} curl -i -u "${bibutton_user}:${bibutton_password}" --request POST --data "{forceState:0}" --header "Content-Type: application/json" ${TARGET}
@ -53,13 +62,16 @@ While the bibutton state is being remotely forced to a diffent state than the ph
As soon as the the physical switch is changed to the same state as the remotely forced state, or the state is remotly forced back to the same state as the physical switch, the "remotly forced" mode will be canceled, and only the red or green light will be on, according the physical switch state. As soon as the the physical switch is changed to the same state as the remotely forced state, or the state is remotly forced back to the same state as the physical switch, the "remotly forced" mode will be canceled, and only the red or green light will be on, according the physical switch state.
### Traffic lights ### Traffic lights
Depending on the bibutton state, the traffic lights will be illuminated as follow : Depending on the bibutton state, the traffic lights will be illuminated as follow :
- Red color (upper light) when the bibutton is closed, - Red color (upper light) when the bibutton is closed,
- Green color (bottom light) when button is opened, Solid ) - Green color (bottom light) when button is opened, Solid )
- Orange color (middle light) when the network is down (the last ping to the reverse proxy failed) - Orange color (middle light) when the network is down (the last ping to the reverse proxy failed)
- Both Green and Red color at the same time when the bibutton state has been remotely forced to a diffent state than the physical switch - Both Green and Red color at the same time when the bibutton state has been remotely forced to a diffent state than the physical switch
### LED light strip ### LED light strip
This is work in progress. This is work in progress.
The light strip currently displays the count of requests received to read the bibutton state since the last boot of the microntroller, as a 64 bits binary number. The light strip currently displays the count of requests received to read the bibutton state since the last boot of the microntroller, as a 64 bits binary number.
@ -70,7 +82,9 @@ But note that the request count is frequently displayed to the LED strip, which
The LED strip behavior is not functionally usefull for the Bibutton feature. You can hack it any way you want. The LED strip behavior is not functionally usefull for the Bibutton feature. You can hack it any way you want.
## Developer guide ## Developer guide
The project is developed using the Arduino IDE and the following libraries : The project is developed using the Arduino IDE and the following libraries :
- FastLED, to drive the addressable RGB LEDs - FastLED, to drive the addressable RGB LEDs
- EthernetESP32, to drive the SPI ethernet chip (W5500) of the ESP32-S3-ETH - EthernetESP32, to drive the SPI ethernet chip (W5500) of the ESP32-S3-ETH
- ESPping, to periodically check network connectivity - ESPping, to periodically check network connectivity
@ -79,18 +93,48 @@ The project is developed using the Arduino IDE and the following libraries :
Additionally to these libraries, the esp32 boards package must be installed in Arduino IDE. Additionally to these libraries, the esp32 boards package must be installed in Arduino IDE.
Then in the `Tools` menu, select : Then in the `Tools` menu, select :
- `Board` > `esp32` > `ESP32-S3-Box` - `Board` > `esp32` > `ESP32-S3-Box`
- `Partition scheme` > `16 MB Flash` - `Partition scheme` > `16 MB Flash`
- `USB mode" > `Hardware CDC and JTAG` - `USB mode" > `Hardware CDC and JTAG`
- `Programmer` > `esptools` - `Programmer` > `esptools`
- `Port` > the tty port of the board (if programming through USB) - `Port` > the tty port of the board (if programming through USB)
### Alternative: Compilation via Arduino CLI (Linux/Mac)
If you prefer the command line, you can use `arduino-cli`.
1. **Install arduino-cli**:
- **Mac**: `brew install arduino-cli`
- **Linux**: Follow the [official installation guide](https://arduino.github.io/arduino-cli/latest/installation/).
2. **Setup the ESP32 environment**:
```bash
arduino-cli config init
arduino-cli config add board_manager.additional_urls https://espressif.github.io/arduino-esp32/package_esp32_index.json
arduino-cli core update-index
arduino-cli core install esp32:esp32
```
3. **Install the libraries**:
```bash
arduino-cli lib install "FastLED" "EthernetESP32" "ESPping" "ElegantOTA" "ArduinoJson"
```
4. **Compile the project**:
```bash
arduino-cli compile --fqbn esp32:esp32:esp32s3box --build-property "build.partitions=default_16MB" --output-dir ./build .
```
Before building the souce code, you need to add in your working copy the secret.h file that contains the sensitive information that we not want to publish in the this git repository Before building the souce code, you need to add in your working copy the secret.h file that contains the sensitive information that we not want to publish in the this git repository
**ToDo :** The secret.h needs to be stored in the password manager used by Le Bib **ToDo :** The secret.h needs to be stored in the password manager used by Le Bib
If your are building the source code for a different site than Le Bib, you can create your own secret.h based on secret.h.example If your are building the source code for a different site than Le Bib, you can create your own secret.h based on secret.h.example
To update the firmware through Web OTA, first create the binary using the menu `Sketch` > `Export compiled Binary`. To update the firmware through Web OTA, first create the binary using the menu `Sketch` > `Export compiled Binary`.
Then : Then :
- In your web browser, go to http://bibotron.local/update (or use the local IP address if the MDNS resolution of bibotron.local is not working : 10.13.12.40) - In your web browser, go to http://bibotron.local/update (or use the local IP address if the MDNS resolution of bibotron.local is not working : 10.13.12.40)
- **ToDo :** The user and password to use need to be stored in the password manager used by Le Bib - **ToDo :** The user and password to use need to be stored in the password manager used by Le Bib
- In `OTA Mode` select firmware - In `OTA Mode` select firmware