element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum use "explorenfc-basic" in python (raspberry pi, jessie, explore-nfc-ww)
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 14 replies
  • Answers 3 answers
  • Subscribers 677 subscribers
  • Views 1977 views
  • Users 0 members are here
Related

use "explorenfc-basic" in python (raspberry pi, jessie, explore-nfc-ww)

Former Member
Former Member over 9 years ago

Hello everybody!

 

I am new here and i have started with the programming of a Raspberry Pi a week ago and so please be gentle with my silly questions image.

 

I want to write a python script, that writes an information on a nfc-tag. I am working with the Raspberry Pi2, Raspian Jessie and the NFC-shield Explore-NFC-WW V1.6.

 

I want to write at a nfc tag with the command "explorenfc-basic -w <text> -t URI". After the writing i want to read out the <text> to see that the information is really written on the text. With the command "explorenfc-basic" i got the whole information from the tag, but i only want the <text>.

So my first question: is it possible that i only get the information of the tag that i want? In my case the <text>. image

 

I tried to do it with Popen(["explorenfc-basic -w %s -t URI -l d" %(<TEXT>)],stdin=PIPE,stdout=PIPE,stderr=PIPE,close_fds=True,shell=True) but this is not working very well. The process is call up to often and the tag will not be written.

So my second question: can i kill the process when the tag is written? How can i do that? image

 

Or is there a better way to write and read the information and to compare the written and readed text (for safety reasons)? image

I can not find a solution that fits to my problem at the internet.

 

I am thankful for every answer or advice image

  • Sign in to reply
  • Cancel
  • clem57
    0 clem57 over 9 years ago
    1. Use "explorenfc-basic > file.txt" to write the output to any file you want.
    2. Use python read file to looking at <text> you want.
    3. Write proper <text>.
    4. Clem
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to clem57

    Hello!

     

    Thank you for the answer it helped me a lot.

     

    Do you also know how to kill the explorenfc-basic command?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 9 years ago in reply to Former Member

    "pkill -9 explorenfc-basic"

    You need to install pkill software. See https://www.digitalocean.com/community/tutorials/how-to-use-ps-kill-and-nice-to-manage-processes-in-linux for details.

    Clem

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to clem57

    I have a big problem with the combination of writing and reading...

     

    I don't get it that i write the tag every time and after that to read it out to check that the written text on the tag is the same as it should be.

    Sometimes the writing on the tag is fine, but then is the reading not fine and so on. But most of the time it is not working anyway. image

     

    The code what i have written:

     

            writeTag = Popen(["explorenfc-basic -w %s -t URI -l d" %(text that i want to write on the tag) ],stdin=PIPE,stdout=PIPE,stderr=PIPE,shell=True)

            writeTag.poll()

            Popen(["pkill -9 (explorenfc-basic)"],shell=True)

            print("Tag wurde erfolgreich beschrieben")

     

            nfcTag = Popen(["explorenfc-basic > nfc.txt"],stdin=PIPE,stdout=PIPE,stderr=PIPE,shell=True)

            nfcTag.poll()

     

            file = open('nfc.txt','r')

            tag = file.read()

            file.close()

            print(tag)

     

    What can I improve that it works fine? image

    To remember, I am a totally beginner with python and Raspberry

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to Former Member

    Like i have written before I have the problem with the combination of writing and reading.

     

    I want to write the tag and in the next line I want to read out the tag to compare the written string with the string which is really on the tag (safety reasons).

    I established that when I write "writeTag.wait()"  and "nfcTag.wait()" instead of .poll it is no problem to write and read the tag. My problem is that i have to remove the tag from the NXP-shield every time to write or to read the tag. First I thought that i can fix that with killing the process, but it is not like that.

    I have tried a few thinks but the best result was, that the tag was written and when I wanted to read the tag in the next step i got the information which was on the tag before.

     

    So my question: Is it possible without removing the tag of the NXP-shield to write the tag and straight after this to read the tag?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 9 years ago in reply to Former Member

    Hi,

    Are you using nxppy? Please read  http://cache.nxp.com/documents/application_note/AN11480.pdf?fpsp=1&WT_TYPE=Application%20Notes&WT_VENDOR=FREESCALE&WT_FI…  and check reference 9 for download. Or https://github.com/svvitale/nxppy

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 9 years ago in reply to clem57

    EXPLORE-NFC - Exclusive from element14|NXP

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to clem57

    Hello Clem,

     

    No I am not using nxppy. I want to keep the program as simple as possible and the nxppy looks more complicated to me than the explorenfc-basic command. Or do I need the nxppy for my task?

     

    With the writeTag.wait() and readTag.wait() I get the behaviour that I want, except what I have written before, I don't want to remove every time my tag from the shield (for my application it is not sustainable to do this the whole time).

    My code looks like this now:

    ###############################

    def writeNFCTag(Text):

            while True:

                try:

                    writeTag = Popen(["explorenfc-basic -w '%s' -t URI -l d" %(Text)], shell=True)

                    #writeTag.wait()

                    print("Write at tag: success!")

                    break

                except:

                    print("Write at tag: FAIL!")

                    pass

           

    def readNFCTag():

            while True:

                    try:

                            readTag = Popen(["explorenfc-basic > /home/pi/Desktop/nfc.txt"], shell = True)

                            #readTag.wait()

                            print("Write in file: Success!")

                            break

                    except:

                            print("Write in file: FAIL!")

                            pass

     

     

    x = J

    while x == J or x == j:

         Text = <text that should be written on the tag>

         writeNFCTag(Text)

         readNFCTag()

         x = input("Again? ")

    ###############################

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to Former Member

    Oh and I have installed the .deb files of Neard EXPLORE-NFC "SW282715"

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 9 years ago in reply to Former Member

    Assuming you use python, nxppy would be easier and clear for anyone to understand. It wraps the api.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube