Skip to main content

Dozuki Update 8/24

Minor Versionm

by Alan

Introduction

This tutorial will help you with adding more storage to your microcontroller by using the SD Card Breakout Board. You will learn how to read and write on the SD Card. If you would like to learn more about how an SD card breakout board works, you can visit the links below.

Adafruit

  1. To open links in a new tab, right-click on the link and select "Open link in new tab" to avoid losing your progress while following this tutorial. Before you complete this tutorial, make sure that you have completed the Feather M4 Express tutorial first.
    • To open links in a new tab, right-click on the link and select "Open link in new tab" to avoid losing your progress while following this tutorial.

    • Before you complete this tutorial, make sure that you have completed the Feather M4 Express tutorial first.

  2. The libraries needed to be installed on your Feather M4 are adafruit_sdcard.mpy adafruit_bus_device
    • The libraries needed to be installed on your Feather M4 are adafruit_sdcard.mpy adafruit_bus_device

    • Adafruit has provided a thorough explanation of how to set up the board. For more details, please visit this link. In this summary, I will highlight the important aspects.

    • We will use the SPI portion of this board as it is less complicated. The pins you will be using are 3V, GND, CLK, SO, SI, and CS.

    • Remember to use only a 3.3V power source. The device can draw up to 100mA when writing on the SD card. Connect the 3V of the breakout board to the 3.3V of the feather, GND to the GND of the feather, CLK to SCK, DO/SO to MI, DI/SI to MO, and CS to any digital pin (I chose D6).

  3. If you have a new SD card, make sure that it is formatted correctly. They usually are, but you can check using an SD card adapter. Connect it to your computer and, when prompted with the SD card, right-click on it and select "format." It should be formatted to FAT32. When you format the card, it will erase anything that was on it prior.
    • If you have a new SD card, make sure that it is formatted correctly. They usually are, but you can check using an SD card adapter. Connect it to your computer and, when prompted with the SD card, right-click on it and select "format." It should be formatted to FAT32. When you format the card, it will erase anything that was on it prior.

    • The Micro SD Card Breakout board uses SPI and SDIO modes. Here's some information about the one we are using which is SPI mode.

    • Clock (SCK): The Feather M4 generates a clock signal (SCK) that synchronizes data transfer.

    • MOSI: Feather m4 sends data to the SD card breakout board using the MOSI line.

    • MISO: The Breakout board sends back information to the Feather m4 using the MISO line.

    • Chip select (CS) determines which device the Feather M4 communicates with, such as the Micro SD Card Breakout board.

    • To learn more about SPI please visit this link.

  4. In the location where code.py is stored on your Feather M4, create a folder named sd. The code for the micro sd card breakout board will be the same as the Adalogger Featherwing.
    • In the location where code.py is stored on your Feather M4, create a folder named sd.

    • The code for the micro sd card breakout board will be the same as the Adalogger Featherwing.

    • Run the example code from the Adafruits website under List Files.

    • Change SD_CS = board.D0 to the pin you have decided to use. In my case, it will be SD_CS = board.D4

    • When you run it, you will see the code output to be similar to the image without the file names in the red box

  5. For the challenge, write "Hello, Feather M4 Express" on the SD card in .txt format and display what you wrote in the RePL.
    • For the challenge, write "Hello, Feather M4 Express" on the SD card in .txt format and display what you wrote in the RePL.

    • You will need with open(____) as file:___ to read and write on the SD card. In the REPL you should see something similar to the image but with your writing.

    • To have a more idea of how to use that line of code visit the adafruit website

    • To view files on the SD card that are not .txt files, use the included micro SD card reader to connect it to your computer. Open File Explorer and select the drive if it doesn't automatically open when connected.

Quiz:

Micro SD Card Breakout Board: Quiz

Davidson Theosmy

Member since: 05/15/2024

6 Guides authored

Team

Maker-E Techs Member of Maker-E Techs

7 Members

49 Guides authored

0 Comments

Add Comment

View Statistics:

Past 24 Hours: 0

Past 7 Days: 1

Past 30 Days: 12

All Time: 71