Build status : Test suite : Documentation :
Assembly | PCB |
---|---|
hardware
sub-folder, including Gerber files and instructions for manufacturing.hardware\README.md
folder for Gerber files and schematics.conf/secrets.hpp.example
to conf/secrets.hpp
.esp32-wokwi.bin
fileMQTT_SIMULATION
or RFID_SIMULATION
are set to true:
MockMrfc522
class).MockMQTTBroker
class) is run in a separate thread on esp32s2pio test --environment esp32-s3 --verbose
This is the method I am using whenever online tests fail (to narrow the run use -f test_which_failed
)
Use Wokwi-CLI with test images built by Platform.io. It requires a wokwi access token (free as per Jan 2024). The Github action "tests.yml" uses this mechanism.
Run the BIN image generated by pio test --without-uploading --without-testing
in VS Code Wokwi plugin.
See conf/conf.hpp
to configure LCD dimensions, timeouts, debug logs and some behaviours (e.g. time before to power off the machine). Default configuration should be fine. Some default configuration settings may be overriden by the backend (like grace period or auto-logout delay).
See conf/secrets.hpp
to configure network SSID/Password credentials, MQTT credentials and whitelisted RFID tags. You must copy secrets.hpp.example as secrets.hpp for the first compilation.
A configuration portal based on WiFiManager allows to configure WiFi credentials, MQTT Broker address and Shelly topic. This makes editing conf/secrets.hpp
required only for MQTT Broker credentials settings. To open the configuration portal, the CONFIG button must be pressed for a few seconds when the system is running.
To add white-listed RFID cards, edit the tuples list
whitelist
. These RFID tags will be authorized when backend cannot be contacted.
static constexpr WhiteList whitelist /* List of RFID tags whitelisted, regardless of connection */
{
std::make_tuple(0xAABBCCD1, FabUser::UserLevel::FABLAB_ADMIN, "ABCDEFG"),
...
std::make_tuple(0xAABBCCDA, FabUser::UserLevel::FABLAB_USER, "USER1")
};
Machine defaults:
mqtt_server: fabpi.local
mqtt_switch_topic:
machine_id: 1
machine_name: MACHINE1
machine_type: 1
hostname: BOARD
Compilation settings
MQTT_SIMULATION: 1
RFID_SIMULATION: 1
CORE_DEBUG_LEVEL: 4
LANGUAGE: en-US
RFID tags:
UID_BYTE_LEN: 4
CACHE_LEN: 10
LCD config
LCD ROWS: 2, COLS: 16
SHORT_MESSAGE_DELAY: 1000ms
General settings:
DEFAULT_AUTO_LOGOFF_DELAY: 12h
BEEP_PERIOD: 120s
DEFAULT_GRACE_PERIOD: 5min
DELAY_BETWEEN_BEEPS: 30s
MAINTENANCE_BLOCK: 1
LONG_TAP_DURATION: 10s
Debug settings:
ENABLE_LOGS: 1
ENABLE_TASK_LOGS: 0
SERIAL_SPEED_BDS: 115200
FORCE_PORTAL: 0
LOAD_EEPROM_DEFAULTS: 0
Buzzer settings:
LEDC_PWM_CHANNEL: 2
STANDARD_BEEP_DURATION: 250ms
NB_BEEPS: 3
BEEP_HZ: 660
Tasks settings:
RFID_CHECK_PERIOD: 150ms
RFID_SELFTEST_PERIOD: 60s
MQTT_REFRESH_PERIOD: 30s
WATCHDOG_TIMEOUT: 60s
WATCHDOG_PERIOD: 1s
PORTAL_CONFIG_TIMEOUT: 300s
MQTT_ALIVE_PERIOD: 120s
MQTT settings:
topic: machine
response_topic: /reply
MAX_TRIES: 2
TIMEOUT_REPLY_SERVER: 2000ms
PORT_NUMBER: 1883
Hardware settings:
LED:
Pin:20 (G:255, B:255)
Type is neopixel:1, is rgb:0
Neopixel config flags:82
Mfrc522 chip:
SPI settings: MISO: 33, MOSI: 26, SCK: 32, SDA: 27
RESET pin:16
LCD module:
Parallel interface D0:2, D1:4, D2:5, D3:19
Reset pin:15, Enable pin:18
Backlight pin:255 (active low:0)
Relay:
Control pin:14 (active low:0)
Buzzer:
Pin:12
Buttons:
Factory defaults pin:21
This is a facultative but very helpful setup to shorten the development workflow.
Make sure ESP-IDF platform is esp32s2 (used by wokwi Platformio environment)
Wokwi: Start Simulator
, you shall see the program running:See files wokwi.toml and diagram.json
"configurations"
array {
"name": "Wokwi GDB",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.pio/build/wokwi/firmware.elf",
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"miDebuggerPath": "${command:espIdf.getXtensaGdb}",
"miDebuggerServerAddress": "localhost:3333"
}
Wokwi: Start Simulator and wait for debugger
wget https://raw.githubusercontent.com/espressif/arduino-esp32/master/tools/espota.py
./espota.py -i <board_ip> -d -r -f firmware.bin
upload_protocol = espota
upload_port = IP_ADDRESS_HERE or mDNS_NAME.local
{
"disablePortal": false,
"bootCount": 1,
"ssid": "Wokwi-GUEST",
"password": "",
"mqtt_server": "fabpi2.local",
"mqtt_user": "user",
"mqtt_password": "password",
"mqtt_switch_topic": "",
"machine_id": "1",
"magic_number": 80,
"cached_cards": []
}
include/language
, define a new constant FABOMATIC_LANG_xx_xx and update lang.hpp
accordingly.Name | Description | Pins definition | Part of releases? |
---|---|---|---|
esp32-s3 | Release build for size statistics | PINS_ESP32S3 | No |
hardware-base | Base config, debug build on ESP32-S3, for hardware projects | PINS_HARDWARE_REV0 | No |
hardware-rev0-it_IT | Italian language for HW rev 0.x and 1.x | as per hardware-base | Yes |
hardware-rev0-en_US | English language for HW rev 0.x and 1.x | as per hardware-base | Yes |
esp32-devboard | Used by prototype with ESP32 module on breadboard | PINS_ESP32 | No |
wokwi | English version for demo and unit tests | PINS_WOKWI | Yes |
wrover-kit-it_IT | Version for testing with the official ESP-WROVER-KIT V4.1 with ESP32S3 | PINS_ESP32_WROVERKIT | No |
conf/pins.hpp
to set the GPIO pins for LCD parallel interface, relay, buzzer and RFID reader SPI interface for each model.Version | Date | Notable changes |
---|---|---|
none | 2021 | Initial version |
0.1.x | August 2023 | Implemented MQTT communication with backend |
0.1.x | December 2023 | Added test cases, mqtt broker simulation |
0.2.x | January 2024 | Added over-the-air updates, WiFi portal for initial config, first deploy |
0.3.x | February 2024 | Added factory defaults button, power grace period config from backend, PCB draft |
0.4.x | March 2024 | 1st PCB manufactured (rev0.2), FW +IP address announced over MQTT |
0.5.x | April 2024 | Fully tested on PCB rev0.2 & rev 0.3 |
0.6.x | April 2024 | Added RFID cache for network interruptions, config portal now opens only by button push |
0.7.x | April 2024 | Maintenance operation is displayed on LCD, JSON is now used for data persistence in Flash |
0.8.x | May 2024 | Added localization with English & Italian language builds, sizes reports for firmware |
0.9.x | June 2024 | Added buffering of important events when network is down. Espressif Arduino Core 3.0 testing. |