Hi guys, I'm kinda new to Arduino, so apologize my little knowlige about the things related to Arduino. I've started a little project with a RFID reader and 7 pin SPI Oled, but I've stumbled onto one big problem. I hardly fitted all the pins from RFID and OLED, but I also wanted to connect a 1x4 membrane keyboard, but I don't have another pins for connecting it. I know there has to be some way, so I need help from you guys, how to connect RFID, SPI OLED and 4 pin keyboard at the same time. I've seen a topic, where people talked about 2 SPI devices can run across same pins, but when I connect OLED pins to RFID, the display is working fine, but the RFID doesn't read any cards. And I know I can't connect CS or SS or SDA into same pin, but when I connected just MOSI, SCK and RESET into same pin, it didn't work either. Can someone please help me with this? Like is there any way to devide informations that are going to devices? Thank you a lot.
You need to provide links to the datasheets for the devices you are using and also make a simple pencil diagram showing how you have everything connected and post a photo of the diagram. See this Simple Image Guide
What Arduino board are you using.
In general an SPI device needs 4 connections to the Arduino - the pins MOSI, MISO and SCLK are shared with all the SPI devices and each device also needs its own CS pin which is activated by the Arduino to identify which device it wants to talk to.
...R
Sure. I'll provide photos later, when a get to it. But for now, I'm using Wemos D1 R1, RFID MFRC522 and SPI SSD1306 7 pin Oled.
Here are the datasheets:
RFID - https://www.nxp.com/docs/en/data-sheet/MFRC522.pdf
SPI OLED - SSD1306 based OLED connected to Arduino · jandelgado/arduino Wiki · GitHub
Wemos board - https://wiki.wemos.cc/products:d1:d1
And basically, I've connected the RES to RES, MOSI to D1, and SCK to D0. Both SDA and CS into different pin and also MISO and DC to different pin. The result is, that the display is working (I have running time on it), but the reader doesn't read anything.
RaiKKo:
And basically, I've connected the RES to RES, MOSI to D1, and SCK to D0. Both SDA and CS into different pin and also MISO and DC to different pin. The result is, that the display is working (I have running time on it), but the reader doesn't read anything.
Without your diagram I can't make sense of that.
...R
Robin2:
Without your diagram I can't make sense of that.
Good luck making any sense of it with a diagram, Robin! The OP is confusing SPI pins with I2C pins and using the wrong pins for SPI on Wemos.
PaulRB:
Good luck making any sense of it with a diagram, Robin! The OP is confusing SPI pins with I2C pins and using the wrong pins for SPI on Wemos.
I am hoping that the diagram will make it easier to straighten him out. And while making the drawing he might even figure it out for himself.
...R
So I made that diagram and I hope you will see something from it. I better wrote the pin connections on the paper, just to be more sure and I'll even write it down, if you couln't read it.
OLED:
GND -> GND
VCC -> 5V
D0 -> SCK
D1 -> MOSI
RES -> RES
DC -> MISO
CS -> GPIO 0 or D8
RFID:
3.3 -> 3.3
RES -> RESET
GND -> GND
IRQ ->
MISO -> GPIO 12 or D11
MOSI -> GPIO 13 or D12
SCK -> GPIO 14 or D13
SDA -> GPIO 15 or D10
I've tried so many configurations but none of them worked. This is my least one and still got the same problem. Display works fine, shows running time exactly as I want, but RFID doesn't read any card, even when Arduino sees him, because he can show the version of it in the Serial.print. So thanks for your apply, I will be searching more.
RaiKKo:
Got it. U can delete your previous post.
Done. And thank you.
...R
What is the device on the left of your drawing?
If it is a Wemos D1 then it would help to use the functional names for the pins - not just Dnn. Peole here will be much less familiar with a Wemos than an Uno.
...R
Ok, sorry for my incomplete description. I'll write down pin describtion same as it's on the board.
FRONT RIGHT SIDE * BACK SIDE:
D15/SCL * GPI05
D14/SDA * GPI04
GND * GND
D13/SCK * GPI014
D12/MISO * GPI012
D11/MOSI * RX0/GPI013
D10/SS * TX0/GPI015
TX1/D9 * GPI02
D8 * GPI00
D1/MOSI/D7 * GPI013
D12/MISO/D6 * GPI012
D13/SCK/D5 * GPI014
D14/SDA/D4 * GPI04
D15/SCL/D3 * GPI05
D2 * GPI016
TX->D1 * GPI01
RX<-D0 * GPI03
That's the exact same desription as I have on my Wemos D1 board.
It would make things a lot easier if you produce a diagram with the relevant pin descriptions on it. Otherwise I am going to have to make the diagram myself. And as much as I want to help you I am not prepared to go to that much trouble.
The purpose of the diagram is to see quickly if you have connected things properly and, if not, to make suggestions.
...R
So Hi again. Sorry for my inactivity, but I really had no time to be here. I've finally managed to create that diagram again, with original WeMos D1 board. I've also sorted certain pin with different color, to easy write down the connection.
BLACK = GND
RED = VCC
YELLOW = SCK
GREEN = MOSI
WHITE = RESET
BLUE = MISO
PURPLE = CS for OLED
ORANGE = SDA for RFID reader
I hope you can finally see clearly the connection between devices.
I hope you can finally see clearly the connection between devices.
No, we can't. The connection names on the RFID reader are too small & blurred. It doesn't help that they are upside-down, either. They wouldn't be upside down on a proper schematic. Have you tried using the "schematic view" in Fritzing yet? Now you have done the breadboard layout, you can just switch views and tidy up the schematic.
I can just about read the pin names on the oled. And I can see they are wrong!
A suggestion for your 4-key pad would be an mcp23s08 SPI I/O expander. This would share MISO, MOSI, SCK but need another Wemos pin for its CS. It has 8 input/output pins, you only need 4, but if you need more, you can add a further 3 x mcp23s08 without needing any extra pins, and there is a 16 port version mcp23s17 (don't get the older mcp23s16).
Another, simpler suggestion, because you don't seem to be using A0, is to wire the keypad to that using 4 resistors. The keypad common would be connected to A0 along with a 10K pull-down. One switch would be connected directly to 3.3V and the other 3 connected to 3.3V via 4K7, 10K and 22K.