Build it step by step
0 of 7 doneTest the radios
Send a number between the two Nanos.
Test the display
Show 123 on the MAX7219.
Test the sound
Play the chime from the SD card.
Join them
Show the number when a packet arrives.
Add the buttons
Next, repeat and the two-button reset.
Add the memory
Save the last number in EEPROM.
Install
Place the display high in the waiting area.
How do you build a queue token display?
A clinic counter presses a button to call the next token number, shown on a big display with a chime. You need Arduino Nano × 2, 8-digit 7-segment module (MAX7219), nRF24L01+ Radio Module × 2, Tactile push button 6 mm × 2, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, SanDisk microSD card 32 GB (A1, Class 10), Electrolytic capacitor 10 µF × 2 and Resistor 1 kΩ. It takes 7 steps and about 180 minutes.
- Level
- Intermediate
- Time
- About 180 min
- Parts
- 9
Wiring
| From | To | Why |
|---|---|---|
| COUNTER UNIT: nRF24 VCC and GND | Nano A 3V3 and GND | Power (add 10 µF across them) |
| nRF24 CE and CSN | Nano A D9 and D10 | Control |
| nRF24 SCK, MOSI, MISO | Nano A D13, D11, D12 | SPI |
| Next button | Nano A D2 and GND | Call next |
| Repeat button | Nano A D3 and GND | Repeat the number |
| DISPLAY UNIT: nRF24 VCC and GND | Nano B 3V3 and GND | Power (add 10 µF across them) |
| nRF24 CE and CSN | Nano B D9 and D10 | Control |
| nRF24 SCK, MOSI, MISO | Nano B D13, D11, D12 | SPI |
| MAX7219 module DIN, CLK, CS | Nano B D4, D5, D6 | Display |
| MAX7219 VCC and GND | Nano B 5V and GND | Power |
| DFPlayer TX | Nano B D2 | Replies |
| DFPlayer RX | Nano B D3 through a 1 kΩ resistor | Commands |
| DFPlayer SPK1 and SPK2 | Speaker | Chime and voice |
Code
The counter unit sends the token number three times each press, as radio packets can be lost, and the display unit shows it on the large 7-segment module, plays a chime and says the number from the SD card. On the card put the chime as 0001.mp3 in the root and recordings of the numbers in a folder 01 named 001.mp3 to 099.mp3; larger numbers just show and chime. Holding both buttons for 2 seconds resets the count to 0 each morning. The last number is kept in EEPROM so a power cut does not lose it; this writes only when the number changes, which is gentle on the memory. The nRF24 modules run at 3.3 V and need a 10 µF capacitor across their supply or they behave oddly. The radio has no security, so use this only for a convenience display and not for anything that matters for safety. The display unit's 8-digit module can draw a few hundred milliamps at full brightness; power it from a good 5 V adapter. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// COUNTER UNIT (Nano A). Libraries: RF24 (TMRh20). Two buttons: next and repeat. Hold both for 2 seconds to reset to 0.
#include <SPI.h>
#include <RF24.h>
RF24 radio(9, 10);
const byte ADDR[6] = "QUEUE";
int token = 0;
unsigned long both = 0;
void sendToken(bool chime) {
byte msg[3] = { (byte)(token >> 8), (byte)(token & 255), (byte)chime };
for (byte i = 0; i < 3; i++) { radio.write(msg, 3); delay(20); } // send three times in case one is lost
}
void setup() {
pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP);
radio.begin(); radio.setPALevel(RF24_PA_LOW); radio.openWritingPipe(ADDR); radio.stopListening();
}
void loop() {
bool next = !digitalRead(2), rep = !digitalRead(3);
if (next && rep) { if (!both) both = millis(); if (millis() - both > 2000) { token = 0; sendToken(false); both = 0; delay(1000); } return; }
both = 0;
if (next) { token++; if (token > 999) token = 0; sendToken(true); delay(600); }
else if (rep) { sendToken(true); delay(600); }
}
/* ---- DISPLAY UNIT (Nano B). Libraries: RF24, LedControl, DFRobotDFPlayerMini, SoftwareSerial, EEPROM.
#include <SPI.h>
#include <RF24.h>
#include <LedControl.h>
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
#include <EEPROM.h>
RF24 radio(9, 10);
LedControl lc(4, 5, 6, 1); // DIN, CLK, CS, one module
SoftwareSerial mp3(2, 3);
DFRobotDFPlayerMini player;
const byte ADDR[6] = "QUEUE";
int token = 0, lastSeq = -1;
void show(int n) {
lc.clearDisplay(0);
lc.setDigit(0, 0, n % 10, false);
if (n >= 10) lc.setDigit(0, 1, (n / 10) % 10, false);
if (n >= 100) lc.setDigit(0, 2, n / 100, false);
}
void setup() {
lc.shutdown(0, false); lc.setIntensity(0, 12); lc.clearDisplay(0);
mp3.begin(9600); player.begin(mp3); player.volume(20);
radio.begin(); radio.setPALevel(RF24_PA_LOW); radio.openReadingPipe(1, ADDR); radio.startListening();
token = (EEPROM.read(0) << 8) | EEPROM.read(1); // last number survives a power cut
if (token > 999) token = 0;
show(token);
}
void loop() {
if (radio.available()) {
byte msg[3]; radio.read(msg, 3);
int n = (msg[0] << 8) | msg[1];
if (n != token || msg[2]) {
bool changed = (n != token);
token = n; show(token);
if (changed) { EEPROM.update(0, token >> 8); EEPROM.update(1, token & 255); }
if (msg[2]) {
player.play(1); // 0001.mp3 is the chime
delay(1200);
if (token > 0 && token < 100) player.playFolder(1, token); // folder 01, files 001.mp3 to 099.mp3 say the number
}
}
}
}
*/Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Press next | Number goes up, chime, number spoken |
| Press repeat | Same number, chime again |
| Hold both buttons 2 seconds | Resets to 0 |
| Power cut | Display returns to the last number |
If it does not work
No packets
Add the 10 µF capacitor and check CE and CSN pins.
Display blank
Check DIN, CLK, CS and the intensity.
No sound
Check the SD card format and the file names.
Misses presses
Move the units closer or raise the radio power level.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the queue token display?
Arduino Nano × 2, 8-digit 7-segment module (MAX7219), nRF24L01+ Radio Module × 2, Tactile push button 6 mm × 2, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, SanDisk microSD card 32 GB (A1, Class 10), Electrolytic capacitor 10 µF × 2 and Resistor 1 kΩ.
How long does the queue token display take to build?
About 180 minutes for a intermediate maker, in 7 steps.
How do I know the queue token display works?
Press next: Number goes up, chime, number spoken. Press repeat: Same number, chime again. Hold both buttons 2 seconds: Resets to 0.
No packets: what should I check?
Add the 10 µF capacitor and check CE and CSN pins.
Display blank: what should I check?
Check DIN, CLK, CS and the intensity.
No sound: what should I check?
Check the SD card format and the file names.
Misses presses: what should I check?
Move the units closer or raise the radio power level.
