• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Import sdcard module does not work in uPyCraft

Q&A Forum › Category: ESP32 › Import sdcard module does not work in uPyCraft
0 Vote Up Vote Down
dannyboland1968 asked 6 years ago

Board:  Wemos D1 R32

SD module: External SPI MicroSD Card adapter with 16GB Samsung card.  Works with Arduino IDE.

Ladies and gentlemen,

My ESP32 board is working fine, blink and DHT22 programs are working correctly using micropython.

I have had the sd card external module working when using the Arduino IDE.

When I try to import the micropython sdcard module, all I get is:

> import sdcard
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'sdcard'
>>>

I have searched the internet for help to no avail.  The course book only mention pyboards with internal sd cards.

Any ideas what I am doing wrong?

Cheers,
Danny

1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Hi Danny.
The sdcard library is not part of the ESP8266 MicroPython firmware by default. 
So, if you want to use that library, you need to upload it to your ESP8266 first.
To do that, follow the next steps:

  1. Open a new file in upyCraft IDE and copy all the code library: https://github.com/micropython/micropython/blob/master/drivers/sdcard/sdcard.py
  2. Save the file as sdcard.py
  3. Upload that file to your board.
  4. Now, you can import the library in your code and use its functionalities.

If you need more information on how to import a library, you can check page 204 of the MicroPython ebook. It shows how to import the BME280 library, but the steps are the same for any other library.
Let me know if it solves your problem.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.