Interfacing micro SD card with SIM800 GSM Modem

Hi everyone, this post is intended to show you how to expand the memory of an SIM800 GSM modem using a micro SD card. It can come in handy in case you need to store some files with large data.

sd_inserted

The features of the micro SD card used aresd_card

  1. SONY 16GB high capacity class 10 micro SD
  2. FAT32 partition.

Make sure the card is properly inserted. Power on the GSM modem after inserting the micro SD card and connect to the computer using a USB to TTL converter.

connect_to_computer

Now open any hyper terminal device. The one I’m using is putty. Select the serial port and give the baud rate as 9600.

putty

 

The firmware version of the GSM modem I’m using is 1308B08SIM800M32. You can check your firmware version by giving the AT command AT+GSV.

version

Ok, now if you are interfacing the SD card for the first time then you have to give the following AT commands.

AT+SD2PCM=0
AT&W

Now restart the GSM modem by the AT command

AT+CFUN=1,1

first_steps

Now to check whether the GSM modem has detected the SD card lets check the memory. give the AT command

AT+FSMEM

checking_memory

Now you will get a reply showing the available internal memory and the memory of the micro SD card that has been detected by the GSM modem. If you don’t see the memory of the SD card or if  it is shown as 0 bytes then there could be some problem with the setup you are using (it may be with the connection, firmware or SD card type).

We can see from above figure that the SD card is detected by the modem as ‘D’ drive. You can get this name of the drive by giving

AT+FSDRIVE=1

checking_drivename

The modem replies with the name by which the SD card is mounted.

Now let us list the files in the SD card. Give the command

AT+FSLS=D:\

Nofiles

The modem replies with ERROR. This means there are no files present. Now let us create a file in the SD card. Type

AT+FSCREATE=D:\TEST.txt

If you list the files now, you can see the file TEST.txt, in the D drive.

create_file

Now let us write some data to the file. The format is as follows.

AT+FSWRITE=0,32,150

here, there are three arguments. First one is either 0 or 1.

0: if you want the data to begin from the starting position.

1: if you want to append some data to the present data.

The second argument is the size of the data you are going to input. It can be a maximum of 10240, and the third argument is the time window in seconds for inputting the data. After giving the above command a prompt appears where you can type the data to be saved. The prompt closes only if

Important: The prompt closes only if  the length given is reached or a timeout occurs. So choose the length and time carefully.

write_to_file

Now to read from the file give the following AT command

AT+FSREAD=0,100,1

Here the first argument is either 0 or 1.

0: read from the beginning

1: read from a particular position

The second argument is the length of the data to be read. If the entered value is larger than the actual length it will be automatically replaced by the actual length. The third argument is for specifying the position from where the data to be read. It is important only if the first argument is 1. But you have to give this argument even if the first argument is zero (only that it is not important).

read_from_file

You can see the difference in the output data when the arguments changed.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s