-->
Page 1 of 3

Help with ESP8266-01, NFC Module V3, i2c

PostPosted: Wed May 25, 2016 8:31 am
by Joe Job
Hi guys I haven't played with the wire library before and am not able to find any relevant docs of using ESP8266-01, NFC Module V3, i2c. I have the following snippets but am not receiving anything in serial when I scan a chip. I have the SDA connected to pin 0 of the ESP and scl to pin 2 then the following snippets, connecting to wifi is fine it is just the receiving data from the module that I am having issue with any advice anyone ? TIA



Code: Select allvoid setup() {
 
  Serial.begin(115200);
  delay(10);
  Wire.begin(0,2);
  Serial.println();
  Serial.println("System Initiating...");
 // REST OF CODE
}


and then in the loop:


Code: Select all   Wire.requestFrom(2, 2);
    Serial.print( Wire.read());


Have also tried the following in loop:

Code: Select all    Wire.requestFrom(2, 2);
    while(Wire.available()){
      int c = Wire.read();
      Serial.print(c);
    }


Any suggestions please.

Re: Help with ESP8266-01, NFC Module V3, i2c

PostPosted: Wed May 25, 2016 8:48 am
by martinayotte
What kind of I2C device you are trying to read from ?
Because the first parameter of requestFrom() is the address of the device, and I doubt the actual address is 2.
Also, some devices require some register address too, so maybe some beginTransmission() and endTransmission() are required.

Re: Help with ESP8266-01, NFC Module V3, i2c

PostPosted: Wed May 25, 2016 8:57 am
by Joe Job
Hi mate thanks for the reply, it is this module (the orange one): Elechouse PN532 V3 module.

https://www.youtube.com/watch?v=DKA8aTR8nDs

Just going off what I have found about reading from a module but haven't been able to implement, the sda out of the module is connected to pin 0 of esp and scl is connected to pin 2

have tried request from 0 and 2 and no activity, do you know of any examples of reading nfc via i2c directly with an esp8266 01, I know it is do able as in the github someone mentioned they had done it but cant get this work.

Re: Help with ESP8266-01, NFC Module V3, i2c

PostPosted: Wed May 25, 2016 10:16 am
by martinayotte
As I said, the first parameter is the I2C address of the module, so doing requestFrom(2, 2) or requestFrom(0, 2) is not correct, since the I2C address of the device is 0x48 according to the specs, it should be requestFrom(0x48, 2) to read 2 bytes.
But this requestFrom() is not enough to get the ID, there is a whole protocol defined to access/control several registers.
Googling reveal that Adafruit have a library, although rather complex, maybe it will work with your board.

https://github.com/adafruit/Adafruit-PN532/

EDIT : I've the one from the manufacturer, it is quite simpler :

https://github.com/elechouse/PN532