This particular project uses the Arduino pro-mini board which has a very small size and can be connected with bread board compatible connectors. The Arduino pro-mini board has digital pins marked as 2, 3, 4 up to 13. Among the digital pins four pins namely 10, 11, 12 and 13 can be configured as SS, MOSI, MISO and SCK. The MISO of the memory card should be connected to the pin number 11, the MOSI should be connected to the pin number 12 and the SCK should be connected to the pin number 13 of the Arduino pro-min. The SS of the SD card should be connected to the pin which is defined as the SS pin of the Arduino in the code written. The image of the Arduino pro-mini board and the Arduino IDE version 1.0.3 for windows used in this project are shown in the following image;
Since the arduino pro-mini board has no circuitary for interfacing it with the serial port or the USB port of the PC, an external USB to TTL converter board is required to connect it with the PC. This hardware helps in programming the arduino board and also helps in the serial communication with the PC through the USB port of the PC.
It is assumed that the reader has gone through the project how to get started with the arduino and done all the things discussed in it. The memory card used in this particular project is a 2 GB SD card from Transcend but the code is supposed to work with SD card from all vendors. The SD card operates on 3.3V logic and hence to interface it with a microcontroller which runs on 5V logic one should use a Logic Level Converter. Since the memory card is interfaced using the SPI bus the four channel Logic Level Converter modules which are commonly available in the market can be used. The image of the Logic Level Converter module used in this project is shown in the following image;
The SD memory card and the low voltage side of the Logic Level Converter should be provided with the 3.3V power supply and for that one can use any 3.3V regulator IC. A bi-color LED is suggested to connect across the 3.3V positive and MISO and MOSI lines of the SD card. The image of the memory card and the required circuitry that has been built for this particular project is shown in the following image. In the image one can see a potentiometer which is actually forms the circuit with an SMD variable regulator IC LM117 underneath it. It is recommended to use LM1117 which is a 3.3V regulator and which does not require other components to set the voltage as shown in the circuit diagram of this project.
The Arduino IDE provides a library called <SD.h> which has lot of functions to access the SD memory card. The library is able to access the FAT16 or FAT32 filesystem of the SD card using the AVR microcontroller of the Arduino board so that the files can be read, modify or write. The functions used in this particular project are SD.begin(), SD.open(), file. println(), file.read(), and file.close() from the library <SD.h> and the details regarding them are explained in a previous project on how to interface SD card with Arduino.
The Arduino board has several digital pins which can be configured as digital I/O pins and among them some can also be used as analog output pins. There are dedicated analog input pins also in most of the Arduino boards. The Arduino pro-mini board has 8 analog input pins marked as A0, A1 up to A7. In this particular project the variable pin of a potentiometer is connected at the analog input pin A0.
The Arduino IDE provides functions to access analog input and analog output of the board. The code written for this project uses the built-in function provided by the Arduino IDE namely analogRead() and analogWrite(). The functions are already used in the previous projects on how to use analog input and analog output of Arduino board, how to use Arduino to display sensor values, how to make dynamic sensor display using Arduino, how to save sensor values in the EEPROM of the Arduino.
The code create or open a file “sensor.txt” and store 50 sensor values which has been read with a delay of half a second between them. Once the 50 values are read the code reads the entire file and displays it in the Serial monitor. The data is transferred from a file from the SD card and is monitored using the Serial monitor window with the help of the serial communicating functions written in the code. The functions used in this projects are namely Serial.begin(), Serial.println() and Serial.write(). The details of these functions and similar functions for the serial communication are already discussed in previous projects on how to do serial communication with the Arduino, how to send and receive serial data using arduino, how to do serial debugging with the Arduino.
When the coding is finished one can verify and upload the code to the Arduino board as explained in the project how to get started with the Arduino. The code will initialize the SD card, create a file “sensor.txt” and store 50 sensor values in it and read back the entire file. One can observe the data read from the file with the help of Serial monitor as explained in the project on how to do serial debugging with the Arduino.