0

Well, I am making a device, which has to receive SMS and print the text using am LCD display. Now I have code that can receive SMS and store it into a string variable using serial connection. Here is my code:

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;  //LCD pins
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);                 
String Arsp, Grsp;
SoftwareSerial gsm(6,7); // RX, TX

void setup() {
  Serial.begin(9600);
  Serial.println("Testing GSM SIM800L");
  gsm.begin(9600);
  gsm.println("AT"); //checking
  delay(1000);
  gsm.println("AT+CMGF=1");  //Set to Text mode
  delay(1000);
  gsm.println("AT+CNMI=1, 2, 0, 0, 0"); //Set to notification for new message, New message indication
  lcd.begin(16, 2);
}

void loop() {
  if(gsm.available()) {
    //Check if GSM Send any data
    Grsp = gsm.readString(); //Read data received from SIM800L GSM Module
    lcd.clear(); //Clear LCD Screen
    lcd.setCursor(0,0); //Set LCD cursor to First line, first row
    for(int i = 0; i<=100; i++) {
      //Print received string character by character
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print(Grsp); //Print string which received from GSM (sms, sender, sms index, receive time, etc)
        lcd.print("        ");
        lcd.print(i); //Print the string index
        delay(500);
    }
  }
}

When my Arduino Uno is connected to PC and the Arduino serial monitor is already open, it prints correctly this text received from GSM

"  +CMT: "+995599093230","","18/01/05,16:29:57+16"  0.

In this case I sent a message with text "0". When I disconnect the USB and connect my Arduino Uno to 9V power supply and send the same message text it prints:

" +CMTI: "ME", "+995598403536", 40)

In this case 40 is the index of the message received. I want to get the whole string as in the first case when the USB was connected.

I using Arduino GND and 5V to power the SIM800L. What I am doing wrong? Is this due to incorrect serial connection or incorrect code error?

  • What is your 9V supply? – Majenko Jan 5 '18 at 16:55
  • Somethinf like this 9V Cell google.com/…: – AlexL Jan 5 '18 at 17:12
  • Oh dear. Well, there you go then. Get a real battery or a mains power supply. – Majenko Jan 5 '18 at 17:13
  • But fore some minutes it works good, Is it real to get this problem using this cell? – AlexL Jan 5 '18 at 17:14
  • 2
    Also asked at: forum.arduino.cc/index.php?topic=520835 If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. – per1234 Jan 5 '18 at 17:28
1

The PP3 battery you are trying to use is far from powerful enough to run a SIM800L. It's barely powerful enough to run an Arduino by itself for more than a couple of hours if you're lucky.

The SIM800L, as the datasheet tells us, must be powered by a supply which can provide at least 2A.

The power supply range of SIM800L is from 3.4V to 4.4V. Recommended voltage is 4.0V. The transmitting burst will cause voltage drop and the power supply myst be able to provide sufficient current up to 2A.

The Arduino's on-board 5V regulator can't provide more than 800mA if you're lucky (far less if the incoming voltage is more than around 7V due to heat dissipation). Running from USB may allow peaks of up to 2A on a DCP USB socket without the Arduino's PTC fuse blowing.

A typical PP3 battery has an impedance of 1.7 ohms. That means a dead short circuit across the terminals would theoretically allow 9/1.7 = 5.2A maximum ever to flow. That kind of current would dissipate about 46W in heat inside the battery causing it to explode. Also at that current, given the typical low capacity of about 154mAh, the battery would be flat within about 100 seconds.

The maximum rated current for one of these batteries (at least, the maximum current shown on any of the graphs in the datasheet) is 250mA.

You need to power your SIM800L in a completely different manner, including two important things:

  1. You need a power source that can provide 2A at the rated input voltage of your module (5V?)
  2. That source needs to either be separate from the Arduino (except the ground, which must connect to the Arduino as well as the module) or if it is 5V may be used to directly power the Arduino through the 5V pin.

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.