How to Make a Proximity Alarm Using Radar and LoRa
by radicalroundcat in Circuits > Gadgets
72 Views, 2 Favorites, 0 Comments
How to Make a Proximity Alarm Using Radar and LoRa
Here's how to make a human presence detector that can remotely alert you of someone being nearby a specific location.
Why on earth would you need this?
Well, for one, you might be taking a walk in a nearby park and will want to monitor the position of a pet at home.
Or, you might be committing a crime, like a bank heist, and need something to alert you when law enforcement is approaching.
Inversely, if you are a bank owner, you might want a system that can detect any intruders!
Regardless of your use case, you should make this anyway, 'cause its so cool, featuring a LoRa and Radar module.
Supplies
Note: when selecting a LoRa module, be wary about the certain frequency range it operates on. I live in the US, so its safest to transmit around the 915mhz range.
And some jumper wires
Configuring the LoRa Boards
Before using your LoRa module, you might want to configure some of its properties, such as its baud rate and its channel. This can be done using code, but it's easier to just use the software provided by Ebyte. You can always skip this step if you don't need to change any of the default settings.
https://www.cdebyte.com/download_serch/E22/4
Wiring the Transmitter
The transmitter will be the device that uses the radar to sense anyone nearby.
Wiring the it is pretty straightforward. Simply connect the E220's TX and RX to 6 and 7 of the ESP32-C3, and ground its M0 and M1 pins, and make sure to keep its AUX pin floating (I learned that the hard way).
As for the LD2420, its TX (OT1) and RX will be 4 and 5.
Programming the Transmitter
Create a new Arduino project. I personally use PlatformIO since believe it or not, I don't know how to use the Arduino IDE. Still, the process should be about the same.
Set the board to "ESP32C3 Dev Module", set the monitor speed to 115200, set "USB CDC On Boot" to "Enabled", and "USB Mode" to "Hardware CDC and JTAG"
Then, flash the following code to your esp32c3:
Wiring the Receiver
The wiring for the E220 is mostly the same as the the transmitter counterpart. However, we now have an oled display instead of the Radar, and its SDA will be connected to Pin 8 of the esp32, and its SCL will be Pin 9.
Programming the Receiver
Create another Arduino IDE project, with a mostly similar same configuration as the transmitter's.
For the receiver, I used the Adafruit SSD1306 library
The code is slightly longer but is still relatively simple.
By the way, here's a helpful site for generating drawings for the SSD1306
Modelling an Enclosure in Autodesk Fusion
I wanted my project to fit on a 400 pin breadboard with the rails on each side of it removed, so I designed an enclosure around those dimensions. I also left a hole for the E220 to protrude from, and a hole on the lid so the display was visible.
You can also convert it into a PCB or something, but that's too hard for me so I'll stick with the breadboard for now.
I'll attach my step files here, conveniently, the same enclosure works for both the transmitter and the receiver.
3D Print the Enclosure
Assembly and Testing
Insert everything into the enclosure and put the lid on. It's best to mount the receiver on a wall as shown in one of the pictures above. It'll send the distance between it and any moving object, in centimeters, to the receiver.
If the receiver receives a signal, it'll display "Person Detected!!" and write the distance between the receiver and the subject. However, this will also pickup pets or anything moving that shouldn't be.
The E220 is a very powerful module, and can theoretically reach 5 kilometers in a rural area (or anywhere without significant obstructions), so go outside and test it out!!