Identifying a specific stock items inside a dense environment, such as a warehouse, is difficult so we developed a LED strip based system that lights up around the stock item requested.
This system is connected via WiFi to a MQTT broker and is able to receive commands to light up any given set of LEDs.
The server is simply a MQTT broker. To setup the server you need to install Docker and Docker Compose.
server/mosquitto/mosquitto.passwd
with your user and password separated by a colon, here is an example:
lcdporto:very-strong-password
docker-compose up -d
docker exec -it mosquitto mosquitto_passwd -U /mosquitto/config/mosquitto.passwd
docker-compose restart mosquitto
Now your server is up and running!
The hardware is composed of a ESP32 and LED strips. The hardware connections are simple: | ESP32 | LED strip |
---|---|---|
GPIO15 | DATA | |
GPIO16 | DATA | |
GPIO19 | DATA | |
GPIO22 | DATA | |
GPIO21 | DATA | |
GPIO25 | DATA |
You can change this pin assignment as well as add more LED strips on the firmware. Your limitation is the RAM usage and the pin count of your board.
First you need to setup your computer to build the firmware with one of the two methods:
firmware
folder run the following lines on the terminal of your operative system:
pip install --user platformio
pio run --target upload
Note: you may need to reboot your system between the two commands for the pio executable to be available.
Next, you need to configure your device's WiFi network and MQTT broker details. To do that, power up your device and search for a WiFi network named after this project "warehouse-locator-\<ID>" (note down the ID, or check later with this). Connect to it and you should be promted to login to the network on a captive portal. There is where you find a form to fill in your WiFi credentials and MQTT server details. If your device fails to connect to the network the configuration WiFi network will show up again after a few seconds.\
Alternatively, you can upload a file containing the MQTT server details (firmware/data/config.json
) to the ESP32 filesystem following the this guide. Keep in mind that you still need to follow the captive portal procedure to enter your WiFi credentials.
Now your device is connected to the internet and able to receive messages from your broker that change the state of the LED strips you have hooked up.
To discover connected devices and check their ID, the topic warehouse-locator/+
can be subscribed and devices will periodically publish on that topic to announce themselves and you can check their ID on the topic name they use. Notice that the subscription topic suggested has the "+" wildcard, this means you'll subscribe to all devices announce topic.
An example on how you can listen to these messages is here.
The device can be controlled by sending a MQTT message to the broker identifying the device, led-strip and led index and two modes are supported:
Topic: warehouse-locator/<deviceId>/<strip-id>/<led-id>
\
Payload:
{
"color": {
"r": 0,
"g": 255,
"b": 0
},
"timeout": 5
}
Topic: warehouse-locator/<deviceId>/multiple
\
Payload:
{
"strip": 3,
"from": 1,
"to": 4,
"color": {
"r": 255,
"g": 255,
"b": 255
},
"timeout": 5
}
Note: For maintenance purposes the LEDs can be blinked sequentially if the payload is not a JSON object and just set to all
Examples for both modes can be found at the examples folder.