-->
Page 1 of 1

Connecting Co2 sensor, display and sd card reader

PostPosted: Thu Jan 28, 2021 7:46 am
by Eduardo2021
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

Re: Connecting Co2 sensor, display and sd card reader

PostPosted: Fri Jan 29, 2021 3:43 pm
by davydnorris
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

Re: Connecting Co2 sensor, display and sd card reader

PostPosted: Sun Jan 31, 2021 12:14 pm
by Eduardo2021
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!

Re: Connecting Co2 sensor, display and sd card reader

PostPosted: Tue Feb 02, 2021 5:14 pm
by davydnorris
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