Hot answers tagged

24 votes
Accepted

Why is our refresh rate consistently decreasing in logging on SD card?

I don't have certain answer for you, but a deep suspicion. If I get bored I'll confirm it. Confirmed below. In each pass of loop(), you have: dataFile = SD.open("log1.csv", FILE_WRITE); ...
  • 4,359
6 votes
Accepted

How does one set attributes for SD files?

The Arduino SD library, is based on Github: greiman/SdFat, by William Greiman. From SD Created File Attributes: The basic SD.h library doesn't set the attributes. You notice everything has the ...
  • 2,803
6 votes

What is the chip in this board?

but what is C3? Looks like it is between the output and GND. C3 is likely a 10 uF cap for the 3v3 output of the regulator. (Source: datasheet for Sunrom SD module (PDF)) The circuit design used in ...
3 votes
Accepted

Arduino UNO And SD Card Custom csPin

Pin 10 is special. It's the hardware chip select pin for SPI. It is integral to the SPI peripheral in the chip. That pin must be an OUTPUT for SPI to operate as master, or INPUT for it to operate as ...
  • 103k
3 votes

Connect Arduino to an external microSD card reader

You cannot SD cards cannot be shared between masters in operation, and it is unsafe to disconnect the card from the camera with an electronic switch when the camera is not expecting that. Nor is an ...
3 votes

How does one set attributes for SD files?

Quite simply FAT16 only supports 1 date, normally Modified Date. FAT32 has (limited) support for 3 dates (but AFAIK there is no Arduino library which supports FAT32). Even then not all OS even ...
  • 1,645
3 votes

Arduino SD Card open file modes append / overwrite

The Arduino SD library is an Arduino wrapper of old version of SdFat library (put into utility subfolder of the SD library). This SdFat library has constants like O_READ, O_WRITE, O_APPEND. Arduino ...
  • 16.7k
3 votes

Arduino SD Card open file modes append / overwrite

You only need to open the file with FILE_WRITE and use file.seek(EOF) to go to de end of the file. After that you can write whatever you want that will be appended to the end of the file. File ...
3 votes

Proper Micro SD card schematic

As per the SD card specification: When an SD card is operating in SPI mode or 1-bit SD mode, the CMD and DATA (DAT0 - DAT3) lines of the SD bus must be pulled up by 10 kOhm resistors. Slaves should ...
  • 103k
3 votes
Accepted

How to difference hardware reset and software reset?

You can't. There is no "software" reset. When you upload new code a hardware reset is triggered by the DTR pin of the USB interface chip. Instead I would suggest maintaining a "data ...
  • 103k
3 votes
Accepted

Random access to SD card using SD.h or another library (ESP32)

Solved! The solution was to migrate from the SD library to mySD, which seems to be a SdFat wrapper for ESP32. You can see in the file mySD.h that the FILE_WRITE mode is defined as: #define FILE_WRITE (...
  • 203
2 votes
Accepted

How fast is a SD page read from a file?

So my question: is 20 ms enough to read like 50 pages of 512 bytes from an SD card which are located on different (but known) file offsets within a 2+ MB file? Let us do the numbers: 50 * 512 = 25 ...
  • 7,881
2 votes

Datalogger with interruputs

The millis() function is based on a counter which is incremented by the Timer 0 overflow interrupt. Since you reconfigured that timer to never overflow, that counter is not incremented anymore. If ...
  • 38.5k
2 votes

How does one **get** attributes for SD files?

You need to get an SdFile object for your file then use the SdFile::dirEntry method to get the directory entry for the file. The directory entry (struct directoryEntry) has the timestamps.
  • 2,100
2 votes

DFPlayer for Writing to SD Card

Unfortunately the DFPlayer cant write that data to the SD card. The Arduino has some non volatile memory of its own built in though. Theres 1K of EEPROM for the UNO. Notes on how to use it here: https:...
2 votes

Fast data logging

Read the values into an array big enough to store them Write the array with the write(const uint8_t *buffer, size_t size) method. Each write then gives you a block of binary data (512 values, 1024 ...
  • 103k
2 votes
Accepted

Arduino SD Card open file modes append / overwrite

If you look in this library, you see: File SDClass::open(const char *filepath, uint8_t mode) { ... if ((mode & (O_APPEND | O_WRITE)) == (O_APPEND | O_WRITE)) { So you can use all these ...
2 votes
Accepted

Can I read from a memory card with three pins?

Not with an ATTiny85, and not with so few pins, no. However, all is not lost. The ATTint85 has 512 bytes of EEPROM inside it where you can store your login details. All you need is some way of ...
  • 103k
2 votes

Best buffering practice for continuous SD card writing

Is this a sensible solution to the problem? No, unfortunately not. The size of the buffer is limited by the available RAM on your chip. Jumping between multiple buffers or cores will not change that, ...
  • 14.7k
2 votes
Accepted

sizeof tm struct (datetime) different on ESP32 vs linux64x

You can not trust system-level structs for data storage or transfer between different systems. The main reasons are: Different data type sizes (16 / 32 / 64 bit ints, floats vs doubles, etc) Struct ...
  • 103k
1 vote
Accepted

Where are the implementations of the SdFat BlockDriver methods?

The typedef in BlockDriver.h is only for pointer type, not for instance of the object. The object is always of type SdSpiCard, but in one case it is not an implementation of BlockDriverBase, so the ...
  • 16.7k
1 vote

Trouble with reading Bitmaps from SD-Card

f.read((uint8_t *)infoheader, sizeof(infoheader)); should be f.read((uint8_t *)infoheader, sizeof(biheader)); the size of the variable (pointer) is only 2. you want to read 40 bytes of biheader ...
  • 16.7k
1 vote

Attempting to read random string from SD card

Reading an individual string from a list in a file is not a simple operation. Well, it's "simple", but takes a lot of work. It's not possible to say "Get me line number 2984 from the file" with a ...
  • 103k
1 vote
Accepted

How does one **get** attributes for SD files?

In the FAT filesystem the timestamps and other attributes are stored in the directory, not in the file. So you need to read the "file" that is the directory that contains the file you're interested ...
  • 103k
1 vote

Use 5V SD-Adapter on 3.3V System

You can use the adapter because: the adapter uses an AMS1117 to generate 3.3V to supply the SD card and the level shifter the level shifter is a 74LVC125 which uses 3.3V and works with 3.3V (and ...
1 vote

Use 5V SD-Adapter on 3.3V System

Catalex Micro SD Card Adapter has built-in level converter in a form of 74LVC125A 3-state buffer. This buffer chip needs 1.65 to 3.6V voltage supply. The +5V from your Arduino is lowered to 3.3V by ...
  • 466
1 vote

Use 5V SD-Adapter on 3.3V System

The SD card is a 3.3 V device. The 5 V module with SD card adapter steps down the voltage for powering the card and has logic level conversion for card's SPI pins. If you want to connect SD card to a ...
  • 16.7k
1 vote
Accepted

PMS5003 Serial Output Data to SD Issues

There is a mismatch in the code. The Arduino loop function assumes that readPMSdata needs to be called just once for valid data but the function readPMSdata itself assumes that it will be called over ...
  • 3,137
1 vote

Long freezes at the beginning of sd card transfer

As a temporary workaround I have come to the following procedure: I inserted a function that writes a certain amount of bytes into a dummy file, closes it and finally deletes it, all during setup(). ...
  • 175
1 vote

Adding music to loop

The TMRpcm library is non-blocking. That means, when you start playing it keeps playing in the background. If you put the play function in a loop it will just keep restarting what you are playing over ...
  • 103k

Only top scored, non community-wiki answers of a minimum length are eligible