How can I connect Puck2.js to PN532 NFC/RFID ?

Posted on
  • Hi,
    I have a PuckJS 2 with 2v06 and a PN532 NFC v3 module from Elechouse, connected as follows:

    Puck.js_D28 to PN532_SCL,
    Puck.js_D29 to PN532_SDA,
    Puck.js_3V to PN532_VCC,
    Puck.js_GND to PN532_GND,

    Puck.js works fine and the red LED on the PN532 is also active.
    Actually I use the Espruino Web Ide Tool, so:
    1) I wrote the require("PN532"); on the right side;
    2) sent with "Send to Espruino button" - the loading was OK (screen refreshed);
    3) I tried to run it as described in the example for PN532 ( scl:B6 and sda:B6 changed to D28 and D29 );

    I see now the following on the web console:
    ...
    ...
    2v06 (c) 2019 G.Williams

    I2C1.setup({scl:28, sda:29});
    =undefined
    var nfc = require("PN532").connect(I2C1);
    ={
    i2c: I2C1
    }
    print(nfc.getVersion());
    Uncaught InternalError: I2C Write Error 33281
    at line 1 col 172
    ...sh(0);this.i2c.writeTo(36,b);b=this.i2c.readFrom(36,6);b[4]&...

                              ^
    

    in function "cmd" called from line 1 col 22
    var a=this.cmd([2],12);return{chip:"PN5"+a[2].toString(16),f...

                     ^
    

    in function "getVersion" called from line 1 col 22
    print(nfc.getVersion());

                     ^
    

    ...
    ...

    Can somebody help me, what could be the problem?
    Thank you!


    2 Attachments

    • 2020-07-24 16_56_48-PN532 NFC_RFID module - Espruino.png
    • 2020-07-24 16_57_19-Espruino Web IDE.png
  • What you're doing sounds good. You could try software I2C just in case?

    var i2c = new I2C();
    i2c.setup({scl:D28, sda:D29});
    var nfc = require("PN532").connect(i2c);
    

    That'll be able to use the internal pullup resistors which may work if the PN532 doesn't have any.

    Another issue could be the voltage. IIRC the PN532 needs quite a bit of power to get its coils working - it's possible that the 3v CR2032 doesn't supply enough power.

    In that case, you'd just have to:

    • Leave the VCCs connected
    • remove the CR2032
    • add an external 3.3v supply to VCC
  • OK,thank you!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

How can I connect Puck2.js to PN532 NFC/RFID ?

Posted by Avatar for user67655 @user67655

Actions