Control Light On/off Via Sms With Sim900 Module - Visuino

About the project

In this tutorial, you will learn how to control a light by sending SMS commands using the SIM900 GSM Module and Visuino. Watch the video!

Project info

Difficulty: Easy

Platforms: ArduinoDigilentSparkFunVisuinoM5Stack

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Jumper wires (generic) Jumper wires (generic) x 1
SparkFun RGB LED Breakout - WS2812B SparkFun RGB LED Breakout - WS2812B x 1
Digilent 5V 4000mA Switching Power Supply Digilent 5V 4000mA Switching Power Supply x 1
Arduino UNO Arduino UNO x 1
M5Stack GSM Module SIM800L with MIC & Headphone Jack M5Stack GSM Module SIM800L with MIC & Headphone Jack x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

Special thanks to Finn André Hotvedtfor assisting with testing and verifying the correct commands for the SIM900 module.

If you need help with Visuino projects or building a custom prototype using Arduino or other boards, Finn André Hotvedtis a great resource. You can contact him here.

Step 1: What You Will Need

  • Iam using in this tutorial a 5V light bulb module, but you can use anything such as LED module, Relay, etc
  • SIM900 GSM Shield
  • Arduino UNO
  • Sim card (You should disable the pin request on the sim card before using it with the GSM shield)
  • Jumper wires
  • 5V power supply with enough amps for the shield
  • Visuino program: Download Visuino

Step 2: The Circuit

  • Connect the SIM900 GSM Shield to the Arduino
  • Connect LED module pin [VCC] to Arduino (shield) pin [5V]
  • Connect LED module pin [GND] Arduino (shield) pin [GND]
  • Connect LED module pin [IN] to Arduino (shield) Digital pin [2]
  • Connect with the Jumpers on the shield pins D8(RX) & D7(TX) like you see it on the picture
  • Make sure that the antenna is connected to the shield
  • Connect the 5V Power Supply to the shield, and set the switch on the shield to the External Power (See the picture)
  • Once the Power is connected hold the Power button for 2s
  • Once the connection with the Network is established the LED will blink every 3s

Step 3: Start Visuino, and Select the Arduino UNO Board Type

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 4: In Visuino Add Components

  • Add "Software Serial Port" component
  • Add 2X "Compare Text Value" component
  • Add 3X "Digital Multi Source" component
  • Add "Char To Text" component
  • Add "Start" component
  • Add "Text Value" component
  • Add "Toggle(T) Flip-Flop" component

Step 5: In Visuino Set Components

  • Double click on the "TextValue1" and in the Elements window
  • Drag "Set Value" to the left side and in the properties window set "Value" to AT+CMGD=1, 4
  • Drag another "Set Value" to the left side and in the properties window set "Value" to AT+CNMI=1, 2, 0, 0, 0
  • Close the Elements window
  • Select "CompareValue1" and in the properties window set "Value" to Light ON and "Ignore Case" to True
  • Select "CompareValue2" and in the properties window set "Value" to Light OFF and "Ignore Case" to True

Step 6: In Visuino Connect Components

  • Connect "Start1" pin [Out] to "MultiSource1" pin [In]
  • Connect "SoftwareSerial1" pin [RX] to Arduino Digital pin [7]
  • Connect "SoftwareSerial1" pin [TX] to Arduino Digital pin [8]
  • Connect "SoftwareSerial1" pin [Out] to "CharToText1" pin [In]
  • Connect "CharToText1" pin [Out] to "CompareValue1" pin [In]
  • Connect "CharToText1" pin [Out] to "CompareValue2" pin [In]
  • Connect "CompareValue1" pin [Out] to "MultiSource2" pin [In]
  • Connect "CompareValue2" pin [Out] to "MultiSource3" pin [In]
  • Connect "MultiSource2" pin [0] to "TFlipFlop1" pin [set]
  • Connect "MultiSource2" pin [1] to "TextValue1" > "Set Value1": pin [In]
  • Connect "MultiSource3" pin [0] to "TFlipFlop1" pin [Reset]
  • Connect "MultiSource3" pin [1] to "TextValue1" > "Set Value1": pin [In]
  • Connect "MultiSource1" pin [0] to "TextValue1" > "Set Value1": pin [In]
  • Connect "MultiSource1" pin [1] to "TextValue1" > "Set Value2": pin [In]
  • Connect "TextValue1" pin [Out] to "SoftwareSerial1" pin [In]
  • Connect "TFlipFlop1" pin [out] to Arduino digital pin [2]

Optional if you want to monitor response from the GSM shield: Connect "SoftwareSerial1" pin [Out] to Arduino Serial pin [In]

Step 7: Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Step 8: Play

When you power the Shield wait a bit for the connection with the network to be established, once the connection is established the LED on the shield will blink every 3s.

Now you can send SMS from the phone using text "Light ON" or "Light OFF" and the LED should turn On or Off.

Congratulations! You have completed your GSM project with Visuino. Also attached is the Visuino project, that I created for this Tutorial. You can download and open it in Visuino: https://www.visuino.eu

Schematics, diagrams and documents

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...