I need help please. How do I wire my SD Card module to my ESP8266 when I've already used pins D0, D1, D2, D3, D4, D5, D8 and RX? Thank you for your answers!
Maybe don't use SD card. Most esp8266 boards have 4MB flash on-board and 3MB of that can be reserved for SPIFFS/LittleFS/whatever file system. Wemos D1 mini Pro has 16MB flash and 15MB can be used for file system.
Alternatively, use the WiFi to send the data to a server for storage.
If you must attach external SD card reader module, you should use a 3.3V module. The 5V SD card modules have problems that prevent sharing the SPI bus with other devices.
You must also change your circuit to make D8, D7, D6, D5 available to use SPI bus. If you need to add more pins, you can attach an SPI I/O Extender chip to D7, D6, D5 plus some other pin.
Thank you so much for your concise answer, Paul! Am now considering using LittleFS for my project
D5,D6 & D7 are required for SPI, the CS pin can be any GPIO, but if my counting is correct, you are going to be 1 pin short. There may be ways to free up a couple of pins in some way or another. Without knowing what you are using them for now, there is no way to tell.
Hi, Deva! Here's my pin allocation:
D0 - Thermal Printer RX
D1 - LCD SCL
D2 - LCD SDA
D3 - Push Button Led
D4 - Coin acceptor signal
D5 - Thermal Printer TX
D8 - Coin acceptor Set PIN (used to power on/ power off coin acceptor)
RX - Push Button
Are you using swSerial ?
Could you combine The push Button on Rx with the connection on D3 ? is it just a button ? You could also consider connecting push buttons (multiple) to A0 using a couple of resistors. They would anyway need extra resistors to reduce the voltage to the 1v-0v that A0 requires. What is your exact board and show us (some of) the sketch.
Yes, I use swSerial for the thermal printer. The push button and its LED is completely independent from each other, (push button pinMode is Input, LED is Output), hence the need for separate pins.
So yeah, you could switch to using hwSerial, it is more reliable and less CPU intensive, you will lose any debug messages you may be sending though.
If you use A0 to read the pushbutton, and move the printer RX & TX to the TX & RX pins, that frees up D0, D5, D6 & D7, which are the SPI pins + D0 for use as Chip Select.
You may have to experiment a bit with A0, it should have a voltage divider on it for use with 3.3v to 0v range, and that probably removes the need for a pullup resistor, but test that first.
I just ordered an IO Expansion board haha, I think will be much easier
Much easier would be an ESP32
have a look here.
You know you already have the LCD connected to the I2C bus, hope you won't have any conflicts there.
Thank you for all your help Deva_Rishi! Will update you once I make it