From 32df3b33758ed0a627b045b91a88f9db8f15caa1 Mon Sep 17 00:00:00 2001 From: Pascal Brunot Date: Sun, 4 Feb 2024 12:12:41 +0100 Subject: [PATCH] added link to EasyEDA project --- README.md | 66 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 91273199..7ec064c6 100644 --- a/README.md +++ b/README.md @@ -9,44 +9,46 @@ Test suite : [![Test suite](https://github.com/PBrunot/rfid-arduino-copy/actions * Together with the [backend project](https://github.com/fablab-bergamo/rfid-backend) which can run on a Raspberry Pi Zero, it manages user authentication, track machine usage / maintenance needs. -* Assembled version: +* Assembled version: ![image](https://github.com/fablab-bergamo/rfid-arduino/assets/6236243/9898c6a5-cc16-4479-851a-b326ad31a4d6) * It uses MQTT to talk to the backend. Machine control is achieved through an external relay. +* View hardware project (WORK IN PROGRESS) on EASYEDA : [Electrical scheme, BOM, PCB](https://oshwlab.com/pascal.brunot/rfid-arduino-fablab-bg) + ## Hardware requirements -- ESP32, ESP32-S2 or ESP32-S3 chips -- WiFi connection to the backend -- RFID reader (using mfrc522 compatible chip) -- LCD driver (using Hitachi HD44780 compatible chip) -- 3.3V Relay (or [Shelly](https://www.shellyitalia.com/shelly-plus-1-mini-gen3/) MQTT device) -- 3.3V Buzzer -- A LED or NeoPixel -- RFID tags or cards for user authentication +* ESP32, ESP32-S2 or ESP32-S3 chips +* WiFi connection to the backend +* RFID reader (using mfrc522 compatible chip) +* LCD driver (using Hitachi HD44780 compatible chip) +* 3.3V Relay (or [Shelly](https://www.shellyitalia.com/shelly-plus-1-mini-gen3/) MQTT device) +* 3.3V Buzzer +* A LED or NeoPixel +* RFID tags or cards for user authentication ### Other requirements -- MQTT Broker on WiFi network. Board can also work in offline mode with whitelisted RFID tags. +* MQTT Broker on WiFi network. Board can also work in offline mode with whitelisted RFID tags. > Tested with Mosquitto. See the backend side project in [Github rfid-backend](https://github.com/fablab-bergamo/rfid-backend) ## Build environment -- Language: C++20 with ArduinoFramework for ESP32 -- IDE: VSCode + Platform.io extension as a minimun -- To build, rename secrets.hpp.example to secrets.hpp. +* Language: C++20 with ArduinoFramework for ESP32 +* IDE: VSCode + Platform.io extension as a minimun +* To build, rename secrets.hpp.example to secrets.hpp. > Platform IO can be used from command-line without VSCode pio run > CMakeList.txt is generated from platform.io, do not use other build tools directly (ESP, cmake...) -- To use hostname for MQTT server, mDNS is used by the Arduino stack built over ESP-IDF 4.4. When Arduino core for ESP will move to ESP-IDF 5.0+ an additional dependency to mDNS will be needed as mDNS is now an independent component. +* To use hostname for MQTT server, mDNS is used by the Arduino stack built over ESP-IDF 4.4. When Arduino core for ESP will move to ESP-IDF 5.0+ an additional dependency to mDNS will be needed as mDNS is now an independent component. ## TEST Suite -- A set a test scripts based on Platformio+Unity is included in the project. -- There are two ways to run the tests: +* A set a test scripts based on Platformio+Unity is included in the project. +* There are two ways to run the tests: 1. Use real hardware connected over USB with Platform.io command @@ -58,24 +60,24 @@ pio test --environment esp32-s3 ## DEMO - view it in the browser -- Download latest esp32-wokwi.zip file from Github Actions / platformio.yml / Artifacts -- Extract esp32-wokwi.bin file from artifact ZIP -- Open WOKWI Circuit [link](https://wokwi.com/projects/363448917434192897) -- In code editor, press F1 > Upload firmware ... and pick the esp32-wokwi.bin file +* Download latest esp32-wokwi.zip file from Github Actions / platformio.yml / Artifacts +* Extract esp32-wokwi.bin file from artifact ZIP +* Open WOKWI Circuit [link](https://wokwi.com/projects/363448917434192897) +* In code editor, press F1 > Upload firmware ... and pick the esp32-wokwi.bin file ![image](https://github.com/fablab-bergamo/rfid-arduino/assets/6236243/5c41092e-f8bf-451a-95ec-8dc6d7e07824) -- When the preprocessor constant WOKWI_SIMULATION is set to true: - - RFID chip is replaced with a mockup simulating random RFID tags from whitelist from time to time (MockRFIDWrapper class). - - A simple MQTT broker (MockMQTTBroker class) is run in a separate thread on esp32s2 +* When the preprocessor constant WOKWI_SIMULATION is set to true: + * RFID chip is replaced with a mockup simulating random RFID tags from whitelist from time to time (MockRFIDWrapper class). + * A simple MQTT broker (MockMQTTBroker class) is run in a separate thread on esp32s2 ## Configuration steps (/conf folder) -- See pins.hpp to set the GPIO pins for LCD parallel interface, relay, buzzer and RFID reader SPI interface. -- See conf.hpp to configure LCD dimensions, timeouts, debug logs and some behaviours (e.g. time before to power off the machine) -- See secrets.hpp to configure network SSID/Password credentials, MQTT credentials and whitelisted RFID tags +* See pins.hpp to set the GPIO pins for LCD parallel interface, relay, buzzer and RFID reader SPI interface. +* See conf.hpp to configure LCD dimensions, timeouts, debug logs and some behaviours (e.g. time before to power off the machine) +* See secrets.hpp to configure network SSID/Password credentials, MQTT credentials and whitelisted RFID tags - - A configuration portal based on WiFiManager allows to configured WiFi credentials, MQTT Broker address and Shelly topic (facultative). This makes editing conf.hpp required only for MQTT Broker credentials settings. + * A configuration portal based on WiFiManager allows to configured WiFi credentials, MQTT Broker address and Shelly topic (facultative). This makes editing conf.hpp required only for MQTT Broker credentials settings. > To add a white-listed RFID card, edit the tuples list whitelist. These RFID tags will be always authorized, even without server connection. @@ -105,17 +107,17 @@ namespace conf::default_config This is a facultative but very helpful setup to shorten the development workflow. -- Install ESP-IDF extension, Wokwi extension with community evaluation license +* Install ESP-IDF extension, Wokwi extension with community evaluation license > Make sure ESP-IDF platform is esp32s2 (used by wokwi Platformio environment) -- Build PlatformIO wokwi project, and start simulation with command Wokwi: Start Simulator, you shall see the program running: +* Build PlatformIO wokwi project, and start simulation with command Wokwi: Start Simulator, you shall see the program running: ![image](https://github.com/fablab-bergamo/rfid-arduino/assets/6236243/dfdf33e3-74ac-4246-9c92-4631e0009034) > See files wokwi.toml and diagram.json -- To configure GDB connection to the Wokwi simulator, edit .vscode\launch.json and add the following fragment inside "configurations" array +* To configure GDB connection to the Wokwi simulator, edit .vscode\launch.json and add the following fragment inside "configurations" array ```json { @@ -130,7 +132,7 @@ This is a facultative but very helpful setup to shorten the development workflow } ``` -- To test debugging, first start Wokwi with Wokwi: Start Simulator and wait for debugger -- You can then run the application, setup breakpoints, inspect variables from the Wokwi debugger: +* To test debugging, first start Wokwi with Wokwi: Start Simulator and wait for debugger +* You can then run the application, setup breakpoints, inspect variables from the Wokwi debugger: ![image](https://github.com/fablab-bergamo/rfid-arduino/assets/6236243/55f926b5-eec8-49d9-b217-628e07f7e3b8)