Jump to content
Ultimaker Community of 3D Printing Experts
  • Sign Up
xperiment

Read/Write NFC Tags

Recommended Posts

Posted · Read/Write NFC Tags

Does anyone knows if it´s possible to create own nfc tags for the UM3? The tags from the UM spools can be read from my Samsung S7, but the data format is unknown.

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

Yes, the tags can be read and written. What do you want to achieve?

We wanted to implement ndef records, but we made a mistake causing no other app to understand the data

  • Like 1

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

hiya,

I wouldn't mind to understand this subject.

Being able to re-write these with data of a material that isn't ultimaker's like Ninja flex or if you prefer another brand of material or simply because you want to use a colour that UM can't supply. transfer the filament over to a UM spool and reset the data on the spool.

something like that anyways

bex

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

It would be a cool addition to the UM3 app to be able to read the tags. I have unmarked spools so can't confirm what the material unless I load it into the printer.

But I would also like to write my own rags somehow.

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

The tags only contain a material identifier, the actual data about the material is contained with the material database (in Cura and on the printer). So you cannot suddenly add ninjaflex without those being in the database.

Share this post


Link to post
Share on other sites
Posted (edited) · Read/Write NFC Tags

The tags only contain a material identifier, the actual data about the material is contained with the material database (in Cura and on the printer). So you cannot suddenly add ninjaflex without those being in the database.

 

But what if you could clone the TPU and *Name* it as NinjaFlex. Same with cloning say a CPE+ or nylon but naming it PETG.

In a way, that is what we are doing now....choose a profile in Cura that matches closely to what we want to start with and then choose the generic variant on the machine.

Although not a technically elegant solution, it could save a few steps for users and prevent the need to remember which variant you are starting from.

Edited by Guest

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

I bought a few spools on special of the non NFC ulitmaker filament and would love to be able to program my own tags with the material ID. I dumped one of the tags and it shows an NTAG216, but the memory space appears to only be less than half used. 

 

Has anyone had any luck creating their own identifier tags? I tried to SSH into my S5 to try and find the database for the materials but came up with nothing. (I attached my dump of my spool of Black Tough PLA if that helps)

04-7A-95-92-66-5A-80_2019-07-13 19-46-05_taginfo_scan.log

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags
5 hours ago, Rainbowdashboard said:

I tried to SSH into my S5 to try and find the database for the materials but came up with nothing.

 

One can retrieve a list of materials from the printer with:

http://xxx.xxx.xxx.xxx/cluster-api/v1/materials/

 

And all installed materials are available in Cura, in the program/AppImage folder (".../resources/materials") and in the configuration folder (".../materials" - in addition and optional)

 

AFAIK the GUID is the most important thing (if not the only one) that is used for comparison between gcode file and NFC data.

 

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

Boom! That was the answer. Thank you for this insight. Now I need to solve the the NDEF issue Daid mentioned above. Only done a cursory look into duplicating my tag without success, so I may attempt to write my own interface for the tags to write with my phone. 

Capture.PNG

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited) · Read/Write NFC Tags

@Daid This is now more important that the material station cannot accept anything other than one colour of each non ultimaker filament.

 

Even material alliance filaments cannot have more than one colour loaded into the material station.

Edited by Sassw

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

@Sassw please be aware that @Daid is not working anymore at Ultimaker - he still might follow a few topics but maybe not those clearly Ultimaker hardware-related.

Share this post


Link to post
Share on other sites
Posted (edited) · Read/Write NFC Tags

After adding some materials via the API you can now just load them as different types of material for now.

 

See the attached lock out due to not having break positions etc and then the result of using a more up to date xml.fdm_material with those fields.

 

Good news is that custom writes to the tags works and selects colour GUIDs as expected.

 

Ultimaker you should document the schema for the xml, there is a double entry for the U3 in most profiles.

 

 

IMG_20191015_135214.jpg

IMG_20191015_145451.jpg

Edited by Sassw

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

Which RFID reader/writer are you using? Did you find a source for the RFID tags? Thanks,

 

      Greg

 

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags
On 10/11/2019 at 12:50 PM, mhigginsmoy said:

Hey - Did you ever end up making your own interface for this? Would love to create my own tags and define them 

I ended up abandoning this a while ago. I hope to pick it up again now that I have a fancy pants Proxmark. 

Share this post


Link to post
Share on other sites
Posted (edited) · Read/Write NFC Tags

Even though the tags are not marked to contain NDEF records, the data stored in the NFC memory adhere to the standard. There are four records one of which contains the material UUID and two others storing the amount of material on the spool. The tasks of understanding the individual data structures and how to fill them in gets much easier consulting the relevant python code on the printer.

 

This way I managed to successfully write the UUID of a 3rd-party material to the tag of an empty spool and transfer the tag to a fresh spool of said material. I also managed to create a cura plugin for this material with both the generic and the vendor specific definitions, together with a set of profiles (which now need to be refined to meet their intent). This way, Cura uploaded the fdm_material file to the printer which now fully recognizes the material. We can even use it with the material station without any obvious restrictions.

 

However, I am still a bit uncertain as to how to tune in the material station related parameters. For starters, I used a fdm_material file of a material with similar properties, but I'd feel much more at ease if I knew the relevance of each parameter and which material properties I need to take into account. Is there any sort of documentation on this?

 

Another question is where we could source a small number of these circular tags, right now we don't have enough empty spools to live off recycled tags.

Edited by gandy
typo

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

Hello

I would like to use old spool chips or new NFC chips just to identify .. actually whatever, at least generic PLA but including color. I want to use NFC tools. Any advice if it is possible?

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

Bump!  I have a UM3 and am just finishing a spool of ultimaker PLA, would like to reuse this roll for another brand, the main reason is that the other brand spool is incompatible with the rear holder.

 

That means, I think, that I have to reset the material amount.  I don't know what hardware I need to write to this NFC tag or whether a UM3 can do that.  I have to think it can as it updates the material amount?

 

Thanks John

 

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

It would be great to:

1. add the new non-Ultimaker filament in Cura DB (es. Filamentum Vertigo Starlight, with all of its data).

2. obtaing the new material identifier from Cura db

3. write an NFC tag with this identifier.

 

Still unpossible?

Given I use so many different brands materials... I'd love such an (easy) solution!

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

@gmeardi If you can love the solution depends on how much you are willing to stretch 'easy', so here we go.

 

Before working with the Ultimaker S5, I've never really put my mind to NFC technology, so there are very probably some gaps in my understanding. Most of what I've learned, I've deduced from comparing the data from different spools and with different amounts of remaining material. The rest I could fill in reading the relevant python code of the firmware after ssh-ing into the printer.

 

As @Daid pointed out earlier, Ultimaker tried to implement NDEF records. According to the NFCForum-TS-Type-2-Tag standard, NDEF records need to be embedded in a NDEF Message TLV, which is missing on the Ultimaker NFC tags. That's why NFC apps report there are no NDEF records on the tags. Other than that though, the data adheres to the NDEF standard, so I was able to use the python package ndeflib to add custom record types to decode and encode the tag data.

 

The code on https://gist.github.com/gandy92/a7eef12009045f7b3fc01d778c3b79a7 demonstrates just that. Based on this code, you can decode the data from your spools to check how much material is left (usually given in mg) or plug in the UUID from your custom material profile and the amount of material on the spool and create the data to write to your NFC tag. I will not elaborate on how to actually write the data. This depends heavily on your tag writer and OS and would by far exceed the scope of this comment.

 

For our spools, we carefully extract the NFC tags from empty spool and transfer them to the third-party spools. Make sure to always write complete blocks to the tag: There are two stat-records on the tag, apparently with usage data at different times. My first guess was this is used for redundancy in case a stat-record gets corrupted, e.g. by the printer loosing power during a write operation. In my first writing attempts however, I failed to write the last block, rendering the whole tag unreadable for the UM-S5. I'm not sure if this is due to design or simply a bug in the firmware, but if any of the two stat-records show the wrong checksum, the whole spool is simply ignored by the printer.

 

In Cura, I've learned it is important to actually have two filament profiles:

  • {brand}_{material}.xml.fdm_material, where brand and color are set to "Generic" (in the profile, not in the filename)
  • {brand}_{material}_{color}.xml.fdm_material fills in the actual values and additionally provides the amount of material

Say you have material M of brand B in color C, you want two files, B_M.xml.material and B_M_C.xml.material. For a new brand and material combination, I suggest to select an existing material in Cura as template: When creating a new custom profile, Cura will pick a new UUID for it. Then add one profile for each color, each with a different UUID. Use these UUIDs for the tags. You will need to use a text editor to adjust the profiles. Later, Cura will sync the profiles with the printer, so there is no need to upload them yourself. Just make sure to increase the profile version number and never again change the UUID.

 

There's one caveat however, when using the material station: The profile tells the printer how to load/unload the filament, but so far I couldn't find documentation on the parameters, so maybe using the profile of a material with similar properties would be a good idea. Being extra careful and standing by the printer is another good idea.

 

For perfect integration in Cura, it would be great having intent profiles for the material, which we are still struggling to figure out how to create. If anyone managed, I'll be happy for tips or suggestions.

 

  • Like 2

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

@gandy thanks for the wonderful explanation.

I'm not an NFC expert, but if I can find some time, I'll try going through (and in case let you know)!

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

@gmeardi good luck with that. I guess you don't really need to be an expert, I certainly am not. A little python knowledge can surely help and you definitely need some nfc reader/writer hardware. I'm using a ACR122U-A9 with a raspberry pi for that purpose. Got it working out of the box with pscd:

sudo apt-get install pcscd pcsc-tools
echo 'SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="072f", ATTRS{idProduct}=="2200", GROUP="plugdev"' | sudo tee -a /etc/udev/rules.d/nfcdev.rules

idVendor and idProduct may be different and both udev and pcscd may have to be restarted before it works.

 

For actually writing the data to the tag, I'm using something along the lines of this short script:

https://gist.github.com/gandy92/1f9df107b049e12173657e28e20dc56e

 

I'll be happy to learn how this turned out for you.

  • Like 1

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

I'm starting to look into this now that we have multiple S5s with material stations.

 

Since the material station reads and writes to these chips, is there a way to do that ourselves using the material station?

 

I have tried a PUT request via the API to the material station using an empty spool that is currently loaded. I attempt to set the material remaining back to 1, but it never updates. I was hoping it would be that simple, but of course it's not. I do get a 200 response, but the number never updates.

Share this post


Link to post
Share on other sites
Posted · Read/Write NFC Tags

I'd be surprised if the NFC reader is actually exposed by any of the high level APIs or even the machine's dbus. My recommendation is to get one of those 20€ USB NFC readers and go with Python or whatever language you're comfortable with as long as it works with the reader.

I'd be happy to stand corrected, though, so if you find a way with the native NFC hardware, please share.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...