Home / Tutorials / Raspberry Pi Tutorial / How to Send SMS with Raspberry Pi
Send SMS with Raspberry Pi

How to Send SMS with Raspberry Pi

It’s 2020 and sending SMS is now an old technology. But such technology remains to be a cheap and indispensable way to communicate over long distances. In this article, I will share how I send SMS with the Raspberry Pi.

I have been using a SIM800L EVB board to send SMS using a Raspberry Pi. The reason for choosing this board is its built-in voltage regulator which means it can be powered by a 5V source, similar to the Pi. This is in contrast with the smaller SIM800L board which needs a 3.7V power source.

Here are some other things you need to know about this board:

  1. It needs a 5V power source that can provide at least 2A of current
  2. The antenna must be attached for it to connect to the network
  3. If when power is provided and the board’s LED blinks then turns off, the current is not enough
  4. The board is registered to the network and ready to send and receive SMS if the red LED blinks every three seconds.

Here's how to connect the SIM800L EVB board to the Raspberry Pi:

Send SMS with Raspberry Pi

Enabling Hardware Serial

The SIM800L EVB board uses asynchronous serial to communicate with a microcontroller. Thus, the serial functions of the Raspberry Pi must be turned on. The following steps turn on the hardware serial of the Raspberry Pi running on Raspbian Buster (Raspbian 10)

Using the terminal, run sudo raspi-config

Then select 5 Interfacing Options

Next, select P6 Serial

When you press enter on this option, you will be asked two questions: 1) if you want to enable shell access via terminal and 2) if you want to enable the hardware for serial. If you’re accessing your Raspberry pi via terminal through Putty, you need to answer no to the first question and yes to the second question. Doing this will bring you to this screen:

The Raspberry Pi will ask you to reboot to apply changes. After rebooting, you are ready to use the hardware serial port.

Writing the Python Code

Now it’s time to code! Open an empty file using nano and name it sendSMS.py

sudo nano sendSMS.py

Then, copy-paste this code: (copy this then right-click on the Raspberry Pi terminal screen for Putty users)

Press ctrl+x then y to save and exit from Nano.

Run the code by issuing the command: sudo python sendSMS.py

The phone whose number is given as receiverNum in the code should receive a “Hello World” SMS.

Check Also

Uploading Camera Images from Raspberry Pi to Website

For those who are looking to work with images on their projects, the Raspberry Pi …

One comment

  1. Do you know if this work on a RPI 4 as well?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.