So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Eduardo2021
#90350 Hello,

I am starting to use an ESP8266 board (NodeMCU) and I have a problem that I hope you can help me with.
In the project I am doing I want to connect a CO2 detector (Sesirion SCD30), an oled display (ssd1306) and a sd card reader. I can't manage to connect everything and make it work. Maybe the problem is in the software but I want to be sure that the connections are correct.

My first question is the following: Can I connect the SCK and SDA pins of the sensor and the display together to the D1 and D2 pins of the board? Then I could connect the card reader to pins D5-D8.

If they can't be connected together, how do I connect everything to the board? Thank you very much for your help
User avatar
By davydnorris
#90364 Both the CO2 sensor and the OLED display are I2C units - the ESP8288 I2C implementation is all done in software, so you can connect it to pretty much any free GPIO pins. You'll just need to adjust your pin outs in the code.

The SD Card reader will almost certainly be SPI and those pins are fixed
User avatar
By Eduardo2021
#90375 Thank you very much davydnorris,

I have been able to connect the sensor and display in parallel to pins D1 and D2 on the board. I now have pins D5-D8 free to connect the SD card reader via SPI. Just to confirm the card reader I have to connect it to those pins, right? Couldn't I connect it to the CLK, SD0, CMD and SD1 pins? I've seen that nobody does it but it's not clear to me why.

Thank you very much!
User avatar
By davydnorris
#90394 There are two sets of SPI pins, but one set are shared with the flash chip.

Unlike I2C the SPI pins are not movable - I have had this problem because I use I2S and that takes some of the pins used by most people to do SPI so I have had to use the shared SPI.

If you can possibly do it, use the SPI pins that most people use - in your case I can't see that you would have an issue