ESP32LORA PROJECTS

ESP32 Lora Home Automation, Long Rage Lora Sender and Receiver, LoRa SX1278

LoRa ESP32 Home Automation Project

ESP32 LoRa Home Automation:

ESP32 Lora Home Automation, Long Rage Lora Sender and Receiver- So far I have used LoRa Transceiver modules with Arduino, Nodemcu ESP8266, and STM32 controller boards. Today, for the first time I am going to use these Long Range LoRa SX1278 Transceiver modules with ESP32 controller boards.

As you know ESP32 is much more powerful than the ESP8266 and Arduino. It is even faster than the Raspberry Pi Pico and STM32. And as you might know, ESP32 has onboard WiFi and Bluetooth and this is what makes the ESP32 much more popular than all the other controller boards.

So, in today’s article, you will learn how to make a Long range of wireless Home automation systems using ESP32 WiFi + Bluetooth modules, LoRa SX1278 Transceiver modules, 12V SPDT type relays, 110/220Vac Bulbs, and some switches.

allpcb circuit



 

In this project, I am using two ESP32 modules, one as the sender and the other one as the receiver.

ESP32 LoRa

You might have noticed, that I am using two different versions of the ESP32 WiFi + Bluetooth modules. I could use the similar ESP32 modules, but the reason I am using different versions is that to explain it doesn’t matter which one of these you use; the code is going to work just fine.

ESP32 LoRa

You can see 4 buttons on the transmitter side. Using these 4 buttons, I am going to control certain loads on the receiver side. For demonstration purposes, I have put 4 bulbs on the receiver’s side, which are connected to 4 relays. Besides lights, you can use any other 110/220Vac loads or use any other DC type loads.

ESP32 LoRa

If you want to use 110/220Vac supply, you must not forget to use protective gloves, because 110/220Vac can prove fatal. So, as far as possible you must ensure the presence of a friend or any companion while working on such projects. When the AC supply is ON, do not touch the relay contacts. Now, let’s go ahead and kick off our practical demonstration.


Practical Demonstration:

I have connected everything as per the circuit diagrams which I will explain in a minute.

ESP32 LoRa

Now you can see, that I have turned ON the receiver side using a 12V adaptor. And I have also connected the 220Vac. Let me remind you once again. When the 220Vac supply is connected never touch the relay contacts.

ESP32 LoRa


 

You can also use a solar panel or 12V battery to power up the ESP32 controller board as I am using 7805 Voltage regulator.

ESP32 LoRa

I am powering up the transmitter side through a 4S Lithium Ion Battery Pack. You may also use a 3S lipo battery pack or any other type of battery or a DC adopter for this purpose. If you also want to make such a 4S Lithium Ion battery pack, then I highly recommend read my article on 4S lithium Ion Battery Pack.

You can make the transmitter side much smaller by designing your own PCB. And you can use small toggle switches to control the AC or DC loads.

I can randomly turn ON or turn OFF any light and it is working quite superbly.

ESP32 LoRa

I am sure by now, you might have got an idea of how does this system work. So, without any further delay let’s get started!!!


 

Amazon Links:

LoRa SX1278 Module

12v Adaptor

ESP32 WiFi + Bluetooth Module(Recommended)

LM7805 Voltage Regulator

12V SPDT Relay

*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.



 

SX1278 LoRa Module:

In this project, we are using the same SX-1278 LoRa modules for the transmitter and receiver. In order to use it as a receiver and transmitter, we will make changes in the code. Lora SX-1278 long-distance wireless transceiver module integrates Semtech RF transceiver chip SX1278, which adopts LoRa TM Spread Spectrum modulation frequency hopping technique. The features of long distance and high sensitivity (-139dBm) make this module perform better than FSK and GFSK modules. Multi-signal won’t affect each other even in a crowd frequency environment; it comes with strong anti-interference performance. This module is 100mW and ultra-small size, widely used in AMR, remote industrial control field.

ESP32 LoRa

Features:

  • Frequency Range: 868 / 915 MHz
  • Sensitivity up to -139dBm @Lora
  • Maximum output power: 20 dBm
  • 13mA@receiver mode
  • Sleep current <200 nA
  • Data transfer rate: @FSK,1.2-300 Kbps
  • @Lora TM, 0.018-37.5 Kbps
  • Lora TM, FSK, GFSK & OOK Modulation mode
  • Built-in ESD Protection
  • 127 dB Dynamic Range RSSI
  • Packet engine up to 256 bytes with FIFO and CRC
  • Hopping frequency
  • Built-in temperature sensor and low battery indicator
  • Excellent blocking immunity
  • Operating Temperature Range:-40 ~ + 85 °C

Applications:

  • Remote control
  • Remote meter reading
  • Home security alarm and remote keyless entry
  • Industrial control
  • Home automation remote sensing
  • Individual data records
  • Toys control
  • Sensor network
  • Tire pressure monitoring
  • Health monitoring
  • Wireless PC peripherals
  • Tag reading and writing


 

ESP32 LoRa Home Automation Circuit Diagrams:

ESP32 LoRa Transmitter Circuit Diagram:

ESP32 LoRa

This is the transmitter side circuit diagram. I am using 5V regulated power supply based on the LM7805 linear voltage regulator. The output of the regulator is connected with the Vin pin on the ESP32 module.

The NSS pin of the LoRa module is connected with the GPIO5, the MOSI pin is connected with the GPIO23, the MISO is connected with the GPIO19, and the SCK pin of the SX1278 LoRa module is connected with the GPIO18. Make sure the ground of the ESP32 module is connected with the ground pin of the LoRa transceiver module.

On the left side you can see, 4 switches are connected with the GIPO pins 33, 26, 14, and 13. Now, let’s take a look at the receiver side circuit diagram.

ESP32 LoRa Receiver Circuit Diagram:

ESP32 LoRa

The connections of the 5V regulated power supply and SX1278 LoRa transceiver module remain exactly the same.

4 SPDT type relays are connected with the GPIO pins 27, 14, 12, and 13. You can connect AC or DC loads with the Relays Common and Normally Open contacts. You can also see freewheeling diodes are connected across the relays coil pins. You can use 1N4007 diodes. I am using a pair of 10K ohm and 2N2222 NPN transistor to control each relay. So, using these connections you can make your own 4-channel relay module or you can use a readymade 4-channel relay module. Read my article on how to control different types of relays.


 

ESP32 Home Automation Project PCBs:

ESP32 LoRa

Download Gerber files:

These are the PCB boards which I received from the JLCPCB as you can see the quality is really great. The silkscreen is quite clear and the Black Solder mask looks amazing. Next, I started off by placing the components and completed the soldering job. 

Libraries Needed:

Before, you start the programming, first of all, make sure you download the LoRa library.

Download: LoRa.h

Download: Adafruit_GFX.h

Download: Adafruit_SSD1306.h

You will need the LoRa library for the LoRa transceiver modules.The Adafruit_GFX and Adafruit_SSD1306 libraries are used with the Oled display module. So, if you want to display the feedback message on the Oled display then you will need these two libraries. I have added code for the feedback message.

If you are using the ESP32 WiFi + Bluetooth module for the first then you will need to know about the pinout and how to install the ESP32 board manager url link. So, I highly recommend, you guys should read my getting started tutorial on the ESP32.

ESP32 LoRa Programming:

ESP32 LoRa Tx Side Code:


 

ESP32 LoRa Rx Side Code:

Actually, these codes are from my previous project based on the Arduino. I have already explained the programming. I practically demonstrated the feedback message feature, this is an important feature, when you press a button on the transmitter side, the receiver side sends you a feedback message that the desired load is turned ON or turned OFF. I also practically checked the communication range of LoRa transceiver modules. So, I highly recommend you guys need to read my previous article on Lora Home automation using Arduino, if you want to learn the most important things. Anyway.  

If you don’t want the feedback message feature, then simply don’t connect the Oled display module. The code is still going to work. As in my case I am not using an Oled display. So, that’s all about the programming.



 

Watch Video Tutorial on YouTube

 

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

One Comment

  1. Great project, can you please do a tutorial using this same lora method but include relay control with Blynk, so lora and Blynk together.

Leave a Reply

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

Back to top button