Using RC522 with 1602 LCD causes LCD to go crazy

Hi, I’m working on a home security system for a school project.

The system includes a keypad for inputting passwords and an RFID reader to read RFID cards for entry. Up to this point, there were no problems.

When I tried to include an LCD, the LCD would not work properly and go absolutely crazy. The LCD is not using any backpacks or shields.
After some troubleshooting, I discovered that removing everything related to SPI and RFID fixed it.

However, the RFID is an essential part of the project. Any help on resolving the issue with the LCD would be greatly appreciated.


LCD_test.ino (4.83 KB)

leonxxx: After some troubleshooting, I discovered that removing everything related to SPI and RFID fixed it.

So it sounds like you have a collision on the pin numbers for each device.

Start one at a time connecting them/debugging them and see where you may have pins that are being used for one or more devices.

It really helps to have a schematic. In simpler cases where I don't, I have a section at the beginning of the code that explains how all the pins are assigned.

Putting the LCD on the hardware serial pin, while using Serial, is really not a good idea.

Using all capital letter names for functions just makes you look clueless. That is not the impression you are aiming for, is it?

Pictures of long twisted wires are useless. Schematics, even Fritzing diagrams, are useful.

Did you use this library? https://github.com/miguelbalboa/rfid

aarg:
It really helps to have a schematic. In simpler cases where I don’t, I have a section at the beginning of the code that explains how all the pins are assigned.

I attached a schematic I just drew up, The code has been updated with a section listing the pin connections. Hope it helps.

cyberjupiter:
Did you use this library? GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522

I think this is the one I’m using. Could it be the cause of interference?

PaulS:
Putting the LCD on the hardware serial pin, while using Serial, is really not a good idea.

Using all capital letter names for functions just makes you look clueless. That is not the impression you are aiming for, is it?

Pictures of long twisted wires are useless. Schematics, even Fritzing diagrams, are useful.

I’m not sure which pins are serial and which are not? May I know why it is a bad idea?

Haha, apparently I am rather clueless. For now it helps me keep track of which lines are depicting functions (and they are easier to type). I will take your advice and rename them in my final version.

As for the photo of the wires, I am sorry about that. I was in a bit of a rush and hoped that it would help at least a little.

LCD_test.ino (5.78 KB)

I'm not sure which pins are serial and which are not?

When you decide whether or not you are sure, be sure to let us know. The Products page has details for every Arduino model, in case you need help deciding.

May I know why it is a bad idea?

Does using your fork to each dinner, and as a pooper-scooper to clean up after your dog seem like a good idea?

PaulS: When you decide whether or not you are sure, be sure to let us know. The Products page has details for every Arduino model, in case you need help deciding. Does using your fork to each dinner, and as a pooper-scooper to clean up after your dog seem like a good idea?

That was a little mean, but thanks to you, I think I've managed to solve the problem. I checked and found that pins 1 and 0 are serial. So I switched connections from them to 8 and 9. And.... Voila, no more craziness!

Thank you!

And.... Voila, no more craziness!

And, you learned that you need to check for pin conflicts whenever you add new hardware AND you learned where to find the data that you need. So, three good things happened.