ESPboy-edu / ESPboy_RFID_NFC

ESPboy RFID-NFC module for read/write/store/emulate RFID and NFC tags
21 stars 0 forks source link

Connection MCP23017 #1

Open wfhstudio opened 1 year ago

wfhstudio commented 1 year ago

Hi Esp Boy. Do you wiring ESP8266 and MCP23017 ? Thanks from Indonesia

ESPboy-edu commented 1 year ago

Hello! You can check ESPboy schematic on the www.espboy.com

wfhstudio commented 1 year ago

Thanks. I did connect all the wires and I could not move the cursor, but when I took out NFC (PN532) and It worked fine. It seems D1 and D2 are also used for PN532 and MCP23017, it could be resulting the error? I am stack at the moment. Anyway, good project.

Jbrimbelibap commented 1 year ago

I'm having the same error, can't move through the menus when using this NFC/RFID program, but I can with other programs.

ESPboy-edu commented 1 year ago

ESPboy buttons stop working because they are tied to GPIO pins of MCP23017 port expander, which is connected to I2C bus and probably connection to D1 and D2 (SDA and SCL - I2C bus pins for ESP8266/ESPboy) of the RFID/NFC module breaks communication on this bus. Why this may be so most likely because the red RFID/NFC modules from ETECHOUSE, pictures of which are shown in the description of this code (and most likely other similar modules) have the ability to work on UART/SPI/I2C interfaces and to select the I2C interface you need to use switches or jumpers or the soldering pads on the module board to select I2C mode. You should check the description of your RFID/NFC board to see how to set it to I2C operation. If you take exactly the same board that is shown in the pictures to the description of this code, it says that to do this you need to set the switches as follows: SET DIP SWITCHES: Switch1 - ON Switch2 - OFF ESPboy_RFID_NFC_pics_IMG_4_jpg_at_master_·_ESPboy-edu_ESPboy_RFID_NFC

Another cause of I2C bus malfunction could be a problem with the pull-up resistors (but this is unlikely in your case, but it is something to keep in mind). For I2C bus to work it is necessary to pull up both SDA and SCL lines with resistors to "+" power supply through resistors. Resistors resistances are calculated in a special way, as well as it is worth remembering the limitation of the total capacitance of the lines. The problem arises when ESPboy device already has pull-up resistors of I2C line, but additional I2C modules are connected to this line, and they also have additional resistors soldered on them... and sometimes parallel operation of all these resistors breaks I2C operation.

Jbrimbelibap commented 1 year ago

Thank you for this anwser ! Since my diy espboy displays a connection ok message for the module I think that the I2C connection is correct, and the switches are set correctly I may have to look into the resistors

ESPboy-edu commented 1 year ago

If connection is OK then I2C bus should work. Try to upload I2C scanner and check, if it sees MCP and RFID module address... Another advice is to set ceramic bypass (decoupling) capacitor 10..100nF on VCC/GND of the MCP23017 to stabilise power supply of the MCP23017.