Native NFC Support

We’re excited about the imminent release of Particle Mesh and keen to find out more details on NFC support.

The available info is very limited, we can see that NFC-A tag (Tag Type 1, 2 & 4) is part of Nordic Semiconductor nRF52840 and listed in the specs for all Mesh devices, but that’s about all we know.

Does anyone have any info on:

  • whether NFC will be supported by Particle’s firmware on launch?
  • Is there an antenna for it or an onboard connector (or solder pads)

With Redbear and Particle joining forces, seeing NFC products like this gives me hope.

Thanks in advance!

The mesh devices have the necessary components to support NFC.

The initial release of Device OS will not support NFC-based configuration or a public API for NFC, though it is something that could be added later.

Since the system firmware will be open source you should be able to use NFC with a custom system firmware build until then.

Thanks for the info @rickkas7

We will be using the devices in production, so will go down the route of custom system firmware.

It seems that Nordic Semiconductor have an NFC library that is likely to save us a lot of time.
http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk%2Fdita%2Fsdk%2Fnrf5_sdk.html

Once we get our hands on the hardware, we’ll look to get our hands dirty with integrating this library into custom system firmware. If only we could get access to some hardware earlier than phase 2 :slight_smile:

Thanks @rickkas7

1 Like

I was wondering if anyone has made any developments here now we have some of the units in the wild? Thanks in advance,

@Jak message me if you’re still looking for some mesh hardware, I may be able to lend one of mine to help with the process. NFC would be a good addition to our product line.

I hate to bump a thread with a reply that doesn’t really contribute to the conversation, but I also hate having NFC capable hardware without being able to use this functionality.

So at the risk of myself doing that which I also hate (also considering that it has been two weeks since the last update in this thread), I find myself ready to hit “Reply” now and ask forgiveness later…

Unfortunately, no progress on NFC. Like mentioned by Rick, you should be able to use it with a custom system firmware build. As for API support; stability and reliability has high priority for the team. Only after that’s satisfactory, new features will be worked on.

We actually have already started some work on NFC support. There is a ready to merge PR implementing the HAL part (https://github.com/particle-iot/firmware/pull/1606) with an example application. Wiring support is still WIP and will come after we switch our focus from the stability improvements.

@cbrightly, if you are ok with locally building out of that branch, you could try it out.

7 Likes

@avtolstoy Thanks for your contribution and post. The example application is very similar to my needs so it helps me plan accordingly and wait patiently while the higher priority stability issues are worked out. Although NFC is a blocker for my application, stability is a blocker for all of us so I am happy to hear about the priorities.

Step #2 says Connect NFC antenna to Xenon. Would you help me understand where I could get such an NFC antenna? I looked in bulk accessories and found other antennas, but no NFC.

As a cloud developer that dabbles in hardware, I appreciate any extra help I can get with the hardware.

1 Like

@schooltag, there is a particle NFC antenna being designed and if you have this: https://redbear.cc/product/retired/nfc-antenna.html it should work

Else, any other antenna with u.fl connector that you can get your hands on will work too!

Thanks @kennethlimcp. I’ll try it out.

The red bear NFC antenna isn’t available for purchase. I found SeeedStudio antenna that appears to be compatible. I ordered it from Amazon.

I’m using Taoglas NFC antennas for our prototypes. I chose them as Particle use the same brand for the Boron 3G antennas.

1 Like

So if I’m understanding this correctly, the Particle Mesh series of boards have support for NFC-A transmission and reception, in an active mode, instead of just a normal 13.56 MHz tag? And software and antenna support is currently in the works? Additionally, where will the NFC antenna need to be connected to, because I only see a WiFi connector and Thread/BLE connector in the spec sheet.

Thank you for your help.

The uFL connector for the NFC antenna is situated on the flip side of the board directly opposite the microUSB receptacle.

I could successfully make the branch at commit 5105417 and send the example blink LED application to a Xenon, however, the make failed when I tried to send the example app in the NFC Wiring API Test. The cpp file generated from the Workbench:

#include "application.h"
#line 1 "/Users/aaronroller/dev/projects/particle/nfc-test/src/nfc-demo.ino"
void nfc_event_handler(nfc_event_type_t type, nfc_event_t *event, void* ctx);
void setup();
void loop();
#line 1 "/Users/aaronroller/dev/projects/particle/nfc-test/src/nfc-demo.ino"
void nfc_event_handler(nfc_event_type_t type, nfc_event_t *event, void* ctx) {
    switch (type) {
        case NFC_EVENT_FIELD_ON:  digitalWrite(D7, 1); break;
        case NFC_EVENT_FIELD_OFF: digitalWrite(D7, 0); break;
        case NFC_EVENT_READ:      digitalWrite(D7, 0); break;
        default: break;
    }
}

void setup() {
    pinMode(D7, OUTPUT);
    digitalWrite(D7, 0);

    System.on(button_click, [](system_event_t ev, int clicks)->void {
        NFC.getNdefMessage()[0] = std::make_shared<TextRecord>("Update record - 1!", "en");
        NFC.getNdefMessage()[1] = std::make_shared<TextRecord>("Update record - 2!", "en");
        NFC.getNdefMessage()[2] = std::make_shared<TextRecord>("Update record - 3!", "en");
        NFC.getNdefMessage().addTextRecord("New record!", "en");

        NFC.stop();
        NFC.start(nfc_event_handler);
    });

    NFC.getNdefMessage().addTextRecord("Hello Particle!", "en");
    NFC.getNdefMessage().addUriRecord("particle.io", UriRecord::NFC_URI_HTTPS_WWW);
    NFC.getNdefMessage().addLauchAppRecord("no.nordicsemi.android.nrftoolbox");

    NFC.start(nfc_event_handler);
}

void loop() {

}

make clean all PLATFORM=xenon APPDIR=../../nfc-test/src/ -s program-dfu

...
Downloading to address = 0x00030000, size = 616144
Download	[=========================] 100%       616144 bytes
Download done.
File downloaded successfully
Creating module_user_memory.ld ...
../../../build/target/wiring/platform-14-m//libwiring.a(spark_wiring_nfc.o): In function `particle::NfcTagType2::stop()':
/device-os/wiring/src/spark_wiring_nfc.cpp:206: undefined reference to `hal_nfc_type2_stop_emulation()'
../../../build/target/wiring/platform-14-m//libwiring.a(spark_wiring_nfc.o): In function `particle::NfcTagType2::start(void (*)(nfc_event_type_t, nfc_event_t*, void*))':
/device-os/wiring/src/spark_wiring_nfc.cpp:188: undefined reference to `hal_nfc_type2_init()'
/device-os/wiring/src/spark_wiring_nfc.cpp:197: undefined reference to `hal_nfc_type2_set_payload(void const*, unsigned int)'
/device-os/wiring/src/spark_wiring_nfc.cpp:198: undefined reference to `hal_nfc_type2_set_callback(void (*)(nfc_event_type_t, nfc_event_t*, void*))'
/device-os/wiring/src/spark_wiring_nfc.cpp:199: undefined reference to `hal_nfc_type2_start_emulation()'
collect2: error: ld returned 1 exit status
make[1]: *** [/nfc-test/src//target/.elf] Error 1
make: *** [/device-os/modules/xenon/user-part/makefile] Error 2

I’m on a Macbook 10.13.3 if that matters.

The Xenon I flashed.

My story is to have the Xenon scan a Passive tag that has a URI with the UID as a parameter already encoded. I plan to read the URI that has the UID as a parameter which is handy because per the README the UID won’t be available from the NFC API.

If I can get basic NFC capabilities working, I will be an enthusiastic real world tester with 30 Argons and Xenons ready to go. I can deploy the branch code since my app is also Beta.

Thanks! Aaron

Particle is now offering NFC antennas on their store. I’ve ordered a couple to try in addition to the SeeedStudio anntenna that I already have.

antenna

@schooltag Thanks for reporting the issue, it has been fixed in the latest commit, please try again, if you got any issue or suggestions, feel free to let me know.

1 Like

@eugene0501 Thanks for the fix which got me past my compile issues and I was able to deploy the NFC example app for testing. Unfortunately, I was not able to cause an NFC event using my Google Pixel 2 Android + NXP Tag Writer App.

I did add some debug statements to confirm my app was working. Notice the button press is working, but the NFC triggered event is never published.

The code I used with the feature/hal/nfc device os branch.

#include "application.h"
#line 1 "/Users/aaronroller/dev/projects/particle/nfc-test/src/nfc-demo.ino"

void nfc_event_handler(nfc_event_type_t type, nfc_event_t *event, void* ctx);
void setup();
void loop();
#line 2 "/Users/aaronroller/dev/projects/particle/nfc-test/src/nfc-demo.ino"

bool nfc_event_received = false;

void nfc_event_handler(nfc_event_type_t type, nfc_event_t *event, void* ctx) {
    switch (type) {
        case NFC_EVENT_FIELD_ON:  digitalWrite(D7, 1); break;
        case NFC_EVENT_FIELD_OFF: digitalWrite(D7, 0); break;
        case NFC_EVENT_READ:      digitalWrite(D7, 0); break;
        default: break;
    }
    nfc_event_received = true;
}
bool button_pressed = false;

void setup() {
    pinMode(BATT, INPUT);
    pinMode(D7, OUTPUT);
    digitalWrite(D7, 0);

    System.on(button_click, [](system_event_t ev, int clicks)->void {
        NFC.getNdefMessage()[0] = std::make_shared<TextRecord>("Update record - 1!", "en");
        NFC.getNdefMessage()[1] = std::make_shared<TextRecord>("Update record - 2!", "en");
        NFC.getNdefMessage()[2] = std::make_shared<TextRecord>("Update record - 3!", "en");
        NFC.getNdefMessage().addTextRecord("New record!", "en");

        NFC.stop();
        NFC.start(nfc_event_handler);
        button_pressed = true;
    });

    NFC.getNdefMessage().addTextRecord("Hello Particle!", "en");
    NFC.getNdefMessage().addUriRecord("particle.io", UriRecord::NFC_URI_HTTPS_WWW);
    NFC.getNdefMessage().addLauchAppRecord("no.nordicsemi.android.nrftoolbox");

    NFC.start(nfc_event_handler);
}

unsigned long time_voltage_last_sent = 0;

void loop() {
    if(millis() - time_voltage_last_sent > 60000) {
        float voltage = analogRead(BATT) * 0.0011224;
        
        Particle.publish("voltage", String::format("%.2f",voltage), PRIVATE);
        time_voltage_last_sent = millis();
    }

    if(button_pressed){
        button_pressed = false;
        Particle.publish("NFC", "button pressed...NFC records updated", PRIVATE);
    }

    if(nfc_event_received){
        nfc_event_received = false;
        Particle.publish("NFC", "NFC Event Received", PRIVATE);
    }
}

I’m using a seeedstudio.com NFC antenna hooked up to the only connector on the Xenon. I’ve already some Particle Antennas so I can try a different antenna.

Any other suggestions to try?

Thanks.

@schooltag Please try to change to Particle Antenna, the connector is on the back of the Xenon board, I tested NFC by using NFC Reader application on Android.