microsd reader breakout

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Andy74
 
Posts: 6
Joined: Thu Dec 30, 2021 6:22 pm

microsd reader breakout

Post by Andy74 »

Hi all,

I'm searching for a microSD reader that works with 3.7V.

I found the "Adafruit MicroSD SPI or SDIO Card Breakout Board" (https://learn.adafruit.com/adafruit-mic ... o/overview).

I would like to understand:
1. can I use this with an Arduino microcontroller using the Arduino IDE and write the code in c++ (on the page there' the python code only)?
2. Which library do I have to use in order to accomplish this activity?
3. There are some tutorials about that?

Thanks in advance.

Andy74

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: microsd reader breakout

Post by dastels »

You would power this breakout with 3.3v from your MCU. Lofic signals must be 3.3v level. So you couldn't connect this to an Arduino UNO without some level shifters to go between the UNO's 5v logic and the card's 3.3v logic. With a modern 3.3v MCU you can connect it directly. if you need 5v compatibility see https://www.adafruit.com/product/254.

Yes, you can use C++. You can always use C++. SD support is part of the Arduino installation. See https://learn.adafruit.com/adafruit-mic ... no-library

Dave

User avatar
Andy74
 
Posts: 6
Joined: Thu Dec 30, 2021 6:22 pm

Re: microsd reader breakout

Post by Andy74 »

Hi Dave,

thanks for your answer, excuse me, I forgot to specify the Arduino model, I would like to connect it to an Arduino MKR WiFi 1010, which powered by a battery, does not reach 5V on the power supply pins.

I have a project that worked, by powering the device via USB with a 5V microSD reader, unfortunately, when I powered with the 3.7V battery, the reader stopped working. Powering with the USB cable everything works again. The microSD reader I am currently using is 5V. On the Arduino forum, I was advised to switch to a breakout that can work at 3V.

Post the link to the Arduino forum where you can also find info and photos about my project.
https://forum.arduino.cc/t/battery-powe ... der/936001

Thank you again for your reply, if you would like to add something after seeing the other forum, I would be grateful.

Andy!

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: microsd reader breakout

Post by dastels »

Both models will work with 3.3v power & logic. The one that only worked when powered by USB... did you have the breakout's Vin connected to the USB/Vbus bin of the MCU board? If so, that pin only has power (5v) shen USB is connected and is usually connected directly to the 5v line of the USB connector. I.e. before the power management circuit and thus has no voltage/power when the board is powered by battery. There is no 5v on the board when powered by battery.

The smaller 3.3v only model (without regulator and level shifters) only works with 3.3v power & logic.

Dave

User avatar
Andy74
 
Posts: 6
Joined: Thu Dec 30, 2021 6:22 pm

Re: microsd reader breakout

Post by Andy74 »

Hi Dave,
thank you again for your support and above all, happy new year and happy 2022, with the hope that it is really better than the last few years.

If I understood your question "did you have the breakout's Vin connected to the USB / Vbus bin of the MCU board?" the answer is no, the only connections I made are those visible in the photos I posted on the Arduino forum. The only test I did once the battery circuit was mounted is to alternatively use the vcc or the 5V pin, but the reader did not work in both cases (could I have connected it wrong? I'll check again).

If I can still take advantage of your kind availability I would like to ask a couple of more questions:

Do you think it is possible to power the blue microSD reader I am currently using with a 3.7V battery?
If I have to replace it with the Adafruit one, how should I connect the pins of my MKR WiFi 1010?

Again a big thank you and a very good year for you, Dave.

Andy!

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: microsd reader breakout

Post by dastels »

After verifying on the MKR schematic, the 5v pin is powered by the USB connector.. No USB... no 5v. This is a 3.3v board so you should be able to happlify bower the SD breakout from the 3v3 pin (i.e. 3.3v). The breakout you posted a photo of has a regulator and level shifters. You should power it with the same voltage that the MKR run on: 3.3v. If you attach it to an UNO , for example, you'd power it with 5v to match the MCU.

So for you, Vin of the SD breakout should connect to the 3.3v pin of the MKR, ground to ground, and the SPI pins to the corresponding MKR pins. The breakout you have appears to be comparable to https://www.adafruit.com/product/254.

Dave

User avatar
Andy74
 
Posts: 6
Joined: Thu Dec 30, 2021 6:22 pm

Re: microsd reader breakout

Post by Andy74 »

Again, thanks Dave,
I'm trying to figure out how to connect the device, but I'm missing the pins on the device and those on the Arduino.

When referring to the SPI pins, I can't figure out how to connect them.

The indications in the link you gave me (To use with an Arduino, connect GND to ground, 5V to 5V, CLK to pin 13, DO to pin 12, DI to pin 11, and CS to pin 10) is in reference to an Arduino UNO, but, as I said, I have an Arduino MKR WiFi 1010, with the pins as in the photo.

Sorry, I'm not that well versed in electronics.
Attachments
arduinomkr1010wifi.jpg
arduinomkr1010wifi.jpg (69.13 KiB) Viewed 274 times

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: microsd reader breakout

Post by dastels »

MISO, MOSI, and SCK are the SPI pins. You'll need another for the device select.

Dave

User avatar
Andy74
 
Posts: 6
Joined: Thu Dec 30, 2021 6:22 pm

Re: microsd reader breakout

Post by Andy74 »

So you mean that this device (Adafruit microSD reader) is not a good choice for my Arduino MKR WiFi 1010?
Do I have to choose another reader or another Arduino?

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: microsd reader breakout

Post by dastels »

No, it's a great choice for any MCU board; they pretty much all have an exposed SPI bus. See https://learn.adafruit.com/adafruit-mic ... ino-wiring for connection details. Ignore the pin numbers that it says to connect the breakout pins to as they are for UNO and Mega boards. Look at the pin names instead (MISO, MOSI, SCK).

Dave

User avatar
Andy74
 
Posts: 6
Joined: Thu Dec 30, 2021 6:22 pm

Re: microsd reader breakout

Post by Andy74 »

Well,
thanks Dave, for what I need!

So, if I'm right, I have to connect the pin as follow:
CLK <-> SCK
DO <-> MISO
DI <-> MOSI


I missed the CS pin that I have to connect to the SS (chip/secondary select) that I can't identify on the Arduino MKR WiFi 1010, but, considering the original project, I think I can use a custom pin, that I have to refer into the code, so, to maintain the original one, I configured the pin 6.

Good, I think this should work fine.

Thanks again for your support Dave, really appreciated it, sorry if I have continued on the subject for a long time, but I wanted to understand the points in question well.

I hope to provide some good news if you'd like to be informed about my progress. Meantime, have a nice day and thanks again.

Andy.

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: microsd reader breakout

Post by dastels »

You should be able to use any digital output pin for the CS/SS. The way the SPI bus works is that every SPI device is connected to common SCL, MOSI, and MISO signal and each has a unique CS/SS. This is unlike I2C that uses device address in the communication protocol instead of a hardware select pin. SPI can be MUCH faster because of this, but each device requires a dedicated pin.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”