16x2 LCD with SD card using same pins

Hello everyone,

for my project I need to use a SD card reader and an LCD 16x2 display, I have both (the reader is a catalex sd card adapter). I tried to run them simultaneously using the same miso-mosi pins, but they don't seem to work together. I know they should work ( SPI - Arduino Reference ), and I found a possible solution here: SOLVED. Nrf24 (Mirf lib) + Micro SD-card works OK together - #9 by someuser - Storage - Arduino Forum . My problem is that I don't have the tools for this patch. Maybe I could change the pins used by the lcd, but I need every single pin, because I use every single of them, and I don't want to buy a bigger board for it.

So I have 2 questions:

  1. Is there a programmatic solution, so I don't have to buy anything?
  2. If opt. 1 is impossible, can you suggest a card reader, which can share pins with my display?

Thanks for your help!

Write down a full list of pins that you want to use. And post it here.

An SD and a 16x2 should be no problem to find enough different pins.
The SD card will need the SPI pins but the 16x2 can use any pins.

David.

thank you for your reply! I know, that these 2 need less pins, then my board has (I use a pro micro), but my problem is that I will use a lot more other tools as well (buttons, buzzer, rtc modul), and the pins will be enough only if I manage to use the same SPI pins. Is that possible?

That is why I asked for a full list.

Some items are easier to share pins.
You would get advice. Others might pick up a few tips for their projects.

David.

okay, so:

  • LCD: 6
  • SD card reader: 1 CS + 3SPI = 4
  • buzzer: 1
  • RTC module: 3
  • buttons: 4
    this are 18 pins together, and I have only 16, I attached the pinout from the pro micro. Any suggestions?

A Nano seems to have 30 pins. Giving you the regular Uno 20 GPIO + 2 extra Analog.
A Micro seems to have 24 pins. You get less GPIO pins. 3 GND pins seems wasteful.

Yes, you can probably share some pins but you will need to be careful how they are used.
e.g. MOSI, SCK with the LCD

Or you could put all 4 buttons on a single Analog pin.

Or an SPI RTC could share the SPI bus with the SD.

But the simplest solution of all: Use an I2C Adapter on your LCD.
An I2C RTC could share the I2C bus.

David.

perfect! I'll try the I2C adapter. Thank you for your help!