Sending TEXT from MIT App with NFC to PN532 and Arduino Mega

Hello.
For start i wanna say that is the first time when i use MIT App Inventor.
I want(if its possible) to send a string(that i have written in the text box) with NFC to Arduino Mega and then work with the string(I want to compare it with a constant in my code, and if they are the same to send an impulse from an arduino port). My NFC reader is PN532 without a shield.
Can somebody, plese, explain how to do it, or to show me some documentantion or some code?
Thanks in advance.

Hello Mihai

Well, I have never used the NFC function and I don't have the hardware here to set up a test. However, the App Inventor function looks simple (perhaps deceptively).
http://ai2.appinventor.mit.edu/reference/components/sensors.html#NearField

The App Inventor NFC function can only read or write text, which should be compatible with PN532.

We have to assume that you have connected it correctly and coded the Sketch correctly. :thinking: I notice that tutorials on the Arduino side of things do use a Shield and an NFC library for the Shield.

Can you attach a PDF here of your NFC Reader Specification?
There is, for example, a limit to the byte size of the text (about 16 bytes). Also need to know the text format (e.g. ASCII, UTF-8, UTF-16). I suspect only ASCII can be used and that the App Inventor function uses ASCII, but App Inventor is UTF-8 by default.

You can try this project (not tested):
NFC_Text2Arduino.aia (3.6 KB)

1 Like

Thanks for your fast reply.
The PN532 is connected correctly and i manage to read the UID of my phone and some card with the example in his library. What i didnt manage to do was to read strings. Im gonna try your app and im gonna leave a link with PN532 datasheet: https://www.generationrobots.com/media/Shield%20NFC%20V2/PN532.pdf
And this is a photo with my module,its set in I2C mode:

Another problem, i manage to read UID from my card, but i didnt find a code for PN532 to read a string.
I know im asking for a lot of thing, but i just cand wrap my head around hot to link my app with PN532

Hi again, do you have a link to the Library you are using?

1 Like

For the first time i tried the Adafruit PN532 library whom i downlaoded from arduino IDE. With this one i managed to read the ID of my phone, and some UID from some cards.
Then i tried this one: https://github.com/Seeed-Studio/PN532/tree/master
Then this one: https://github.com/don/NDEF
For the last 2 libraries i didn't understand them very well.
The problem is that at this point i have a little chaos in my head.
If you want to comunicate over a faster chanel(like facebook or something like that) im happy to post the complete solution(if theres one) here on the forum.
Thanks for your patience.

:upside_down_face:

The only reason communication is not fast here is that we are helping several people at the same time.

I'm going to be mostly away from my PC for the next four days, but I will take a look at the libs you found on github. Usually, Adafruit libs are intended for their hardware only, which is generally a bit different to most other kit.

.... The manufacturer of your module is NXP? They might well have their own lib.
https://www.nxp.com/ They have a lot of similar products so you need to search for your exact model number. They also have a forum.

Actually, it does seem that most roads lead to the Adafruit lib. The Sketches use regular Serial comms to read.

I found the same things
These are the examples from the adafruit library:image
But i do not know if its something here that can help me get a string or other values that i insert from my phone with an app like the one you posted above.

Hi Mihai

Their lib is designed for their hardware, so if it does not work for other hardware we should not be surprised. Looks like the Sketch ntag2xx_read is worth playing with.

this project doesn't work well. Some wrong happened when i try to ues this app。Could tell me how to solve it? Thank you very much.

Hello zzx1234567

Welcome to the forum. Please start your own new topic, and tell us the details about your project, what it's for, what it does, what doesn't work well, what is it that goes wrong, what you have tried.