Skip to main content
shopping_basket Basket 0

NFC tags that speak.

In The Engineering Edge Podcast "The everyday tech students launched with NASA",  I used my phone to scan NFC tags and make them speak. However, for the bonus episode, I made my own system, using an NFC reader, Pi and Node-RED. Here's how.

Parts list

Qty Product Part number
1 OKdo Raspberry Pi 4 B Starter Kit 4 GB 202-0644
1 ADAFRUIT INDUSTRIES, Adafruit PN532 NFC/RFID Controller Shield 905-4633
1 MIKROE-511, 10 piece Breadboard Jumper Wire Kit 791-6450
1 Arduino, Uno Rev 3 715-4081
1 OKdo Raspberry Pi 4 B Starter Kit 4 GB 202-0644
1 MIKROE-511, 10 piece Breadboard Jumper Wire Kit 791-6450
1 Travel Speaker e.g.
1 RFiD tag 13.56MHz ISO14443-A standard 882-8972


In The Engineering Edge Podcast "The everyday tech students launched with NASA", I used my phone and the shortcuts app to scan NFC tags and make them speak.

However, for the bonus episode in between, I made my own system, using an NFC reader and an arduino, and then with a Raspberry Pi and Node-RED software.

Arduino System



The instructions I followed were from Adafruit - and are available here. As I was using I2C, I had to comment out some lines in the code (as per instructions). Then, scanning the NFC tag gave the tag's 4 byte ID code etc. the monitor console.

This worked well - but I prefer to program using Node-RED. So I connected an NFC reader to my Pi ...

Top: NFC Shield, Bottom: NFC Breakout Board

Image: Top: NFC Shield, Bottom: NFC Breakout Board

Pi System



Adafruit says "The Adafruit NFC Breakout board is much more appropriate with the Pi than the NFC Shield  (905-4633) , since the breakout doesn't have 5V level shifting (which means you won't accidentally damage your Pi!), and you have easier access to the bus select pins, etc."

As I had an Adafruit NFC Breakout board, I used it!

1) Install the latest Raspberry Pi operating system on to your Pi

Details here: (For this project I am using a Raspberry Pi 4 and Raspbian Pi OS (32 bit) 2021-01-11). Follow the on-screen instructions to update and complete the set-up.

2) Install NFC software and connect breakout board

Free UART and other changes.

I used the Adafruit Tutorial: - but some things have changed since the tutorial was written.

>Here's the edited version I ending up using:

From the command prompt enter the following command: sudo raspi-config

Select 3, Interface Options, P6 Serial Port, then:

Would you like a login shell to be accessible over Serial? Answer No

Would you like the serial port hardware to be enabled? Answer No

Select Finish and Reboot.

Then enter at the command prompt:

sudo nano /boot/config.txt

and remove the line


if it exists. And add at the end of the file


Save the file (CTRL+O then enter to save the file, and then CTRL+X to quit nano) and reboot.

Building libnfc

Again I used the Adafruit tutorial - here it is with my adaptions:

Step 1 at the command line:

  1. cd /home/pi
  2. mkdir libnfc
  3. cd libnfc
  4. wget

    git clone

  5. tar -xvjf libnfc-1.7.0.tar.bz2

Step 2 at the command line: (Some of these directories may already be made)

  1. cd libnfc
  2. sudo mkdir /etc/nfc
  3. sudo mkdir /etc/nfc/devices.d
  4. sudo cp contrib/libnfc/pn532_uart_on_rpi.conf.sample /etc/nfc/devices.d/pn532_uart_on_rpi.conf

Then enter at the command prompt:

sudo nano /etc/nfc/devices.d/pn532_uart_on_rpi.conf

The new version of /etc/nfc/devices.d/pn532_uart_on_rpi.conf

Image: The new version of /etc/nfc/devices.d/pn532_uart_on_rpi.conf

Add: allow_intrusive_scan = true" at the end

Replace: /dev/ttyACM0 with /dev/ttyS0

Save the file and reboot.

(With thanks to "topguy" on the Raspberry Pi forum for suggesting this solution back in 2012

THEN at the command line (these take a while)

sudo make clean

sudo make install all

Then shutdown the Pi, and wired it to the NFC Breakout board:

Connecting the Parts

I followed the instructions from Adafruit here, but I didn't have a Pi Cobler, so I connected the Breakout Board directly to the Pi using jumper wires.

TXD is Pin 8 GPIO14) on the Pi, and RXD is Pin 10 (GPIO15).

Pi and Breakout Board

Image: Pi and Breakout Board

TEST as per the Adafruit instructions:

  1. cd examples
  2. sudo ./nfc-poll

Place the NFC tag on board, it will give the UID (unique ID) of the card.

Screenshot showing the UID

Image: Screenshot showing the UID


3) Install Node-RED

Note: DO NOT USE THE 'RECOMMENDED PROGRAMS' link on the Pi menu, instead go to the "Running on a Pi" section at and follow the instructions there - use the code:

bash <(curl -sL

And say "Yes" to installing the Pi Nodes.

Wait a long time

Once it is installed run the code:

sudo systemctl enable nodered.service

This will make Node-RED automatically start every time the Pi boots up.

You can then go to a browser and type in localhost:1880 to access Node-RED

3) Install e-speak on to the Pi (This is explained in more detail in the project "We have ways of making your Pi talk"

Change the audio settings to headphones -

sudo apt-get install espeak

Then select: 1 System Options, S2 Audio, Select Headphones, OK and Finish.

BE AWARE - The latest version of Raspbian means that espeak does not work in Node-RED IF you are also using an HDMI cable for a monitor etc. It has something to do with using sudo and Pulse - see

A work around is to set up the Pi using a monitor and then enable SSH, and then turn off the power, unplug the monitor, reboot and SSH in from another computer.

To access Node-RED from another computer: in a browser go to IPADDRESSOFPi:1880 where IPADDRESSOFPi is the IP address of the Pi.

Many thanks to @Ceejay and @jpwsutton for debugging help!

In a terminal, type

sudo apt-get install espeak

answer Y

Write the Node-RED flow

In the Node-RED flow page, click on the Menu (three horizontal lines at the top right)

Click Import
Click Clipboard
Paste the flow (the code listed below) into the grey box
Click Import
Click somewhere on the flow screen (white area in the middle) to drop the code. Click Deploy

[{"id":"2bc4da24.17bf26","type":"exec","z":"4aead372.b916ac","command":"cd libnfc/examples; sudo ./nfc-poll","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":180,"y":100,"wires":[["e9569169.27dce8","38a66216.97476e"],[],[]]},{"id":"c24db9d5.1ee4a8","type":"inject","z":"4aead372.b916ac","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"20","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":40,"wires":[["2bc4da24.17bf26"]]},{"id":"9f52749a.629bf8","type":"exec","z":"4aead372.b916ac","command":"espeak","addpay":true,"append":"--stdout | aplay","useSpawn":"false","timer":"","oldrc":false,"name":"","x":600,"y":320,"wires":[[],[],[]]},{"id":"38a66216.97476e","type":"debug","z":"4aead372.b916ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":430,"y":60,"wires":[]},{"id":"e9569169.27dce8","type":"switch","z":"4aead372.b916ac","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"01 8e 0b 0b ","vt":"str"},{"t":"cont","v":"04 8b 71 b2 1f 27 80","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":310,"y":200,"wires":[["c1028ca4.971b58"],["51cf2a03.418cfc"]]},{"id":"c1028ca4.971b58","type":"change","z":"4aead372.b916ac","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"Clear Tag\"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":180,"wires":[["f2a5d32d.a688f"]]},{"id":"51cf2a03.418cfc","type":"change","z":"4aead372.b916ac","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"Enk ee's Tag\"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":220,"wires":[["f2a5d32d.a688f"]]},{"id":"f2a5d32d.a688f","type":"function","z":"4aead372.b916ac","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620,"y":200,"wires":[["9f52749a.629bf8"]]},{"id":"337a76d8.14fbaa","type":"inject","z":"4aead372.b916ac","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"\"Hello World\"","payloadType":"str","x":390,"y":320,"wires":[["9f52749a.629bf8"]]}]

It should look like this:

Node-RED flow

Edit the Switch node, and enter the UID of your NFC tags, and edit the set msg.payload boxes so it says what you want it to say.

No plutonium was used in this build.

I am an inventor, engineer, writer and presenter. Other stuff: Royal Academy of Engineering Visiting Professor of Engineering: Creativity and Communication at Brunel University London; Fellow of the Institution of Mechanical Engineers and have a PhD in bubbles; Judge on BBC Robot Wars.

Related Content

DesignSpark Electrical Logolinkedin