Arduino - How to Read SD Card Text File Line by Line
Introduction: Arduino - How to Read SD Card Text File Line by Line
In this tutorial we will learn how to read the SD card text file line by line.
Watch the Video!
Note: You can use other Displays such as OLED, but make sure that you use a board with enough memory like Arduino Mega,etc
Also check out this tutorials:
Arduino Nano: Measure Distance With Ultrasonic Ranger and Log It to MicroSD Card With Visuino
Arduino Nano: Log GPS Information to MicorSD Card With Visuino
Step 1: What You Will Need
* LCD Display I2C 20X4 (if you use diferent LCD then make sure that you specify the right Columns and Rows in the Visuino component)
* SD card module + SD card
* Jumper wires
* Arduino UNO or any other board
* Visuino software: Download here
Step 2: Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2
Step 3: Prepare the SD Card
Open a Notepad or any other writing software on your computer and write it like this:
TEXT LINE1
TEXT LINE2
TEXT LINE3
TEXT LINE4
Then save it as a "TEST.TXT" to the SD card. Remove the SD card from your computer and put it in the Arduino SD card module.
Step 4: Circuit
* Connect SD card Module pin GND to Arduino pin GND
* Connect SD card Module pin VCC to Arduino pin 5V
* Connect SD card Module pin SCK to Arduino digital pin 13
* Connect SD card Module pin MISO to Arduino digital pin 12
* Connect SD card Module pin MOSI to Arduino digital pin 11
* Connect SD card Module pin CS to Arduino digital pin 10
* Connect LCD Display pin VCC to Arduino pin 5V
* Connect LCD Display Module pin GND to Arduino pin GND
* Connect LCD Display pin SCL to Arduino pin SCL
* Connect LCD Display pin SDA to Arduino pin SDA
Step 5: In Visuino Add Components
* Add "Micro SD Card Module" component
* Add "Liquid Crystal Display (LCD) - I2C" component
* Add "Start" component
Step 6: In Visuino Set Components
* Double click on the "SDCard1" component and in the Elements window drag "File" to the left side
* Now on the Left side of the Elements window select "File1" and in the properties window set "New Line" to False, "Path Name" to TEST.TXT
and select "Elements" and click on the 3 dots button, a New Elements window will open, here drag 4X "Read Text Line" to the left side. 991