Arduino GSM LCD Stacked



Introduction: Arduino GSM LCD Stacked

I have previously described how I built a simple SMS forwarder. I had a 16x2 LCD module for the Arduino so I thought it would be nice to stack that ontop of the GSM shield. This requires some soldering since 2 pins on my LCD shield interferes with the GSM shield.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Figure Out What Pins Are Used

The LCD I have is a 16x2 shield based on the Hitachi HD44780 controller. It has 5 buttons connected to a network of resistors which makes it possible to read which button is pressed through one analog pin. In this case the A0 pin. I will not be using the buttons for now so let us forget about the analog pin.

Pinout of the LCD Shield

Pin Function

Analog 0 Buttons (select, up, right, down and left)

Digital 4 DB4

Digital 5 DB5

Digital 6 DB6

Digital 7 DB7

Digital 8 RS (Data or Signal Display Selection)

Digital 9 Enable

Pinout Sim900 (With SW/HW Jumpers set to SW) from Sim900 shield datasheet

Pin Function

Digital 2 RX

Digital 3 TX

Digital 7 RI (Jumper, open by default)

Digital 8 PWRKEY

Digital 9 NRESET

As we can see, pin 8 and 9 will overlap. Pin 7 would be an issue if we had solder the jumper connection for the ringer (RI) but we will leave that as it is. We need to move the input to the LCD from pin 8 and 9 to some unused pin.

Step 2: Change Input Pins

I will do a really quick and dirty solution to this. Since several digital pins are unused on the Arduino (pin D10-D13), I will just solder pin D9 to pin D10 and wire pin D8 to pin D12 on the LCD shield. I will then bend the pins so that they will not slide into the socket on the GSM board.

Step 3: Setup LiquidCrystal

After soldering pin D9 to pin D10 and pin D8 to pin D12 we need to change how we initialize the LCD. I will use the standard Arduino LCD library LiquidCrystal.h.

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 10, 4, 5, 6, 7);

Look at the LCD sketch examples to get a feeling for how to initialize and work with the LCD.

After that I included some printouts on the LCD from the text messages I receive as well as a nice spinning top to indicate that the program is running. One problem with the LCD is that it is difficult to display a long text, say a longer text message, especially since I want to keep the sender number in the top row and let the text scroll in the bottom row. I fixed that by writing this, rather ugly function:

//Print SMS
void lcdPrintSMS(char number[], char text[]) {


lcd.setCursor(0, 0);


lcd.setCursor(0, 1);

// scroll (string length) to the left

// to move it offscreen left:

for (int scrollCounter = 0; scrollCounter < strlen(text) - 16; scrollCounter++) {

for (int positionCounter = 0; positionCounter < 16; positionCounter++) {

// scroll one position left:

lcd.print(text[positionCounter + scrollCounter]);

} lcd.setCursor(0, 1);




lcd.setCursor(0, 0);



Step 4: Up Next

This device has turned out to be really neat project, one that I also have found to be useful. I would like to continue with this project and add some functionality through the buttons on the LCD. I have however run into several difficulties here.

I want to use interrupts to read the button pushes. That means changing interrupts to the analog pin A0, which leads to the newly create interrupt vector getting in conflict with the interrupt vector in the sim900 library. The other issue is that the weaker button signals (select & left button) are not powerful enough to trigger the interrupt. Write below if you have any good tips on how to be able to read the buttons in a good way.

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020