SIM800L Serial Connection from 3V3 Atmega?

Hi,

I brought myself 3 or 4 of these SIM800L modules (pictured below) but I’m finding them to be tricky little devils to get working properly in my project which uses a standalone Atmega running at 3.3V with the 8Mhz Internal Oscillator.

The Atmega is powered by its own AMS1117-3.3 Fixed Voltage Regulator and the SIM800L is powered by a separate 3A DC-DC converter with an output voltage of 3.7V.

I have verified the SIM800L is working by connecting it up outside of my project to an Arduino Nano so I could communicate with it using the Serial Monitor. Using a baud rate of 9600 for the SIM800L and a baud rate of 9600 on the Serial Monitor, I can talk to the SIM800L with no issues.

I have verified the SIM800L works and have issued a successful dial out using ATD+44XXXXXXXXXX;

The wiring I used to test the SIM800L was as follows:-

SIM800L VCC and GND to DC-DC Converter VCC and GND OUTPUT @ 3.7V
Arduino Nano Powered by USB

Serial Comms from SIM800L to Nano was via Software Serial. I didn’t use any series resistors or voltage dividers. Just a direct wire to wire connection.

The Arduino Sketch Used to send and receive Data:-

//Serial Relay - Arduino will patch a 
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART 
#include <SoftwareSerial.h>
SoftwareSerial GPRS(5, 4);
unsigned char buffer[64]; // buffer array for data recieve over serial port
int count=0;     // counter for buffer array 
void setup()
{
 GPRS.begin(9600);               // the GPRS baud rate   
 Serial.begin(9600);             // the Serial port of Arduino baud rate.
}
void loop()
{
 if (GPRS.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield
 {
   while(GPRS.available())          // reading data into char array 
   {
     buffer[count++]=GPRS.read();     // writing data into array
     if(count == 64)break;
 }
   Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
   clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
   count = 0;                       // set counter of while loop to zero
 }
 if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
   GPRS.write(Serial.read());       // write it to the GPRS shield
}
void clearBufferArray()              // function to clear buffer array
{
 for (int i=0; i<count;i++)
   { buffer[i]=NULL;}                  // clear all index of array with command NULL
}

With that setup, I was able to talk to the SIM800L and issue commands over the Serial Monitor in the Arduino IDE.

But for some reason, the SIM800L isn’t working when I put it in my project. And when I say it isn’t working, what I mean is, it powers up and registers to the network but the test SMS message I am expecting never gets sent.

In my project I am using the Atmega’s hardware serial pins to communicate with the SIM800L but that shouldn’t make any difference, should it?

I’ve also tried a voltage divider on the serial lines as per some people’s recommendations that the serial lines shouldn’t be above 2.8V for the SIM800L but that didn’t work and I am able to communicate with the SIM800L using a 5V nano with no resistors at all - just direct Serial point to point wiring.

The code I am using to send an SMS is a very basic quick and dirty test code I’ve used with the AIThinker A7 module which works but I know that doesn’t guarantee it to work with the SIM800L.

char mobNumber[] = "+44XXXXXXXXXX";     //Master Mobile Phone Number
char smsAlertMsg[] = "TEST SMS";    //SMS Alert Message


void setup()
{

    Serial.begin(9600);

    delay(30000);  //Allow time to Register on Network etc.
    //Send SMS Alert
    digitalWrite(GSM_LED, HIGH);
    delay(100);
    GPRS.println("AT+CMGF=1");    //Set Modem to SMS TEXT MODE READY FOR SENDING SMS
    delay(100);
    GPRS.print("AT+CMGS=");
    delay(100);
    GPRS.print(mobNumber);
    delay(100);
    GPRS.print("\r");
    delay(100);
    GPRS.print(smsAlertMsg);
    delay(100);
    GPRS.println((char)26);
    delay(150);
    digitalWrite(GSM_LED, LOW);



}



void loop()
{  


}

The problem I’ve got now is I’m running out of ideas or tests I can devise.

What I would like to see is what data is being sent between the Atmega and the SIM800L but how to do it when the hardware serial is in use? Can I tap into those lines and read the data via a serial monitor somehow? If so how to do it?

Thanks!