TulzTool management

Cabinet control: pick-to-light for your own tool cabinet, step by step

Help › Devices

Your own "smart" tool cabinet, without a storage lift: every time a tool is issued, the LED at its drawer lights up and an electric lock releases the compartment; on return, the LED shows where the tool belongs. A small controller sits in the cabinet for this (ESP32, parts for about €40–120 per cabinet). Tulz and the cabinet talk to each other through an MQTT broker. A small messaging service on the internet.

How Tulz and the cabinet work together: commands via the MQTT broker, no port forwarding needed
How Tulz and the cabinet work together: commands via the MQTT broker, no port forwarding needed

A lit-up cabinet in 8 steps

  1. Create storage locations for the cabinet and its drawers
  2. Choose an MQTT broker. Nothing to set up with the Tulz broker
  3. Enter the broker in Tulz
  4. Create the cabinet
  5. Assign the compartments to the drawers
  6. Get the parts and wire them up
  7. Download the firmware and load it onto the ESP32
  8. Test the connection

The part in Tulz takes about 10 minutes, the firmware about 30 minutes the first time (a broker of your own about as much again), and the wiring one to two hours depending on the cabinet.

Step 1: Storage locations for cabinet and drawers

Under Administration → Master data → Storage locations, create the cabinet as a storage location (e.g. "Cabinet 1 Hall 2") and below it one sub-location per drawer ("Drawer 1" to "Drawer 8"). Each tool gets its drawer as storage location, or a place below it such as "Drawer 3 › left", which counts automatically. If your storage locations are already set up like this, you are done here.

Step 2: Choose a broker

With the Tulz broker there is nothing to do here. Tulz provides the broker: when you save the cabinet control, Tulz creates an account for your company, and when you create each cabinet, a separate account for that cabinet. Its password is already in the firmware you download later. Every company and every cabinet only sees its own messages. Continue with step 3.

Your own broker, only if you deliberately want to run one (or the Broker field under Settings → Cabinet control is missing for you): Tulz runs on the internet, the cabinet in your workshop, both connect to the broker on their own. So the broker must be reachable from the internet (no address in the internal network such as 192.168.…), while nothing needs to be opened in the workshop router. Any MQTT broker will do that offers TLS on port 8883 and has a user allowed to read and write the topic prefix tulz/<company number>, for example a cloud service such as EMQX Cloud (Serverless plan with a free quota; leave the spend limit at 0) or your own Mosquitto on a server (listener 8883, Let's Encrypt certificate as certfile/keyfile, allow_anonymous false, password_file; open port 8883 in the firewall). For step 3 you will then need the broker's address, port, username and password.

Step 3: Enter the broker in Tulz

With the Tulz broker:

  1. Open Settings and click Cabinet control in the Integrations & devices section.
  2. Tick Enable cabinet control, choose "Tulz broker" under Broker and set Release compartment (seconds) (0 = no lock, light only).
  3. Save: Tulz creates the access and shows it with address and topic prefix. Done, continue with step 4.
With the Tulz broker: enable, choose the broker, save
With the Tulz broker: enable, choose the broker, save

With your own broker:

  1. Open Settings and click Cabinet control in the Integrations & devices section.
  2. Tick Enable cabinet control (if there is a Broker field, choose "Own broker" there) and enter: Broker address (just the name, without mqtt:// and without port), Port 8883, Encryption "TLS (recommended)", Username and Password of the broker.
  3. Leave the Topic prefix empty, then tulz/<company number> applies. Release compartment (seconds): how long a lock stays open after issue; 0 = no lock, light only.
  4. Save. Tulz asks once for your passkey or password, because access data is being stored. The broker password is then stored encrypted in Tulz; the field stays empty ("saved, leave empty = keep").
Settings → Integrations & devices → Cabinet control
Settings → Integrations & devices → Cabinet control
Entering the broker access
Entering the broker access
Confirm once when saving, with passkey or password
Confirm once when saving, with passkey or password

Step 4: Create the cabinet

On the right under Create cabinet:

Create opens the cabinet's page. With the Tulz broker, the cabinet automatically gets its own access.

Create cabinet
Create cabinet

Step 5: Assign the compartments to the drawers

On the cabinet page, choose the matching drawer for each compartment and click Save compartments. Compartment 1 is the first LED on the strip, compartment 2 the second, and so on. Tools in the drawer or in a place below it trigger the compartment. You do not change anything on the tools themselves. The Label is optional (otherwise the drawer's name is used).

Assigning compartments to drawers
Assigning compartments to drawers

Step 6: Parts and wiring

Parts list for a cabinet with up to 8 drawers
Parts list for a cabinet with up to 8 drawers
Wiring using compartment 1 as an example, and the pins of all compartments
Wiring using compartment 1 as an example, and the pins of all compartments
  1. Power: 5 V supply to the ESP32 (5V or VIN and GND) and to the LED strip (+5V, GND). Put the 1000 µF capacitor directly at the strip between +5V and GND (negative side to GND).
  2. LEDs: GPIO 13 through the 330 Ω resistor to DIN of the strip. Mind the arrow direction on the strip. The first LED belongs to compartment 1, so lay the strip in compartment order.
  3. Drawer contacts (optional): one reed contact per drawer between the pin from the table and GND, the magnet on the drawer. With the drawer closed, the contact is closed.
  4. Locks (optional): one MOSFET module per lock: SIG to the pin from the table, GND to GND, V+ to +12 V. The lock goes between +12 V and OUT, plus a 1N4007 flyback diode in parallel with the lock (ring towards +12 V). Choose fail-secure locks: without power they stay locked.
  5. Ground: connect all GNDs: 5 V supply, 12 V supply and ESP32.

Do not use: GPIO 0, 2 and 12 (boot pins), 6–11 (flash); 34–39 are input-only without pull-up. The ESP32 only supports 2.4 GHz Wi-Fi.

Step 7: Flash the firmware

  1. On the cabinet page, click Download firmware and guide (ZIP). The ZIP contains the program tulz-schrank.ino, the guide LIESMICH.txt and the pin assignment Verdrahtung.txt (in German).
  2. Install the Arduino software (Arduino IDE 2) from arduino.cc. Under File → Preferences → Additional boards manager URLs enter https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json, then install "esp32" (Espressif Systems) under Tools → Board → Boards Manager.
  3. Under Tools → Manage Libraries install: PubSubClient (Nick O'Leary), ArduinoJson (Benoît Blanchon, version 7) and Adafruit NeoPixel.
  4. Open tulz-schrank.ino. The lines marked orange have already been filled in by Tulz; do not change them. You enter the green ones yourself: Wi-Fi name, Wi-Fi password and the broker password; with the Tulz broker the password is already in it, then just the Wi-Fi.
  5. Connect the ESP32 via USB, choose "ESP32 Dev Module" and the port under Tools → Board, click Upload (arrow). If the upload hangs at "Connecting…", briefly hold the BOOT button on the ESP32.
  6. Open Tools → Serial Monitor (115200 baud): it shows "MQTT verbunden" (MQTT connected). On start-up, a short running light passes over all compartments.
Download on the cabinet page
Download on the cabinet page
Orange: pre-filled by Tulz, green: enter yourself
Orange: pre-filled by Tulz, green: enter yourself

The broker's root certificate (MQTT_CA_CERT) is already included in the downloaded firmware: with the Tulz broker it is "ISRG Root X1" from Let's Encrypt; with your own broker it is the certificate you entered under Settings → Cabinet control in the field Root certificate of the broker (PEM) (Let's Encrypt: "ISRG Root X1" from letsencrypt.org/certificates; EMQX Cloud: the CA certificate from the connection information). This lets the cabinet verify that it really talks to your broker; without a certificate it no longer connects (message in the serial monitor), unless you deliberately chose "TLS without certificate check". Older firmware without a certificate keeps running; the next download includes it.

With the Tulz broker, the firmware contains the cabinet's password. That is why Tulz asks once for your passkey or password before the download. Do not pass the file on. If a cabinet was lost or the file got into the wrong hands: on the cabinet page under Status, click Generate new password, then download and flash the firmware again. The old password stops working immediately.

Step 8: Test the connection

Back in Tulz: Settings → Cabinet control → Test connection and send test light. Tulz connects to the broker, all compartments light up one after another, and every cabinet reports back. On the cabinet page, Status shows when it last reported, with firmware, Wi-Fi strength and IP address; the table shows for each compartment whether the drawer is open or closed. Show lights up a single compartment for 15 seconds. This way you check that each LED sits at the right drawer.

Test connection: broker OK, cabinet has reported
Test connection: broker OK, cabinet has reported
Cabinet page with compartments and status
Cabinet page with compartments and status

In everyday use

Issue: compartment released and lit
Issue: compartment released and lit
Tool page: More → Show in cabinet
Tool page: More → Show in cabinet
Return: compartment lit, put the tool back there
Return: compartment lit, put the tool back there

Commands go out in the background after the booking, so issuing never waits for the cabinet. If the broker cannot be reached, the booking still counts; the error is shown in the cabinet list and at the top under Last error. Several cabinets per site are possible, each with its own device ID.

If something does not work

Message or observationWhat to do
"Broker-Adresse nicht auflösbar" (address cannot be resolved)Check the address: just the name, e.g. mqtt.autohaus-muster.de, without mqtt:// and port.
"Keine Verbindung zum Broker …" (no connection)Do port and encryption match? (8883 with TLS, 1883 without). Is port 8883 open on the broker, and allowed outbound on the web server?
"Benutzername oder Passwort falsch" / "Nicht autorisiert …"Check the access on the broker; the user needs rights on the topic prefix.
"Ziele im internen Netz sind nicht erlaubt"The broker must be reachable from the internet (public address).
"no status report from any cabinet yet"Check the serial monitor: "MQTT-Fehler -2" = no connection (Wi-Fi, address, port), "MQTT-Fehler 4" or "5" = user or password. Are device ID and topic prefix the same in firmware and Tulz? After changing the prefix, download the firmware again.
No Wi-Fi2.4 GHz only; Wi-Fi name and password exactly as in the router.
Wrong drawer lights upGo through each compartment with Show; adjust LED order or compartment assignment. Several LEDs per drawer: LEDS_PER_SLOT in the firmware.
Nothing lights up on issueDoes the tool have a storage location in an assigned drawer? Is the cabinet active and cabinet control enabled?
"Access on the Tulz broker could not be created"The broker is not reachable right now; save again later. If the message persists, contact support.
Cabinet does not report after a new device IDWith the Tulz broker the access belongs to the device ID: download and flash the firmware again.
Lock does not openCheck the 12 V supply, common ground and MOSFET module; Release compartment (seconds) not 0.

Security

The cabinet only accepts commands on its own topic; the broker requires username, password and TLS. A lock opens for at most 300 seconds and locks when unpowered (fail-secure). The key always opens the cabinet. Who took something is recorded in Tulz as usual, not at the cabinet: the employee books the issue at the kiosk or on their own device. With the Tulz broker, every cabinet has its own access that may only read and write its own topics; no workshop sees another workshop's messages. Cabinet control is blocked in the demo company.

NFC reader on the cabinet

With a PN532 NFC reader on the ESP32 the cabinet books the removal itself: the employee holds their NFC card (the same as at the kiosk) to the reader, Tulz looks up what is reserved for them today in this cabinet, issues the tool and opens the compartment. If they hold the card again while they have a tool from this cabinet on loan, the compartment lights up for putting it back; with drawer contacts Tulz books the return as soon as the drawer is closed again, without contacts immediately.

Setting up:

  1. On the cabinet page tick NFC reader on the cabinet and save. Tulz creates a separate access key for the cabinet.
  2. Download the firmware again: it now contains the address of the Tulz interface, the key and the root certificate.
  3. Wire the PN532 module (I²C mode, switch on the module): SDA to GPIO 32, SCL to GPIO 33, VCC to 3.3 V, GND to GND. These two pins otherwise belong to the locks of compartments 6 and 7. A cabinet with NFC reader therefore has at most 5 locks.
  4. In the Arduino library manager additionally install Adafruit PN532, upload the firmware.
  5. Assign NFC cards to employees (Users → NFC card, as for the kiosk) and plan the removal via a reservation. The cabinet only hands out what is reserved.

The cabinet reports every card tap to Tulz via HTTPS; the response (issue, return, nothing open, card unknown) is shown with the LEDs: blue = take out, green = put back, flashing red = refused. The cabinet page shows when a card was last read. If the firmware file fell into the wrong hands: Create new access key on the cabinet page, download the firmware again. The old key stops working immediately. Without a reservation or loan nothing happens on a card tap; whoever needs something unplanned books as usual at the kiosk or on the phone.

As of

Was this helpful?