Introduction: Connect Nodemcu and Micro SD-card Without SD-card Shield
What you need:
1. Berg strips (male) (7-Pins)
2. Micro SD adapter
3. Dupont jumpers (Male to female) (7 jumpers)
4. Nodemcu
5. Breadboard
Pre tin the end of berg strips, apply flux to the pins of micro sd adapter, gently place the berg strip over adapter and heat each pin with the soldering iron, half a second each is enough.
And you are done!
now the wiring part -->
Step 1:
Connect as shown in the schematic,
SS --> D2 (GPIO 4)
MOSI --> D7 (GPIO 13)
SCK --> D5 (GPIO 14)
MISO --> D6 (GPIO 12)
VCC --> 3v3
both GND --> GND (GND pin between MOSI and 3v3 pins is optional )
Format the sdcard to FAT32 filesystem put some sample files in there.
Connect USB cable upload testcode (nodemcu_sdcard.ino) using Arduino IDE
If everything goes as planned, you should get filesystem info on the serial console as shown in the image.
3 Comments
5 months ago
Well tried pretty much everything I guess, measured all the wiring, ran through the sketch just to be sure, double checked everything 20 times, but for some reason it just doesn't work, the best I've gotten at some point was when it did manage to detect the sd card, but it couldn't read the fat32 filesystem, tried several different sd cards as well as several different adapters, but nothing, I'm starting to think it just doesn't work
Edit: Fixed and got it working, for those with the same issue, try switching chip select to D0, and solder the sd adapter directly onto the nodemcu without using a breadboard, and use good quality cables, preferably as short as possible.
This might help also a bit:
* D5 <-> SCK/CLK
* D6 <-> MISO
* D7 <-> MOSI
* D0 <-> CS
* Vcc <-> 3.3V
* Gnd <-> Gnd
http://www.mobilerobots.pl/web_images/sd_cards_pin...
If this still doesn't work, try using VU instead of 3.3v, it might need 5v instead
Also I've seen a lot of people suggesting D8, but in my case that causes boot issues when the sd card is inserting since the D8 pin is somehow involved in the boot process, either way D0 works better
1 year ago
sdcard:32:1: error: 'Sd2Card' does not name a type
Which SD.h library are you using? The one installed in Arduino IDE is different from your calls.
3 years ago
Thanks for sharing :)