Promake Storage M1
Description
The ProMake Storage M1 is an ideal solution for many projects that need more data storage capacity than what most micro-controllers provide on their internal Flash or EEPROM memories. It features a microSD card slot for microSD cards used as a mass storage media for portable devices. It designed to run on 3.3V power supply. Industry standard SPI interface ensures simple communication at high data rates. Use it for reading or storing data like audio, video or text files and more.
Furthermore, as a removable media, you have greater flexibility when it comes to access the stored data. For instance, you can log sensor data in a file on the microSD card, then physically removing it from your project to access the data directly on a computer using a card reader.
For more flexibility an I2C Enabled EEPROM is added to module that let you store your important data using a simple I2C interface.
Features
- SD or SDHC cards supported.
- On Board I2C EEPROM
- Single 3.3V supply
- FAT32 file system, support 32GB TF card
- Breadboard-friendly
Important Notes
- In order to interface the module to 5V I/O systems an external level translator may be required.
Resource
Module Pinout
Software
Developement using Arduino
To set up the hardware, Insert your SD card and easily plug this module into:
Module1
orModule2
slot of your ProMake® Arduino Nano Kit
or
Module1
orModule2
slot of your ProMake® Arduino Uno Shield
or
- Use your breadboard to connect the Power, I2C and SPI lines.
now use the following code to write on SD Card:
#include <SPI.h>
#include <SD.h>
File myFile;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial); // wait for serial port to connect. Needed for native USB port only
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
myFile = SD.open("test.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("This is a test file :)");
myFile.println("testing 1, 2, 3.");
for (int i = 0; i < 20; i++) {
myFile.println(i);
}
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
void loop() {
// nothing happens after setup
}
Developement using Raspberry
For developing SPI storage micro SD card on PICO KIT with MicroPython, you can use this sample code. Please pay attention to the proper slot number and SPI port. This code is written for slot one andd simply it can change to another SPI port.
# This code run on ProMake PI PICO Kit HW REV 1.2 and Upper
import sdcard
import machine
import uos
sd_spi = machine.SPI(0, sck = machine.Pin(6, machine.Pin.OUT), mosi = machine.Pin(7, machine.Pin.OUT), miso = machine.Pin(4, machine.Pin.IN))
sd = sdcard.SDCard(sd_spi, machine.Pin(5))
uos.mount(sd, "/sd")
print("Size: {} MB".format(sd.sectors/2048)) # to display card's capacity in MB
print(uos.listdir("/sd"))
print("\n=======================\n")
print("Basic SDcard Test \n")
with open("/sd/test2.txt", "w") as f: # Write - new file
f.write("First Message\r\n")
with open("/sd/test2.txt", "a") as f: # Append
f.write("Easy IOT Kits\r\n")
with open("/sd/test2.txt", "a ") as f:
f.write("First test SD Card!\r\n")
with open("/sd/test2.txt", "a ") as f:
for i in range(10):
f.write(str(i) + ", " + str(i*i*i) + ", " + str(i*i*i*i) + "\r\n")
with open("/sd/test2.txt", "a ") as f:
f.write("Looping all done!\r\n")
with open("/sd/test2.txt", "r") as f:
print("Printing lines in file: Method #1\n")
line = f.readline()
while line != '': # NOT EOF
print(line)
line = f.readline()
with open("/sd/test2.txt", "r") as f:
lines = f.readlines()
print("Printing lines in file: Method #2")
for line in lines:
print(line)
uos.umount("/sd")