ESP32 SIM800L | Send and Receive SMS to Control Relay

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 เม.ย. 2021
  • In this video I will show you how to control relay module with ESP32 SIM800L by using Arduino IDE. When you want to control AC load connected to the relay, you will have to send an SMS to control the AC load (fan, bulb). You will also receive a response SMS showing the status of the relay (ON or OFF). You do not need of TTGO ESP32. I am using sim800l GSM module with esp32. Also you do not need any Arduino library with this esp32 GSM module project. This is a simple esp32 home automation project to control home appliances from anywhere in the world using sim800l GSM module and relay module.
    --------------------------------------------------------------------------------------------------------------------
    Parts Buy Links (Affiliate Links)
    --------------------------------------------------------------------------------------------------------------------
    1. ESP32 - amzn.to/3YCq2dS
    2. SIM800L GSM Module - amzn.to/3l6rKGP
    3. Relay Module - amzn.to/3l1aoem
    4. 18650 3.7v Rechargeable Battery - amzn.to/3ZAxV51
    --------------------------------------------------------------------------------------------------------------------
    Useful Video Links
    --------------------------------------------------------------------------------------------------------------------
    Sim800L MIT App Inventor Relay Control
    • GSM Based Home Automat...
    --------------------------------------------------------------------------------------------------------------------
    Social Media Links
    --------------------------------------------------------------------------------------------------------------------
    GitHub:
    github.com/ahmadlogs/
    TH-cam:
    th-cam.com/users/ahmadlogs?sub...
    --------------------------------------------------------------------------------------------------------------------
    Download Code
    --------------------------------------------------------------------------------------------------------------------
    github.com/ahmadlogs/arduino-...
    --------------------------------------------------------------------------------------------------------------------
    Disclaimer
    --------------------------------------------------------------------------------------------------------------------
    Disclaimer: All videos are for educational purposes and use them wisely. Any video may have a slight mistake, please take decisions based on your research. This video is not forcing anything on you.
    Warning: I will use High Voltages which if incorrectly or improperly used could result in serious injuries or death. So be careful of what you are doing because I will take no responsibility for any of your actions.
    Warning: In some countries it is required to register gsm module from govt authorities before using it. So, get proper understanding of govt laws related to gsm technologies.
    #esp32 #sim800l #homeAutomation

ความคิดเห็น • 103

  • @suyashmirajkar7857
    @suyashmirajkar7857 ปีที่แล้ว +2

    No words man.. you did every possible things with sim800L. and you provide openly.. salute to your efforts. we understand how much time you spend to doing this... thank you...

  • @heilmannsvej
    @heilmannsvej ปีที่แล้ว +1

    nice projekt but after power los i need to reset the esp 32 board. is there a way to solve this problem

  • @user-nd1ol2vw9h
    @user-nd1ol2vw9h 6 หลายเดือนก่อน

    Hi Ahmad, I did step by step the project, but when I send "Relay1 on" nothing happens and in serial monitor I can see: AT+CMGR=36, +CMGR: "REC Unread", "+my phone number", "", "date, time", Relay1 on. Could you advise what type of error is it? Have you faced with the issue?

  • @passaw7
    @passaw7 2 ปีที่แล้ว

    THANKS!! Your sketch is working with esp32 and sim800L. Its help me.

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      Glad it works

  • @bbdas52
    @bbdas52 ปีที่แล้ว

    its ok, but i need SIM800L with esp32 connected with wifi relay for distance light

  • @OUTER50UL
    @OUTER50UL 10 หลายเดือนก่อน

    hey rather than AC power would using just the relay be able to remotely power off a PC or a TV(something with a soft off button) ?

    • @AhmadLogs
      @AhmadLogs  10 หลายเดือนก่อน

      yes you can

  • @gulzaibkhan6913
    @gulzaibkhan6913 2 ปีที่แล้ว +1

    Hello, nice video brother. Can you kindly let me know if we can connect the GSM SIM800L module with node MCU ESP32 using the same configuration? And the code? We want to get the GSM internet, 2g/3g signals from the sim and use it with ESP32. kindly help

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      yes you can. I did not test it. but it must works with nodemcu esp32

  • @retrohd1_
    @retrohd1_ 2 ปีที่แล้ว +1

    Help!
    I don't get a reply message from the sim800L module.
    I have used a 3.7V LiPo Battery with the SIM800L.
    ESP32 is powered by the USB port.
    Red light is constantly blinking on the sim800L with 3 second intervals. Both LEDs on ESP32 are turned on.
    I am using a jazz sim.
    I am using the helical antenna that came with the module.

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      It mean your module is working fine. I think there is some issue with your rx and tx connections.
      1. your sim card must have balance or you activate sms bundle.
      2. Try changing the baud rate
      3. check your rx and tx connection, Try to connect without breadboard

    • @retrohd1_
      @retrohd1_ 2 ปีที่แล้ว

      @@AhmadLogs UPDATE:
      It worked! 😄 I made the ground common and set the baud rate to 115200.
      Thankyou!!! I wanted to use this in a bigger project for long distance communication.

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@retrohd1_ bravo

  • @anas.ghouila
    @anas.ghouila 3 ปีที่แล้ว

    Greatt job! i've a question: it is possible and safe to supply the gsm module with battery 5v and 10000 mAh ?

    • @AhmadLogs
      @AhmadLogs  3 ปีที่แล้ว +1

      most of sim800l works with 3.4v to 4.4v. there are just few sim800l that works on 5v. if you provide 5v to sim800l it does not work properly. try to provide between 3.3 to 4.4v

    • @anas.ghouila
      @anas.ghouila 3 ปีที่แล้ว

      @@AhmadLogs should i power it with a battery 3.7 v and 7000 mAh?

    • @AhmadLogs
      @AhmadLogs  3 ปีที่แล้ว

      @@anas.ghouila yes, I am using 7800mAh

  • @alessiom
    @alessiom 2 ปีที่แล้ว

    Great video, Can you know if the module works with thingsmobile SIM?

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      unfortunately not.

  • @user-pb6ly4qh9b
    @user-pb6ly4qh9b 2 ปีที่แล้ว +1

    How many lamps can I control at the same time or each one in sequence?

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +2

      you may use 8 channel or even 16 channel relay module with external power to relay module. you also need to modify the code for your number of relays

  • @renwanangozy3394
    @renwanangozy3394 ปีที่แล้ว

    hello dear
    Sorry I had a question I want to control an electrical device through esp32 and GSM800L by phone my code and things all worked well the first time but then sent a delay complaint the problem is with GSM or esp32 if you can help me I would be grateful

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      give me some more detail. what do you mean by sent a delay conplaint?

  • @alimoaz
    @alimoaz 2 ปีที่แล้ว

    Hi, Please reply!!!
    I have been stuck for day on my GSM module SIM800L. I have tried using JAZZ 4G,2G, UFONE and ZONG sims but is not connecting to the network. I tried using using this exact code and wiring connecting and powered my GSM module with 3.7 volts lithium battery.
    Kindly tell me what should I do?
    PS. I have even registered my GSM module with PTA.
    I am also using only helical antenna which is soldered on the connector pin.

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว +1

      most of the time it is power issue. which battery you are using to power sim800l

    • @alimoaz
      @alimoaz 2 ปีที่แล้ว

      @@AhmadLogs The LED on SIM800L is blinking after each second.
      I am using the battery "ICR18650P-TS13" which gives 3.7V.

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@alimoaz try to use a capacitor (470uf 25v). connect capacitor negative pin to sim800l ground and capacitor positive pin to sim800l vcc pin.

    • @alimoaz
      @alimoaz 2 ปีที่แล้ว

      @@AhmadLogs okay now the markets are closed... I will do this first thing in the morning and let you know about the result

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      ok

  • @celtafrancisco5336
    @celtafrancisco5336 ปีที่แล้ว

    I'm getting this type of error:
    invalid conversion from 'int' to 'SerialMode' [-fpermissive]

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      This is just a syntax error. You have made changes in the code, and you have added some invalid code in the main sketch. I will have to take a look at your code to figure out the issue

  • @nagarava
    @nagarava 2 ปีที่แล้ว

    Sim800l working on 2g sim ?, now all the operators using 4 g Sims only what can I do?

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      then you might use sim900A

  • @moussaab8292
    @moussaab8292 3 ปีที่แล้ว

    Please, I have a problem when writing pineMode (7,OUTPUT) The relay works directly without typing HIGH

    • @AhmadLogs
      @AhmadLogs  3 ปีที่แล้ว

      you must use normally closed (NC) and common (COM) pin to connect ac load.

    • @moussaab8292
      @moussaab8292 3 ปีที่แล้ว

      @@AhmadLogs
      The relay is closed immediately when writing pinMode

    • @AhmadLogs
      @AhmadLogs  3 ปีที่แล้ว

      @@moussaab8292 after pinMode() function, on the next line add digitalWrite() to send HIGH signal to control the relay.

    • @moussaab8292
      @moussaab8292 3 ปีที่แล้ว

      @@AhmadLogs
      Thank you for helping me the relay no longer closes but does this affect the code while writing it in void loop

    • @AhmadLogs
      @AhmadLogs  3 ปีที่แล้ว

      @@moussaab8292 no it does not.
      have you test the relay without any micro-controller?

  • @karandahiwale8770
    @karandahiwale8770 2 ปีที่แล้ว

    Can we do the same with nodemcu and gsm800

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      no, you need to modify the code

  • @ghstrider100
    @ghstrider100 3 ปีที่แล้ว

    Sir kia aap received message ko aik variable me save karna bata sakte hain.. Btw I subscribed nice video!

    • @ghstrider100
      @ghstrider100 3 ปีที่แล้ว

      Mere paas bhi SIM800L hai

    • @AhmadLogs
      @AhmadLogs  3 ปีที่แล้ว

      I have save sms in one variable. read the code carefully, message is stored in "msg" variable.

    • @AhmadLogs
      @AhmadLogs  3 ปีที่แล้ว

      @@ghstrider100 hmmmm....

    • @ghstrider100
      @ghstrider100 3 ปีที่แล้ว

      Sir can you make a tutorial on just to save a message in a variable? That would be so helpful

    • @AhmadLogs
      @AhmadLogs  3 ปีที่แล้ว

      @@ghstrider100 OK, I will try to make a video on it soon.

  • @yusufgedik8511
    @yusufgedik8511 ปีที่แล้ว

    Hello. I want to add DHT 11 temperature sensor in this code, but I couldn't, can you help me?

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      1. Connect the DHT11 sensor to your Arduino
      2. Download and install the DHT library for Arduino from the Arduino IDE library manager.
      3. Include the DHT library at the beginning of your code by adding this line: #include
      4. Define the DHT11 sensor pin by adding this line at the beginning of your code: #define DHTPIN 2
      5.Initialize the DHT11 sensor by adding this line to your setup() function: dht.begin();
      6. Read the temperature and humidity values from the DHT11 sensor by adding this code to your loop() function:
      float humidity = dht.readHumidity();
      float temperature = dht.readTemperature();
      7. Send the temperature and humidity values to the SIM800L module by adding this code to your loop() function:
      sim800l.print("AT+CMGS="+1234567890"
      "); // Replace with your phone number
      sim800l.print("Temperature: ");
      sim800l.print(temperature);
      sim800l.print("C, Humidity: ");
      sim800l.print(humidity);
      sim800l.write(26);
      Note: Replace the phone number in the code with your own phone number. Also, adjust the code to fit your specific project requirements.

    • @yusufgedik8511
      @yusufgedik8511 ปีที่แล้ว

      @@AhmadLogs when i send dht11 sms send me the values ​​as sms same as role hungry

  • @mehdidehghanian8365
    @mehdidehghanian8365 2 ปีที่แล้ว

    Hi
    I got this eror 👇
    Use of undeclared identifier 'parseDada'
    Use of undeclared identifier 'extractSms'
    Use of undeclared identifier 'doAction'
    Use of undeclared identifier 'Replay'
    Please help me, i need to fixed for my project

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      you have made some severe change in the code. that's why you are facing the issue. so download and use the fresh copy of the code

  • @BABATECHNICALKNOWLEDGE
    @BABATECHNICALKNOWLEDGE 2 ปีที่แล้ว

    Nice video esp32 communicate with sim 800 but relay output not working plz help me relay not on or off

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      please give me some details

    • @BABATECHNICALKNOWLEDGE
      @BABATECHNICALKNOWLEDGE 2 ปีที่แล้ว

      @@AhmadLogs thanks for reply OK what details you need I send you

    • @BABATECHNICALKNOWLEDGE
      @BABATECHNICALKNOWLEDGE 2 ปีที่แล้ว

      @@AhmadLogsserial monitor show i send msg relay1 on but relay also is on

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@BABATECHNICALKNOWLEDGE have you connected the relay correctly?

  • @lamismohamed1350
    @lamismohamed1350 ปีที่แล้ว

    can i use the code with gsm sim900a ?

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      dtmf th-cam.com/video/Hq1ZGWWc0e4/w-d-xo.html

  • @nouuchhiengsung31
    @nouuchhiengsung31 3 ปีที่แล้ว

    Can you tell me about AT comment to delete all sms

  • @crazytronics9917
    @crazytronics9917 2 ปีที่แล้ว

    I follow the same but the serial monitor shows me another data

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      can you please tell me what data is displaying in the serial monitor

    • @crazytronics9917
      @crazytronics9917 2 ปีที่แล้ว

      @@AhmadLogsI have tried serial port 1 & 2 but both are printing the same

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@crazytronics9917 what is printing on serial monitor

    • @crazytronics9917
      @crazytronics9917 2 ปีที่แล้ว

      @@AhmadLogs guru meditation error load prohibited

    • @crazytronics9917
      @crazytronics9917 2 ปีที่แล้ว

      @@AhmadLogs i have sent you the pics of serial monitor on your facebook

  • @fazlerabbie2808
    @fazlerabbie2808 11 หลายเดือนก่อน

    can i use the code in esp8266

    • @AhmadLogs
      @AhmadLogs  11 หลายเดือนก่อน

      no. watch this for esp8266 th-cam.com/video/7CXlOPPGdN4/w-d-xo.html

  • @killgroth8092
    @killgroth8092 ปีที่แล้ว

    I try it so many times but is not replying me everytime i send sms and nothing happens on relay huhu help me

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      what displayed in serial monitor

  • @user-qs3wl7fo7t
    @user-qs3wl7fo7t 3 ปีที่แล้ว

    👍👍👍👍👍👍👍💪

  • @alirezasarrami1955
    @alirezasarrami1955 2 ปีที่แล้ว

    hi
    can i use this code for esp32 wrover

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      yes, It must work

    • @alirezasarrami1955
      @alirezasarrami1955 2 ปีที่แล้ว

      @@AhmadLogs tanx

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@alirezasarrami1955 so nice of you

    • @alirezasarrami1955
      @alirezasarrami1955 2 ปีที่แล้ว

      @@AhmadLogs hi again
      i use your library to connect whit sim800l but UARAT pin's are Different in esp32 WROVER
      i changed the pin's but it did not work
      what should i do ?
      is sim800l work whit UART or virtual UART in your library?

    • @AhmadLogs
      @AhmadLogs  2 ปีที่แล้ว

      @@alirezasarrami1955 sim800l works both with hardware serial and software serial. have you sim800l working? may be issue with power supply for sim800l

  • @esp3263
    @esp3263 ปีที่แล้ว +2

    Excelent! One remark: For me the "senderNumber = buff.substring(0, 13);" was too short, my phone number has 14 digits.

    • @Gusfus128
      @Gusfus128 ปีที่แล้ว

      exact. That happens to me too. How did you solve it?

    • @esp3263
      @esp3263 ปีที่แล้ว +1

      @@Gusfus128
      --> senderNumber = buff.substring(0, 14); and next line:
      --> buff.remove(0,20);
      worked for me.

    • @Gusfus128
      @Gusfus128 ปีที่แล้ว +1

      @@esp3263 thanks!!

    • @AhmadLogs
      @AhmadLogs  ปีที่แล้ว

      then you can use buff.substring(0, 14);
      you also need to change the subsequent substring function as well

    • @EL90291
      @EL90291 11 หลายเดือนก่อน

      Will this work with esp8266 ?