book collections email follower instructable user
Picture of LoRa + Neural Network Security System

This blog shows how to build a security system based on detecting or 'inferring' the location of a person using a neural network USB pluggin stick on a Raspberry Pi. An Arduino type receiver is built from scratch to get data from the Raspberry Pi transmitter via the long range LoRa radio frequency protocol and show/sound an alarm. I've tried to show some of the thinking behind the project by laying it out 'as it happened' and there are a full set of python, arduino and PCB etc. files for implementation. The most up to date files will be here on GitHub:

Level of difficulty: Good, but not expert, Raspberry Pi skills required. Soldering skills = easy.

Most info on the interwebs about LoRa seems to point to the 'Things Network', but what if we just want basic data transfer between 2 devices and don't need the whole world to witness our data? Peer to peer is quite possibly the answer.

In this case, a Raspberry Pi with a Dragonino LoRa/GPS hat will send data about the security state of a remote location (eg farm gate) to tell us if people are coming in or even if someone has stolen one of your cows. The receiver is an Arduino MKRWAN 1300 which has a dedicated LoRa chip soldered onto it. BE WARNED: This Arduino is a 3.3V device and will be destroyed by applying 5v to any (or most of) of the pins. Also, never operate either the Dragino hat or the Arduino device without an antenna attached! As far as code is concerned, both instances are really simple, although it took me a while to work out that I had to flash the Arduino with a firmware upgrade to get it to work properly. After plugging in the Dragonino hat, the Raspberry Pi was processed as follows:

$ wget <a href="<br"> <a href="</a"> <a href="</a"> <a href="</a"> <a href="</a"></a>>>>>>$ unzip master
$ cd rpi-lora-tranceiver-master/dragino_lora_app
$ make
$ cd rpi-lora-tranceiver-master/dragino_lora_app &&./dragino_lora_app
$ ./dragino_lora_app sender</p>

This data is NOT secure, but there are python scripts that can be used if needed.
NB. The RPi MUST have a proper power supply and SPI needs to be activated in the settings. OS used is Raspian stretch. Setting up the Arduino is just as easy. There's just a couple of things to watch out for: Firstly, the Rpi, in my case attempted to transmit 'HELLO' every 3 seconds on 868.1 MHz, so the Arduino needs to be configured accordingly ...... 868.1 MHz = 8681 x 105 = 8681E5. Other regions eg USA will use different sets of frequencies. Download Arduino lora libraries here: (both are required)

After installing the libraries in the normal way, open the MKWAN example set and up load 'MKRWANFWUpdate_standalone' to the Arduino and open serial console. You should see the update as it progresses. Next, find the 'LoRa' example set and select 'LoRaReceiver' and upload. Dont forget to edit the frequency as mentioned before! Open the serial console and you should see the HELLO sent from RPI.

Step 1: Components

Picture of Components
diy_bloke5 months ago
Pretty interesting stuff. Thanks