Silicon ChipDynamic NFC Tag - July 2024 SILICON CHIP
  1. Contents
  2. Subscriptions
  3. Back Issues
  4. Publisher's Letter: We’ve come a long way
  5. Feature: Techno Talk by Max the Magnificent
  6. Feature: The Fox Report by Barry Fox
  7. Feature: Net Work by Alan Winstanley
  8. Project: Pi Pico-based Thermal Camera by Kenneth Horton
  9. Project: Dynamic NFC Tag by Tim Blythman
  10. Project: Reciprocal Frequency Counter by Charles Kosina
  11. Feature: Circuit Surgery by Ian Bell
  12. Feature: Audio Out by Jake Rothman
  13. Feature: Max’s Cool Beans by Max the Magnificent
  14. Feature: Teach-In 2024 – Learn electronics with the ESP32 by Mike Tooley
  15. PartShop
  16. Market Centre
  17. Back Issues

This is only a preview of the July 2024 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Articles in this series:
  • The Fox Report (July 2024)
  • The Fox Report (September 2024)
  • The Fox Report (October 2024)
  • The Fox Report (November 2024)
  • The Fox Report (December 2024)
  • The Fox Report (January 2025)
  • The Fox Report (February 2025)
  • The Fox Report (March 2025)
  • The Fox Report (April 2025)
  • The Fox Report (May 2025)
Articles in this series:
  • Win a Microchip Explorer 8 Development Kit (April 2024)
  • Net Work (May 2024)
  • Net Work (June 2024)
  • Net Work (July 2024)
  • Net Work (August 2024)
  • Net Work (September 2024)
  • Net Work (October 2024)
  • Net Work (November 2024)
  • Net Work (December 2024)
  • Net Work (January 2025)
  • Net Work (February 2025)
  • Net Work (March 2025)
  • Net Work (April 2025)
Articles in this series:
  • Circuit Surgery (April 2024)
  • STEWART OF READING (April 2024)
  • Circuit Surgery (May 2024)
  • Circuit Surgery (June 2024)
  • Circuit Surgery (July 2024)
  • Circuit Surgery (August 2024)
  • Circuit Surgery (September 2024)
  • Circuit Surgery (October 2024)
  • Circuit Surgery (November 2024)
  • Circuit Surgery (December 2024)
  • Circuit Surgery (January 2025)
  • Circuit Surgery (February 2025)
  • Circuit Surgery (March 2025)
  • Circuit Surgery (April 2025)
  • Circuit Surgery (May 2025)
  • Circuit Surgery (June 2025)
Articles in this series:
  • Audio Out (January 2024)
  • Audio Out (February 2024)
  • AUDIO OUT (April 2024)
  • Audio Out (May 2024)
  • Audio Out (June 2024)
  • Audio Out (July 2024)
  • Audio Out (August 2024)
  • Audio Out (September 2024)
  • Audio Out (October 2024)
  • Audio Out (March 2025)
  • Audio Out (April 2025)
  • Audio Out (May 2025)
  • Audio Out (June 2025)
Articles in this series:
  • Max’s Cool Beans (April 2024)
  • Max’s Cool Beans (May 2024)
  • Max’s Cool Beans (June 2024)
  • Max’s Cool Beans (July 2024)
  • Max’s Cool Beans (August 2024)
  • Max’s Cool Beans (September 2024)
  • Max’s Cool Beans (October 2024)
  • Max’s Cool Beans (November 2024)
  • Max’s Cool Beans (December 2024)
Articles in this series:
  • Teach-In 2024 (April 2024)
  • Teach-In 2024 (May 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (June 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (July 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (August 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (September 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (October 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (November 2024)
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) − Wi-Fi 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 create your own ‘dynamic’ NFC tags using a handful of components. ‘Dynamic’ means the tag’s contents can be easily reprogrammed. While you might be familiar with how easily NFC allows money to 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. 22 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) 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 2019. That article briefly explained the history and technology behind NFC. Despite being based on NFC technology, the shield from the 2019 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 (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, Practical Electronics | July | 2024 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 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 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. 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 does allow multiple 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. 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. Practical Electronics | July | 2024 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 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 Wi-Fi 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 vCards and URIs mentioned earlier, it can also create simple text file records 23 and Wi-Fi ‘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 Wi-Fi 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 Wi-Fi 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, Wi-Fi 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. 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. 24 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). We’ll also show how to create Tags using various antennas, followed by using several apps to interact directly 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 Fig.3 and Fig.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 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 opposite 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. The photos to its 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 Practical Electronics | July | 2024 ◀ 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. 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 Fig.3 and Fig.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 – both are available from the PE PCB Service. 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 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. Practical Electronics | July | 2024 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. 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 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 Fig.3 and Fig.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. 25 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. 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 to the drive that appears; it’s typically named ‘RPI-RP2’. The file is available from the July 2024 page of the PE website: https://bit.ly/pe-downloads 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 coexist, but note that 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. 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. 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. 26 Practical Electronics | July | 2024 Programming Tags After connecting to the Pico’s virtual serial port with the terminal program, you should see the main menu (see 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 of the commands consists of one or two letters (followed by Enter), after which you may be prompted for additional parameters depending on the specific 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 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 Wi-Fi 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. Practical Electronics | July | 2024 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. d Area 1 RF access lock bits are set to 3;read always, write never allowed. Memory is 512 bytes. 0 1 2 3 4 5 6 7 8 9 A B C D E F 0000 .<at><at>......U.silic E1 40 40 00 03 17 D1 01 13 55 04 73 69 6C 69 63 0010 onchip.com.au... 6F 6E 63 68 69 70 2E 63 6F 6D 2E 61 75 FE FF FF 0020 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 . . . 0130 ................ 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. Parts List – Dynamic NFC Tag 1 22 × 31mm double-sided PCB coded 06101231 OR 1 86 × 54mm double-sided PCB coded 06101232 from the PE PCB Service 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 27 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’) 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. 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, Wi-Fi handover records and vCard files without needing extra apps. 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. 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. 28 a Decode NDEF messages from EEPROM. Use 1-4 for a specific record (eg, ‘a1’) Uses custom code to perform a more detailed analysis than the ‘r’ command. 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 Wi-Fi 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 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. 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 Practical Electronics | July | 2024 (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 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. 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. 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. Practical Electronics | July | 2024 Screen 6: the ST25 NFC Tap app can create various NDEF record types, as shown here. There is also a tab allowing the EEPROM to be directly edited. 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 projects. Reproduced by arrangement with SILICON CHIP magazine 2024. www.siliconchip.com.au 29