RF (Radio Frequency)

Enter Your Project for a chance to win a Spectrum Analyzer for the Most Innovative RF Project!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll


I have it in mind that I would like to create two projects using point to point LoRa communication. The first and what this blog is about is to detect and report movement. The second is to report moisture content of the soil so I know when my allotment needs watering. Hopefully I will get around to this soon. The original idea was that I wanted to know when my elderly mum was up and about so I figured two pir’s in her house one in the kitchen and one in her hall would allow me to know if she was moving around. The problem is that she doesn’t have the internet nor does she want it. So hoping that LoRa will be the answer I ordered two  LORA SX1276/SX1278 433Mhz ESP32 WIFI NodeMcu Module 0.91/0.96OLED Display from eBay and with xmas postage they have only just arrived. I have two PIR’s that send data on 433mhz  and I have already recorded the code they each send when triggered. I also have a 433Mhz receiver which  I just need to hook up to the LoRa board and I will be able to respond to the signal from the PIR’s. The whole thing will look like this:

The boards arrived and I unboxed them and soldered the headers on. As usual there is nothing in the box to tell you anything about the way they operate and what I know about LoRa and RF in general would comfortably fit on a post-it note. So I searched the internet for the string in bold above and I landed on https://randomnerdtutorials.com/esp32-lora-rfm95-transceiver-arduino-ide/ which led me to https://randomnerdtutorials.com/ttgo-lora32-sx1276-arduino-ide/ . Both of these are excellent tutorials which I couldn’t hope to improve on so I won’t try. I copied Rui’s code for the sender and receiver sketches and set my Arduino IDE to program the ESP32 as per the tutorial and hey presto they are talking to each other. I often think of myself as Dr Frankenstein I take a bit from here and another bit from here add electricity and hope it comes to life. I had already played around with the 433Mhz rx and tx boards so I had the RCSwitch library in my IDE. So I added a few lines to Rui’s code and connected the rx board to the sender ESP32 uploaded the sketch and to my surprise My monster came to life!

With not much time left I started tweaking the sketch removing lines that weren’t required then when I uploaded the sketch everything stopped working. To start with I was misled because it looked like the triggers from  PIRs had stopped. Then I thought it must be my sketch changes so I reverted back to the original unmodified script (creating a new file first to save the original sketch into). It didn’t work still. It was as if only part of the code was being loaded in the ESP32. I have never encountered this before but I could see part of the sketch was working i.e the startup messages but nothing was being sent. I did some research on the web but didn’t find anything then I was reminded about holding down the rst button just before uploading which is really to solve a missing com port. It worked but I have no clue why (maybe voodoo). So I went back to my modified sketch only it wasn’t. Somehow both sketches were unmodified. How I had managed that I don’t know. Rushing probably. Anyway it was easy enough to add my few bits of code back into the sketch. I then uploaded whilst pressing the voodoo button

As you can see by the video below the PIR triggers and a message appears in the receiver ESP32 to say which PIR was triggered.


I have attached a text file containing the sender sketch that I have generated so far but it’s not finished by a long chalk. The receiver sketch is unchanged from Rui’s sketch.


So what’s next? The LoRa boards are working on my bench but do they work when the distance is greater than a few feet? The PIR triggers are visible but unless I’m watching them all the while I couldn’t make any sense of the information. so I need a database recording the time of the triggers.

I was going to design a case but I found a really nice looking one on thingiverse https://www.thingiverse.com/thing:2670713   the author advises caution when fitting the module into the case as it is easy to break the screen. I was going to print a couple off this afternoon but with all the messing around......... update I printed one off but wasn’t pleased with the fit of the lid!

In the end this is not the project I was hoping to create. I will continue with the project firstly cos I want the final project outcome and secondly because I need the blogging practice.


footnote: for those none uk readers patient enough to have read this far Lorra is Liverpudlian for ‘a lot of’ made famous by Cilla Black a Liverpool singer who often said “Lorra Lorra laughs” meaning very funny.