Silicon ChipDynamic NFC/RFID Tag - July 2023 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: We will continue to offer printed and online magazines
  4. Feature: Charging Electric Vehicles by Dr David Maddison
  5. Feature: VL6180X Rangefinding Module by Jim Rowe
  6. Project: Dynamic NFC/RFID Tag by Tim Blythman
  7. Feature: Electronics Magazines in Aus. by Jim Rowe
  8. Project: Reciprocal Frequency Counter by Charles Kosina
  9. Project: Pi Pico Thermal Camera by Kenneth Horton
  10. Project: Railway Carriage Uncoupler by Les Kerr
  11. Subscriptions
  12. Vintage Radio: Replacing Vibrators, Pt2 by Dr Hugo Holden
  13. PartShop
  14. Serviceman's Log: Can’t stop servicing, even on holiday! by Dave Thompson
  15. Market Centre
  16. Advertising Index
  17. Notes & Errata: Loudspeaker Testing Jig, June 2023; Vintage Radio, Astor APN, May 2023
  18. Outer Back Cover

This is only a preview of the July 2023 issue of Silicon Chip.

You can view 38 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "Dynamic NFC/RFID Tag":
  • Large Dynamic RFID Tag PCB [06101232] (AUD $4.00)
  • Small Dynamic RFID tag PCB [06101231] (AUD $1.50)
  • Small Dynamic RFID Tag kit (Component, AUD $5.00)
  • Credit card size Dynamic RFID Tag kit (Component, AUD $7.50)
  • Dynamic NFC/RFID Tag programming software (Free)
  • Dynamic NFC/RFID Tag PCB patterns [06101231/2] (Free)
Articles in this series:
  • History of Silicon Chip, Part 1 (August 2022)
  • History of Silicon Chip, Part 1 (August 2022)
  • History of Silicon Chip, Part 2 (September 2022)
  • History of Silicon Chip, Part 2 (September 2022)
  • Electronics Magazines in Aus. (July 2023)
  • Electronics Magazines in Aus. (July 2023)
Items relevant to "Reciprocal Frequency Counter":
  • Reciprocal Frequency Counter main PCB (CSE230101C) (AUD $5.00)
  • 0.96in cyan OLED with SSD1306 controller (Component, AUD $10.00)
  • Short-form kit for the Reciprocal Frequency Counter (Component, AUD $60.00)
  • Reciprocal Frequency Counter front panel PCB (CSE230102) (AUD $5.00)
  • Reciprocal Frequency Counter firmware (Software, Free)
  • Reciprocal Frequency Counter main PCB pattern (PDF download) [CSE230101C] (Free)
  • Reciprocal Frequency Counter front panel artwork (PDF download) (Free)
Items relevant to "Pi Pico Thermal Camera":
  • Raspberry Pi Thermal Camera PCB [04105231] (AUD $5.00)
  • Raspberry Pi-based Thermal Camera software & 3D printer files (Free)
  • Pi Pico Thermal Camera PCB pattern (PDF download) [04105231] (Free)
Items relevant to "Railway Carriage Uncoupler":
  • Model Railway Uncoupler PCB [09105231] (AUD $2.50)
  • PIC12F617-I/P programmed for the Model Railway Uncoupler [0910523A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Model Railway Uncoupler firmware [0910523A.HEX] (Software, Free)
  • Model Railway Uncoupler PCB pattern (PDF download) [09105231] (Free)
Items relevant to "Replacing Vibrators, Pt2":
  • Oscillator-Based Vibrator Mosfet replacement PCB [18106231] (AUD $2.50)
  • Oscillator-based Mosfet Vibrator Replacement PCB pattern (PDF download) [18106231] (Free)
Articles in this series:
  • Servicing Vibrators, Pt1 (June 2023)
  • Servicing Vibrators, Pt1 (June 2023)
  • Replacing Vibrators, Pt2 (July 2023)
  • Replacing Vibrators, Pt2 (July 2023)
  • Replacing Vibrators, Pt3 (August 2023)
  • Replacing Vibrators, Pt3 (August 2023)

Purchase a printed copy of this issue for $11.50.

D Y NA MI Dynamic NFC Tag Features C − Compact tag (22 × 31mm) − Thin credit card/business card size tag (86 × 54mm) − Arduino sketch and jig allows custom tags to be easily created − Tags can also be written from apps Supported NDEF Tag Types − Text − URI/URL (http:, https:, tel:, mailto: and many more) − WiFi network handover − vCard − MIME file types N F C G Supported Chips A T − − − − − − ST25DV04K ST25DV04KC ST25DV16K ST25DV16KC ST25DV64K ST25DV64KC Project by Tim Blythman Near-field communication (NFC) devices have become widespread, especially for ‘contactless’ payments. The availability of dynamic NFC tags means you can now easily create your own custom NFC/RFID Tags. This article explains how to program NFC chips that can be used as smart business cards and more. Y ou likely have several NFC tags in your possession. Most bank cards and stored credit public transport cards use NFC technology. You might also hear them referred to as RFID or contactless cards. NFC protocols allow communication over distances up to around 5cm using antennas transmitting and receiving at 13.56MHz. The NFC Forum is responsible for standardising NFC technology. RFID is a broader term technology that includes NFC, also having systems that operate at 125kHz and around 900MHz. It’s now possible to implement your own ‘dynamic’ NFC tags using a handful of components. ‘Dynamic’ means that the tag’s contents can be easily reprogrammed. While you might be familiar with how easily NFC allows money to 34 Silicon Chip leave your bank account, NFC tags can also allow small amounts of data to be stored and transferred. With many mobile smartphones having NFC chips, we’ll look at some apps that can work with NFC tags, including reading and writing. Writing custom data to tags using a Raspberry Pi Pico microcontroller and the Arduino IDE is quite easy. Such tags can also be read back using the microcontroller too. These custom tags can contain, for example, a vCard file. That format encapsulates the sort of information typically found on a business card. A programmed tag thus behaves like a virtual business card and can be ‘taken’ by simply reading it with an appropriate NFC reader, such as a mobile phone. The phone can import those contact details into an address book. URIs (uniform resource identifiers) Australia's electronics magazine such as web addresses can also be written to a tag (a URI is a more general form of a URL, also known as a link). Customers can be directed to a website by tapping their mobile phone instead of manually entering a web address, similar to how QR codes are often used. NFC technology Jim Rowe covered an Arduino shield that uses NFC technology in an article from September 2018 (siliconchip. au/Article/11236). That article briefly explained the history and technology behind NFC. Despite being based on NFC technology, the shield from the 2018 article (which uses a PN532 NFC controller IC) will not work with these tags as they use different versions of the NFC standard. The PN532 can work with tags that comply with ISO14443A siliconchip.com.au (type 2, 3 or 4 tags), while the tags we are using comply with ISO15693 (type 5 tags). One of the great advantages of NFC is that the tag does not need its own power source. The reader creates an RF field at 13.56MHz that is picked up by the tag; it harvests energy from that to power its internal circuitry. Since the tag does not need a battery, it can be tiny. Tags the size of coins are commonplace, and smaller tags are possible. As shown in Fig.1, the coils in the reader and tag effectively form an aircored transformer, which limits the practical communications range. Data is transferred when either the reader or the tag modulates the RF field. The reader can do this easily, as it generates the field, while the tag can do this by changing its RF impedance. The reader senses this through changes in the load it sees as it drives the RF field. For this project, we’re using a specific type of chip that provides the dynamic tag feature. Unfortunately (?), this means that you won’t be able to hack into your bank card and trick it into thinking you have more money than you do! Terminology A reader is a device that generates an RF field and can use this to communicate. You might also hear the term emitter used, since this device emits the RF field. ‘Tags’ are simply devices that can communicate with an NFC reader. They are typically implemented by combining a tag-capable chip (which contains some non-volatile memory) with an appropriate antenna and perhaps a few passive components. The antenna is often little more than a printed foil loop, similar to a PCB trace antenna, but on a thinner This timetable pole at a bus stop in Queensland includes an NFC tag with an NDEF URI record. It directs users to a web page displaying live bus departure times for the bus stop. substrate. We tried a few variations on custom antennas that we’ll describe later. Some tags have an internal EEPROM, including the chips we are using, in which case the reader might be able to write to the tag and change its contents. Portable tags are commonly found in the form of a card or a keyfob that can be easily carried around. You might also see fixed tags, often in a more robust enclosure to prevent damage. The NDEF (NFC Data Exchange Format) specifies headers and other data that indicate what sort of data the tag carries; these are the sort of tags this project allows. NDEF tags are only a subset of NFC, and other types of NFC tags exist. The software we have written allows you to explore NDEF data at a low level. Briefly, there is a Capability Container (CC), which indicates that the tag contains NDEF data and the amount of available storage space. This, in turn, points to an NDEF message, which can contain one or more NDEF records. An NDEF record is roughly analogous to the contents of a single file, although the NDEF message doesn’t have a file system as such. While NDEF allows multiple Fig.1: with NFC, an unpowered device (the tag) is powered by the received RF field and can transmit data back to a reader or emitter by modulating that field. siliconchip.com.au Australia's electronics magazine messages and records on a tag, for simplicity, our software only writes one message containing one record at a time, although it can read multiple records. The ST25DV IC Dynamic tags are those tags that can be easily reprogrammed. In this project, we will use members of the ST25DV family from ST Microelectronics. These parts include the RF interface needed to implement NFC, an EEPROM and an I2C interface that allows their internal EEPROM to be modified and thus present changing data to an NFC reader. Many tags, including those from the ST25DV family, can also be written over the RF interface, provided that the ‘reader’ also has write capabilities, as many do. One of the apps we tried (from ST Microelectronics) can write to these chips. You don’t necessarily need to use the I2C interface to work with these chips, but it is an easy way to do so. In fact, many readers (especially those on mobile phones) can also emulate tags; this is the basis of how ‘pay by phone’ technology works. The phone emulates a virtual contactless credit card. The specific chips we are using are the ST25DV04K, and they have 512 bytes of EEPROM space (with maybe a dozen bytes taken up by the NDEF headers). Data such as that found in brief text files is an excellent candidate for being passed around, including the vCards mentioned earlier. Similar chips from the same family can hold up to 8kB, which will also work with all the software we will discuss, but we haven’t concentrated on them mainly because of how long it July 2023  35 takes to transfer that much data over an NFC link. Possible uses Some people will find it convenient to program tags once and then use them as smart business cards or to pass other information around. For example, you might provide a tag to allow guests to connect to your WiFi network when they visit. You could attach a tag to an object containing text information about that object. You might have heard of ‘smart posters’ being used in advertising. These are nothing more than printed posters accompanied by a tag that provides information beyond what is printed on the poster. One use we have seen ‘in the wild’ is a tag at a bus stop. The tag is enclosed in a sturdy plastic shell and attached to the post that holds up a printed timetable (see photo). This is a simple but practical application. This tag contains a URI NDEF message that points to a web page providing live bus departure times for that specific stop, supplementing the fixed information on the printed timetable. Screen 1 shows a scan of this tag by one of the apps we will discuss later. It also uses a chip from ST Microelectronics (but a different one). We have written an Arduino program that can add several types of records to these cards. As well as the Screen 1: an ST25 NFC Tap app scan of the bus stop tags shown in the photo. It has a much smaller capacity than the tags we are using, but still enough for a URI pointing to a web page. 36 Silicon Chip Fig.2: the circuit is very simple and, as you can see from our photos, it’s possible to create it on a small breakout board. Other variants of tag chip IC1 have other functions broken out on more pins, but they are in packages that are difficult to hand-solder, such as WLCSP (wafer-level chip scale package). vCards and URIs mentioned earlier, it can also create simple text file records and WiFi ‘handover’ records. Such a record simply contains sufficient information (SSID name, password and security type) to allow a device such as a mobile phone to connect to a WiFi network. Another NDEF record type is the so-called MIME (Multipurpose Internet Mail Extension) type. The MIME standard was developed for email file attachments and carries information about a file’s type. The vCard and WiFi handover record types are simply MIME records of a specific type (“text/vcard” and “application/vnd.wfa.wsc”, respectively). Thus, a MIME type record could be used to describe anything that could be considered a file, although it would have to fit in the available space on the tag. The receiving device would also need to know what to do with it; we found this was often not the case, even for common file types. Also, when we uploaded some ‘large’ files to the 8kB ST25DV64K chips, they took many seconds to be downloaded by a reader and often appeared not to be working due to this delay. On the other hand, vCards, WiFi handover records or URIs (in the form of web addresses or email addresses) are widely recognised and will be the most useful types for custom tags. With that out of the way, we’ll show you how to construct a Tag using these dynamic tag chips, then use our Arduino software to program them for a specific use. We’ll also show how to create Tags using various antennas, followed by using several apps to interact directly Australia's electronics magazine with the Tags over the RF interface, including reading and writing to them. PCB tags Fig.2 shows the schematic of our small PCB-based tags; IC1 is the chip that implements the dynamic tag function. It could be one of several chips from the ST25DV family, but we used the ST25DV04K variant for most of our testing, and that is what we specify in the parts list. We have developed two different PCBs that implement this same basic circuit (see Figs.3 & 4). CON1 provides a breakout for all the pins of IC1 except those that connect to the antenna. The two resistors are the pullups needed for the I2C SDA and SCL lines, while the 100nF capacitor provides supply bypassing when the chip is powered from CON1. Pins 2 and 3 (AC0 and AC1) connect to a PCB trace antenna. IC1 has an internal tuning capacitance of 28.5pF, meaning that an inductance of 4.7μH is needed for resonance at 13.56MHz. The larger PCB has five turns for the antenna, while the smaller PCB has fourteen turns, seven on each side. In practice, we found that the circuit wasn’t too fussy about the exact coil dimensions. Later, we’ll discuss some of the alternative coils that we tried. The remaining pins on IC1 are VEH and GPO. The GPO pin is an opendrain output that can be programmed to drive its output low under certain conditions, such as while an RF signal is being received, or a write is being performed to the internal EEPROM. The VEH pin (also when appropriately programmed) can deliver an unregulated voltage harvested from the external RF field, when available. In practice, we found this could be up to siliconchip.com.au ◀ Our prototype Tag is constructed on a SOIC-8 breakout board and uses a 4.7μH wirewound inductor as the antenna. The passive components are on the back of the PCB, and the circuit is practically identical to our final designs. Connecting an antenna to pins 2 and 3 of the IC is sufficient to create a functional Tag. The antenna can be as simple as a 4.7μH inductor or many turns of enamelled copper wire. The wire antenna shown here uses just over 1m of wire. Be sure to strip the enamel from the ends of the wire before attempting to solder it. about 4V at up to 10mA. Naturally, this will depend on the reader and other factors, such as the antenna efficiency. In one simple test, we hooked a light-emitting diode (LED) directly between the VEH and GND pins. After changing the appropriate registers to allow energy harvesting to operate, we got it to light up (when in a reader’s RF field). A simple tag (accessible by RF only) could consist of little more than the IC and an appropriate antenna. The passives are only needed if the I2C interface is required. Other tags Since the tag chips can be programmed by RF as well as I2C, it’s possible to create a tag with nothing more than a chip and an antenna. You also could set up a rig using an SOIC socket of the correct width to program the chips before soldering them to an antenna. We even used one of our smaller PCBs (populated with everything except the chip) as a programming rig with the trick of holding the chip in place using a clothes peg. That was sufficient to allow testing of the tag via its RF interface, too. The photos show a few of the prototypes we created to see whether it was possible to make a workable antenna without a PCB. As you can see, the answer is just about anything, within reason. The photo above shows our first prototype, based on a small SOIC-8 to DIP-8 IC adaptor PCB. The antenna is actually a 6mm SMD inductor that is designed for this application. This prototype was great for testing how things should work, including the I2C interface. siliconchip.com.au The group of photos at upper right shows some antenna-only designs, including the design that inspired our first PCB. It is simply fourteen loops of enamelled wire soldered to the AC0 and AC1 pins of a tag chip. The diameter of the coils is just over 2cm, using a little over a metre of wire. This set also shows a circuit with an axial leaded inductor with a nominal 4.7μH inductance, as well as the wirewound inductor seen in the previous photo. We also tried a tiny (M2012/0805) SMD inductor, shown in the upper right corner, but the reader did not pick it up. This correlation between size and sensitivity also extended to the larger tags, with the larger PCB design being the most sensitive. We judged this simply on the distance from which the tag could be detected by the reader, being nearly 5cm for the larger PCB design. Another reason the smaller SMD inductor didn’t work, besides its size, might be that it has a shielded construction. Larger shielded inductors ◀ are also available; avoid using them, as they will not work well as antennas. If you build a Tag without the I2C interface, you won’t be able to use the Arduino Programming Rig that we will describe later. You will only be able to program the Tags using apps installed on a mobile phone or a similar reader. PCB designs The two Tag PCBs are shown in Figs.3 & 4 and the photos overleaf. The smaller PCB is coded 06101231 and measures 22 × 31mm, while the larger PCB is coded 06101232 and measures 85.5 × 54mm. The usual SMD tools and supplies will be adequate for building the PCBbased tags. This includes solder, flux paste, tweezers, good lighting and a fine-tipped iron. Fume extraction is recommended when working with flux paste due to the amount of smoke it generates. For the smaller PCB (06101231), assembly is straightforward. Apply flux to the pads of the four SMD components and rest each in place. IC1 is Figs.3 & 4: assembling the smaller PCB is pretty straightforward. The larger PCB is a little trickier as the components are nestled into cutouts. Still, if you’ve done any SMD soldering, you should be able to use similar techniques to do that. Australia's electronics magazine July 2023  37 The larger card Tag PCB has cutouts so that the components are internal and don’t increase the overall thickness; the SOIC IC is nearly exactly the same thickness as the PCB! You’ll need careful use of flux and solder wick to fit the components. You can create a more polished look by gluing paper or cardboard (or sticking a sticker) to the front and back of the PCB. the only polarised part, so check that the chamfer along one edge (best seen from the end of the chip) aligns with the marking on the PCB. Tack one lead of each component and ensure the remaining leads are within their respective pads. Then solder the remaining leads and refresh the first leads. Check for solder bridges and use solder-wicking braid to remove them. The larger PCB (coded 06101232) is designed to have the components sit inside slots so that they are no thicker than the PCB itself. We used a silicone soldering mat to align the components vertically within the slots. Rather than resting on surface pads, the parts are soldered to exposed edges of the plated-­through holes. The photos above show the final result. Fig.5: the wiring from the Pico to the Tag is simple; you can solder a four-pin header to the Pico and plug the Tag onto that. You can also use a breadboard if you have soldered fulllength headers to your Pico. ◀ IC1 is very close to the same thickness as the PCB (1.6mm), while the passives are much thinner. This is an experimental technique, so it is best suited to constructors with some SMD soldering experience. Before soldering the components, check the pads for copper swarf or burrs, as some may be left from the milling process during PCB manufacture. We found it wasn’t necessary to remove any burrs unless they could cause a short circuit or interfere with component placement. The technique is similar to regular SMD work in that each component should be initially secured by one lead. Use tweezers to locate the part before tacking, after which the remaining leads can be soldered. You might need to build up a small fillet of solder to ensure a mechanically sound connection. Inspect the joints and use flux and solder-wicking braid as necessary to tweak the location and amount of solder. For IC1, first tack the leads along one edge. Then flip the PCB over and gently bend out the IC leads along the other edge to be closer to the PCB pads. Solder these leads to their corresponding pads. We found that the best results came from using a generous amount of solder and flux. We then applied solder braid to the PCB pads only to draw off excess solder, relying on surface tension to keep a suitable amount of solder connecting the lead. If you like, a pin header can be soldered to CON1 on either PCB, but if you only intend to program the tag The smaller Tag is a straightforward SMD design. The staggered holes on CON1 allow a header to be temporarily friction-fitted for programming. That avoids the need to fit the bulky headers permanently. 38 Silicon Chip Australia's electronics magazine siliconchip.com.au once, simply holding the header in place should be sufficient. We’ve offset the holes slightly to give a firm friction fit. If you wish to add some polish to your Tag PCBs, you could glue paper or cardboard (such as your own paper business card) to the front and back of the PCB. You could even get custom stickers of the right size made. The programming jig Our programming jig is simple and just requires a Raspberry Pi Pico (or Pico W) with four connections to CON1 on the Tag PCB. We used the Arduino IDE to write the program, as a good Arduino library is available to work with these chips. If you want to modify or work with our code and don’t have the Arduino IDE installed, download and install it from www.arduino.cc/en/software Still, you don’t need the Arduino IDE to try our sketch out. Simply hold down the white BOOTSEL button on the Raspberry Pi Pico while plugging it into a computer. Then copy the “0610123A.UF2” file (available from our website) to the drive that appears. It’s typically named “RPI-RP2”. If you want to program tags beyond what our sketch can do or tweak the sketch, you will need the SparkFun ST25DV64KC library in addition to the Arduino IDE. This will also work with other chips, including the -04K, -16K, -64K, -04KC and -16KC variants. We’ve included a copy of the version we used in the software download. It can also be found by searching for “st25dv” in the Arduino Library Manager. As well as the SparkFun library, this will show a library from ST Microelectronics, but that one appears to be designed to work with Arduino boards based on their (STM) microcontrollers and not the Pico. We’ve designed the interface to use four adjacent pins on the Pico. These correspond to the four I2C pins on CON1 of either PCB. Pin GP28 is driven high as an output to provide 3.3V. Next to it is a ground pin followed by pins GP27 and GP26 to provide I2C SDA and SCL, respectively. Fig.5 shows the connections needed. The simplest way to achieve this is to solder a four-way pin header to the Pico, allowing the Tag to be friction fitted. However, you could use a breadboard or even solder wires if you like. The RF and I2C interfaces can siliconchip.com.au TAG Programming Interface. ST25 found on I2C. ~ Reboot microcontroller. r Read NDEF entries (1,2,3,4 for specific entry or blank for all). a Decode NDEF entries (1,2,3,4 for specific entry or blank for all). c Decode CC and NDEF headers i Read UID data. e Erase EEPROM and write blank NDEF. w Write NDEF entries: wt Write text NDEF. ww Write WiFi NDEF. wu Write URI NDEF. wv Write vCard NDEF. wm Write text MIME type. wb Write binary (hex) MIME type. d Dump raw EEPROM. h Write raw hex (haaaadd) to EEPROM. o Open I2C session. s Dump system memory. l Set RF write lock bits (0=allowed 3=never). Screen 2: the main menu of our programming jig software has the options shown here. While there are quite a few commands, many are to explore the structure of the data on the Tags and are not needed to create your own Tags. i UID value: E0:02:24:67:09:12:1E:EA ST25DV04K-IE found. EEPROM is 512 bytes. c Capability Container: Short (4 byte) CC version 1.0, 512 bytes available for NDEF. TLV record at 0x0004: NDEF message 23 bytes starting at 0x0006: NDEF record found at 0x0006. MB ME CF SR IL TNF 1 1 0 1 0 NFC type URI type. 1 bytes of type, 19 bytes of payload, 0 bytes of ID. URI Prefix code: 4:https:// siliconchip.com.au ME flag ends message. TLV record at 0x001d: NDEF terminator. Scan complete. Screen 3: the “i” command checks what type of tag chip you have and its capacity, while the “c” command allows you to verify that the NDEF headers are present and correct. coexist, but communication cannot occur on both simultaneously. So you can leave the Tag connected to the programming jig while testing the Tag with a reader, as long as you don’t attempt to read or write at the same time. To control the programming jig from your computer, you will also need a serial terminal program, such as Tera­Term on Windows or minicom on Linux. The Arduino IDE’s serial monitor has limited functionality and will work for some commands, but not all. Verify that your serial terminal program uses CR or CR/LF as the line ending. The program checks for CR and ignores LF. Programming Tags After connecting to the Pico’s virtual Australia's electronics magazine serial port with the terminal program, you should see the main menu (Screen 2). Check that the message “ST25 found on I2C” is shown before proceeding. If you don’t see it, check your connections and use the “~” command to reboot the Pico if necessary, forcing it to test for communication again. Each command consists of one or two letters (followed by Enter), after which you may be prompted for additional parameters depending on the command. Screen 3 shows the output of the basic “i” and “c” commands, while Table 1 details the available commands. The “i” command provides information about the tag chip’s serial number, which can be used to deduce the part number. The part number includes July 2023  39 Table 1 – commands for the programming jig CMD Function Reprint menu ~ Reboot Pico Notes Simply press Enter on a blank line. Use to refresh after connecting a Tag. r Read NDEF messages Uses the SparkFun library to decode NDEF data. from EEPROM; use 1-4 for a specific record (eg, “r1”) a Decode NDEF Uses custom code to perform a more detailed messages from analysis than the “r” command. EEPROM. Use 1-4 for a specific record (eg, “a1”) c Decode capability container and NDEF messages Uses custom code and provides more detail of the structure of the NDEF data rather than contents. i Read UID data and check memory capacity The part number is printed if a known chip type is identified (including the supported chips). e Erase EEPROM (to zeroes) and write a blank capability container Use this on a new chip to format it and allow NDEF records to be written. You can also use this to remove any previous data when reusing a Tag. wt Write an NDEF text record to the Tag Prompts for text that can include line endings. Use Ctrl-D or Ctrl-Z to finish or Ctrl-C or Escape to cancel. ww Write a WiFi handover record to the Tag Prompts for SSID (name), password and security and encryption types. wu Write a URI NDEF record Prompts for URI type (eg, “http:”, “mailto:”) and URI to the Tag text. The URI type simply allows common types to be easily abbreviated and can be omitted by using URI type zero (blank). wv Write a vCard NDEF record to the Tag 40 Creates a version 2.0 vCard file and prompts for all mandatory fields for that format. Also prompts for custom fields. wm Write text MIME type to the Tag Uses the same scheme as “wt” but allows the MIME type to be specified. Most mobile phones will treat “text/plain” types the same as an NDEF text type record, if they have an app that supports that type. wb Write binary MIME type to the Tag Prompts for MIME type and accepts hex bytes (or single nibbles if separated by white space). Use Ctrl-D or Ctrl-Z to finish or Ctrl-C or Escape to cancel. d Dump ASCII and text contents of the Tag’s EEPROM This is handy for viewing the raw EEPROM contents if you want to see how the NDEF entries are encoded and decoded. h Write a single byte to EEPROM The format is “haaaadd” where aaaa is a 16-bit address and dd is 8-bit data in hexadecimal format. o Opens a security session using the default ‘00000000’ password This is needed to permit command “l” to work. s Dump system memory and dynamic registers You would only use this if you were interested in the advanced features of the chip. l Modify the RF lock bits “l0” clears the lock bits and allows RF writes to EEPROM. “l3” forbids RF writes to EEPROM, so the contents can only be modified via I2C. Silicon Chip Australia's electronics magazine the EEPROM size in kilobits; the ST25DV04K part shown has 4 kilobits (512 bytes) of EEPROM. The “c” command interprets any NDEF data that is present. What is shown in Screen 3 is typical for a tag with a single URI entry, in this case, a link to the Silicon Chip website. Screen 4 shows a raw dump of the EEPROM contents in both ASCII (at left) and hexadecimal (at right). The link text is visible, preceded by some header data. You don’t need to know the header formats, as the library can generate them. The minimal steps for creating a custom tag start with the “e” command to erase the tag contents if it is not blank. While the chips start out empty, the library depends on the appropriate capability container entry existing, which is also added by the “e” command. Follow that with one of the “w” commands to write an appropriate NDEF entry. The “wt” (text) and “wu” (URI) options prompt for a single entry to be written to the tag. The “ww” command asks for the WiFi name (SSID), password, authentication and encryption types. The two MIME commands, “wm” and “wb”, allow a MIME type to be specified, with the file contents following. The “wm” option can handle text input, including control codes like CR (carriage return) and TAB. Press Ctrl-D or Ctrl-Z (end-of-file) to complete these entries; Ctrl-C or Escape can be used to cancel. The “wb” command expects bytes to be entered as pairs of hexadecimal digits. Single hexadecimal digits can be entered if a space separates them. The same Ctrl-D or Ctrl-Z sequence completes the file. We often use the HxD hex editor on Windows to view files in hexadecimal format. This program also allows the hexadecimal data to be copied and pasted directly into the “wb” command. However, you should be careful only to paste small amounts of data at a time so that the terminal and Pico can keep up with processing the data. After entering the data, confirm the write and see that the data is written correctly. At this stage, the Tag should register if held near an NFC reader such as a smartphone. Most phones should process URIs, WiFi handover records and vCard files without needing extra apps. siliconchip.com.au If you have trouble, ensure your mobile phone has NFC (not all do!), and it is turned on in the settings. Most newer phones should allow you to search your settings; typing “nfc” should be sufficient to find the right one. If you wish to lock the Tag so that it cannot be edited by someone accessing it via its RF interface, use the “o” command to open a security session. There is a default password consisting of eight zero bytes, which is assumed to be unchanged. Finally, use the “l3” command to set the write permissions to ‘never allow RF to write’. This won’t change the I2C permissions, so you can continue to edit the Tag content without unlocking the Tag for RF writes. Unlocking for RF writes is done with the “l0” command. d Area 1 RF access lock bits are set Memory is 512 bytes. 0 1 2 3 0000 .<at><at>......U.silic E1 40 40 00 0010 onchip.com.au... 6F 6E 63 68 0020 ................ 00 00 00 00 . . . 0130 ................ 00 00 00 00 to 3;read always, write never allowed. 4 5 6 7 8 9 A B C D E F 03 17 D1 01 13 55 04 73 69 6C 69 63 69 70 2E 63 6F 6D 2E 61 75 FE FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Screen 4: a raw dump of the tag chip’s EEPROM can be handy for exploring the layout of the NDEF card structure. You can make out the URI content as raw text. ◀ Screen 5: the tabs on the ST25 NFC Tap app allow you to view and edit the tags and their NDEF contents. This app might be all you need to program tags. Apps We’ll look at a couple of Android apps to read and write to these Tags. At the time of writing, it appears that there are iOS versions of these apps, which we expect to be fairly similar, although we haven’t tried them. The first is ST Microelectronics’ “ST25 NFC Tap” app, which is clearly targeted to work with this range of chips. You should, of course, ensure that your mobile phone supports NFC and that it is turned on. This app allows you to do many of the things that the Arduino Programming Rig can do, although we found it occasionally crashed if the card was moved while reading or writing. Screen 1 shows a typical overview. The NDEF and CC FILE tabs allow the NDEF data to be viewed and edited, while the MEMORY tab allows the EEPROM to be directly viewed (similar to using the “d” command in the Programming Rig). Screen 5 shows the NDEF tab. You can use the button at bottom right (cut off in the screen grab shown) to create a new NDEF record, while one of the buttons at top right allows NDEF records to be cloned. If you haven’t built the Arduino programming rig, cloning is probably the easiest way to create multiple identical Tags. This app can add multiple NDEF records to a single Tag; Screen 6 shows some of the record types that can be added. SMS and email records are specific types of URI records. An SMS record has the format “sms:(phone number)?body=(message siliconchip.com.au Screen 6: the ST25 NFC Tap app can create various NDEF record types, as shown here. There is also a tab that allows the EEPROM to be directly edited. ◀ Australia's electronics magazine July 2023  41 Parts List – Dynamic NFC Tag 1 22 × 31mm double-sided PCB coded 06101231 OR 1 86 × 54mm double-sided PCB coded 06101232 1 ST25DV04K dynamic NFC tag chip, SOIC-8 (IC1) ● 2 4.7kW ⅛W M3216/1206 SMD resistor 1 100nF 50V X7R M3216/1206 ceramic ‘chip’ capacitor Programming jig parts 1 Raspberry Pi Pico (or Pico W) microcontroller board programmed with 0610123A.UF2 1 4-way male pin header, 2.54mm pitch ● there are other options, listed in the introduction of the article Dynamic NFC Tag Kit: we will be selling kits containing one of the two types of PCB, the tag IC and three passive components. SC6747 ($5) is for the kit which includes the smaller PCB SC6748 ($7.50) is for the kit which includes the larger PCB. Screen 7: the NXP TagInfo app can read tags and also decode NDEF messages and records. There is also an NXP TagWriter app that we have not tried. It could possibly be used to customise Tags too. text)”, with the bracketed items replaced by the phone number and message text (without brackets), respectively. You could also use the Arduino Programming Rig to create such a record as a URI type. An email record has a similar format, using the “mailto:” URI type (type 6) followed by an email address. It can optionally have a “?subject=...” field as well as body text (“&body=...”). Most mobile phones that we tested were able to handle all those records. We’re familiar with the NXP TagInfo app, as this can also read ISO14443A cards, such as those that can be read by PN532-based modules. Screen 7 shows a scan of a Tag containing a URI NDEF record using the TagInfo app. Since it can read and interpret NDEF messages, this can be used to validate that Tags have been written correctly by either the Arduino Programming Rig or the ST25 app. Conclusion NFC tags are common these days, and we think many readers will relish the opportunity to create their own smart business cards and custom Tags. We are investigating other ways to use these Tags. One idea is to use them to configure projects wirelessly without needing screens, displays or buttons to be built into the project. That could save quite a bit of time and money. In such a project, the Tag circuit described here becomes part of the project, with IC1 accessed over an I2C bus. The project can read (or write) its configuration to a text NDEF record on the Tag, which a suitably equipped smartphone or tablet can then view or edit. There are undoubtedly other excellent applications for these Dynamic Tags, and we look forward to thinking of new ways to use them in future SC projects. We soldered a four-way header to the GP26, GP27, AGND and GP28 pins of the Pico. The holes in the Tag PCBs are staggered slightly to make good enough contact for programming without soldering. Check that the orientation and pin connections are correct, so you don’t destroy the chip or the Pico. 42 Silicon Chip Australia's electronics magazine siliconchip.com.au