Using Blynk to Control IoT Device using SIM800 GSM Module

This article is a continuation of a previous one, Control an A.C Light Bulb Over The Internet from a Smartphone. This time we would use the Blynk Cloud platform to control the built in LED over the Sim800 module GPRS connection.

NOTE: SIM800 USES A MAXIMUM OF 4V AND MINIMUM OF 3.6V, DO NOT EXCEED.

You’ll need the following to carry out this project

Hardware

  • Any Arduino microcontroller (I’m using Arduino NANO), get it here
  • Sim800 GSM module + power module, here
  • 12V power pack, here + regulator, here
  • 4V lithium ion battery, here + battery holder, here.

Software

  • Blynk app, refer to this article here if it’s your first time working with Blynk
  • Latest Arduino IDE, get it here
  • TinyGSM library, get it here
  • Blynk library, get it here

STEP 1: Setting up BLYNK

We will be using Blynk app to control the LED over the internet. I showed you how to set up Blynk and create a button, if you missed it you can check it out here. For the purpose of this tutorial, we would be using the button we created. If you’ve set up Blynk successfully which entails getting your AUTH TOKEN, you can move to the next step.

(NOTE: SAVE THE TOKEN, IT CAN BE REUSED FOR OTHER PROJECTS)

STEP 2: Circuit

  • Connect ground of your Sim800 to the Arduino
  • Connect the TX of the Sim800 to the digital pin 7 of the Arduino
  • Connect the RX of the Sim800 to the digital pin 8 of the Arduino
  • Connect the Vout +ve and Vout -ve to the +ve and -ve of the Sim800.
  • If using a power pack and regulator, turn the rheostat till the output reads 3.9v.
  • If using a battery, ensure the voltage is more than 3.6V else the Sim800 will not connect to a network.
Sim800 to Arduino Nano connection
Sim800 to Arduino Nano connection

STEP 3: Code

Go to Files -> Examples -> TinyGSM -> BlynkClient

  • Change the auth token to what you got in Step 1.
  • Change the APN, Username and Password to that of your sim provider
  • Change the Software serial tx and rx pin to 7 and 8 respectively.
  • Upload the code
Connected to Blynk Cloud
Connected to Blynk Cloud

Step 4: Connect your smart phone

  • Start the Blynk app.
  • Tap on the button and watch the LED on your Arduino Nano come on an go off.
Device offline at first
Device offline at first
Device presently offline
Device presently offline

Wanna do more?

The amazing thing is, you don’t need to connect the microcontroller to a Wi-Fi network.  You can connect this to a relay and setup a garage door opener.

Leave a Reply

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