1

I have a SIM 800L module which I am using to send /receive SMS calls.

I just wanted to know whether there is any library suitable for the SIM800 for arduino. I don't need GPRS functionality . I see mostly the arduino shield library but not sure whether it works with the SIM800 module bought from aliexpress.

Can someone help me in get me a library which can be used for the SIM800 .I have tried a lot but not getting a simple library for the same.

Actual Issue :

I am able to make it work with the AT commands using the Serial3 in the arduino MEGA. But when i started integrating with the existing project of ESP8266 and DS3231 somehow the Serial3 read() is not working properly. I tested with Serial3.readString()/ Serial3.read() and all. The CNMI for the SIM800 is 2,3,0,0 which is to direct the incoming message to the Terminal. If my project is having a simple loop with only Serial3.read, then all messages contents are read properly. If I include the other Serial2 readings which is for the ESP8266, then I am not able to read the full messages from Serial3.I have tried with timer to read serial from the Serial3 for 3-5 secs but now way it is working.

1

Most likely, the Serial3 buffer is being overrun because you are not reading fast enough. That is why when you use a simple loop, everything works and you get the whole message; very little time passes between reads. The simplest solution to this is to increase the size of the Serial buffer to, maybe, 256 bytes. Search for HardwareSerial.h in your Arduino installation and look for the #defined variable SERIAL_RX_BUFFER_SIZE in the file near the top. Change its value to 256 and save. This should provide enough buffer space to store the entire SMS until you read it. Alternatively you could change your CNMI settings to push only SMS notifications, which are a lot smaller in size, to the Arduino. Then you can parse the notifications, extract the SMS index and then request the SMS from the SIM800 using the index whenever you wish, making sure to read quickly (you will need to craft a while loop to do this efficiently, with timeouts and all).

  • Thanks a lot @brianrho . I have tried increasing the serial buffer as you mentioned. It works. But it has an impact on the dynamic memory for the program. Previously in MEGA it was using only 25% for my entire program but now it has risen to 39% if i change both Rx/Tx buffers to 256. I don't think i need the Tx buffer to be increased. Even if I increase the Rx to 128 it works. Can this be further reduced to 96 ?? and keep the Tx as 64 . will that cause any other issues .. I have tried setting the CNMI to sim memory and used index to read that but facing the same issue. – rahulmr Dec 30 '15 at 2:58
  • I once again tried with the CNMI index logic and it works fine with the default buffer setting !!!:) – rahulmr Dec 30 '15 at 3:30
  • @user3689864 Great...but you'll have to use trial and error to know what RX buffer size is good enough for you. Keep in mind that the maximum length of an sms is 140 and the SIM can only store a max of 15 sms (in my experience) before it stops saving them. Receiving only notifications is a good way to handle a lot of SMS traffic since it would take about 25 notifications for a 256-byte Serial buffer to get full, and it also allows you to use the default buffer size, like you've discovered. There's no need to change the TX buffer size from its default value. – TisteAndii Dec 30 '15 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.