Introduction: Long Range Machine Control System Using Multiple LoRa Modules

As global warming increases and our planet continues more and more to resemble Mars, there may well be a need for Earth based rovers to search out water supplies or help herd goats on ever increasing expanses of semi -desert. Also, many rural parts of the world do not have access to 3G/4G cellular data connections and Starlink type systems are currently prohibitively expensive. The solution where I myself live seems to be to use an array of custom generated radio waves to transmit data back and forth to my loyal rovers and other stationary machines / devices .... or even fellow humans.

Step 1: Aim of Project:

To transmit chunks of GPS correction data in parallel from one static GPS module to another one bolted onto a distant machine roving about the landscape using multiple LoRa modules.

Step 2: Hypothetical Solution:

In the absence of a Starlink satellite system, LoRa radio can be used to transmit the correction data to the machine. Initial tests showed this was possible using just one pair of radio modules relatively close together and it seemed logical that greater range could be achieved by using a small RF amplifier AND extra radio modules. The data would need to be split up into chunks and fed to each of the transmit radios and then re-assembled after being received on the machine. To enable greater transmit distances, the LoRa spreading factor needs to be increased, but this has an adverse effect on transmit time and any data with a greater lag of about 5 seconds is rejected by the GPS receiver. The spreading factor can be gradually increased as more and more radio modules are added and the current design (not yet shown) can have a total of 22 radio modules which equates to 11 transmitters and 11 receivers. How much band width will be required is not yet known. Will the whole thing just explode into a puff of purple smoke? - this is also not yet known.

Step 3: More Details:

Designed to control machines in post apocalyptic environments, or just where I actually live, these gadgets integrate 4 or more LoRa radios controlled by Mega 2560 MCUs with a Raspberry Pi via ROS (Robot Operating System) so that messages, or data, can be sent over long distances in such as way that outgoing messages do not block incoming messages - it's true duplex. Most LoRa modules are only half duplex, in that simultaneous receive (Rx) and transmit (Tx) is not possible. It might well be possible to use a 'Concatenater', but that will be something for the next upgrade.

There's always a compromise between range and data speed and this system is not designed to be fast or 'Real-time' and there is significant lag between sending and receiving messages. Imagine we are controlling a rover on Mars, but rather than 15 minutes of lag, we have about 10 seconds. In a disaster area such the aftermath of hurricanes, where key infrastructure has been destroyed, this system could be used to relay encrypted messages back and forth to other distant locations without the need for setting up any kind of network, which is what is meant by the term 'Peer to Peer'. However, this does not mean that simple networks could not exist as time after the singularity ticks on.

Each module also has Joysticks and a slider pot so that we can control our Mars Rover from Earth. Obviously, the Rover or 'Dog' does not need the joysticks unless some aliens need to control similar machines on Earth. There is also a vast array of blinkenlights for diagnostics and general notification that stuff is happening, which may also be quite entertaining for the Martians.

This equipment can be used to transmit and receive data and verify the integrity of the data by making call backs. But also can perform actions based on what the data presents. For example, if water levels in a river are determined to be getting to critical levels, various alarms and messages can be created via ROS and sluice gates could be opened to divert water away from settlements..

ROS is installed on the Mega 2560's as the 'Rosserial' library and on the Raspberry Pi as ROS Melodic. Communications between the 3 modules happen via USB and ethernet via a router. Other features on the gadgets include a choice of two medical grade power supplies, an RF amplifier for the LoRa Tx and a choice of two surface mounted RF band pass filters.

This system is designed to be as self contained as possible and so 3G/4G/5G was not considered to be a viable option. We did actually try WIFI a couple of years ago, but the neighbors started complaining about machine data interfering with their Netflix. They obviously did not realise that there would be no more Netflix after the climate change Armageddon, but never mind. The problem was that the range of the WIFI was very poor without using high powered RF amplifiers. Also, I live on an island in the middle of the Irish sea and 4G connections are very poor / non existent and, again, this kind of infrastructure would easily be destroyed by hurricanes, hackers, emergent Ai intelligence or invading aliens.

Being realistic, it's probably not going to be possible to put a Starlink system on each and every Rover (dog) and it does take at least 3 Rovers to effectively herd goats. Maybe this would be possible in 5/10 years in the future but my cryogenic sleep chamber has been malfunctioning so I chose to use the tools that were available to me right now and within a reasonable budget. Luckily, data from positioning satellites is completely free and fairly straight forwards to process. This project takes terrestrial positioning to the next level by incorporating a positioning correction system which sends data to the Rover from a stationary reference point. Goats can now be herded to a precision of plus / minus 10mm !

Step 4: Main Modules: Nest

Nest (Mission Control Centre):

  • Raspberry Pi ROS Master ..... communications with the Arduino modules via ROS
  • Raspberry Pi ROS Slave ..... communicates with the Ublox module via serial USB
  • Arduino Mega 2560 Tx ..... Handles the LoRa Tx module via SPI
  • Arduino Mega 2560 Rx ..... Handles the LoRa Rx module via SPI
  • LoRa radio module Tx
  • LoRa radio module Rx
  • Ublox ZED F9P GPS module
  • Joysticks x 2
  • Analogue sliders x 2

Step 5: Main Modules: Dog

Dog (Roving machine):

  • Raspberry Pi ROS Master ..... communications with the Arduino modules via ROS
  • Raspberry Pi ROS Slave ..... communicates with the Ublox module via serial USB
  • Arduino Mega 2560 Tx ..... Handles the LoRa Tx module via SPI
  • Arduino Mega 2560 Rx ..... Handles the LoRa Rx module via SPI
  • LoRa radio module Tx
  • LoRa radio module Rx
  • Ublox ZED F9P GPS module
  • RF amplifier (not shown)
  • RF band pass filter (not shown)
  • High Grade 8 A, 5V Power Supply

Step 6: How to Replicate This Project:

In theory, anybody wanting to copy this project should send the PCB Gerber files to their favorite PCB manufacturer (I normally use JLC PCB, who are excellent), buy the various components and get a set of SD cards from myself to get up and running nice and fast. However, to configure the Ublox ZED F9P modules a windows computer is required on which Ublox Ucenter software needs to be installed and this takes a certain amount of fiddling about with. Ucenter is NOT easy to use and has a vast and complicated menu for configuring and flashing the modules. Also, Ucenter is NOT available for Linux. Alternatively, the ROS Melodic environment can be installed on a fresh Raspberry Pi and my various packages copied and pasted into the correct folder in the catkin workspace folder and the ROS environment re-made using catkin_make. This process WILL NOT be documented here as there are really good tutorials on the ROS WIKI for doing this. In order to start customizing this project, people would need to learn ROS and follow all the beginner and intermediate tutorials. This process should take between one and two working days and I found them fairly straight forward myself. The project as a whole is suitable for intermediate developers and good knowledge of python, C++, using the Linux operating system, basic soldering skills, basic electronics skills but no expert skills in any part of the project.

Going back to the modules once more, people might be wondering "Why have so many modules - surely it could just be done with a single Raspberry Pi and a Ublox ZED F9P?" . This observation would be perfectly true, but to expand the system would then be blocked as their would be no ROS. I chose to keep the Master Raspberry Pi free of too many other complications so that it's CPUs could concentrate on ROS and not get distracted by other processes too much. As time goes on, the system as a whole WILL expand and it will be important to monitor the modules to make sure they are not getting overloaded - the obvious symptom is that they periodically crash - maybe the Master Pi can be configured to bring them back to life - who knows?

The project files can be found on Github

Step 7: Demo of System Working With One Module Pair

Step 8: Upgrading to Four Module Pairs

In this latest iteration of the basic design, the large PCBs from PCBWay were stacked 2 high as shown above, but if we count all the PCB layers, there are about 7 in total which will give a total of 12 LoRa radio modules. But this is not the end of it, more of the large custom PCBs can be added to extend the LoRa modules by 6 for each PCB added. This entails A LOT of 3mm brass stand offs and USB hubs and very kindly, Liam at PCBWay sponsored this project by supplying these aforementioned components and the large PCBs for free. Thank you Liam !!! Nonetheless, the LoRa modules are quite expensive, as are the 'MEGA 2560 PRO Embed CH340' modules that control them and so I chose initially to test on just four modules working simultaneously which should also make programming a bit easier to start with. I also had a bit of a scare with the MEGA 2560 PRO modules as in one batch about 50% were defective. Fortunately, this problem was solved by simply removing one of the 3 pronged voltage regulators which got crazy hot after a very short time. If anybody else comes across this problem - just remove the component that gets hot with a soldering iron. Obviously the module can no longer be externally powered other than by USB or 5 volts, but this project does not need to do this.

Getting back to the Layer Cake, on the bottom we have one of the large custom made PCBs from PCBWay. The next layer is the MEGA 2560 PRO modules which can be seen and the Master Rasperry Pi and the MPS 8A 5V power supply which both cant be seen in this photo. The 3rd layer up is another large custom PCB and the 4th the LoRa modules which are at the same level as the slave Raspberry Pi. 5th layer is a 5 way USB hub. The 6th a Raspberry Pi to Arduino footprint adapter and the 7th layer a fancy Ublox F9P GPS module. These layer cakes are in pairs and there is one, with the joy sticks fitted, that sits in the control room, or 'Nest'. The other requires no joy sticks and sits on the machine, the 'Dog', wherever that might be. The whole point of this project is to get correction data transmitted in parallel from the Nest to the Dog.

Step 9: Proof of Concept Achieved !!

Yay ..... The system now has four LoRa modules sending data to another set of four modules in parallel!

In the previous update I had one module working at a spreading factor (SF) of 7 and bandwidth of 500 KHz transmitting every 5 seconds or so. Now I managed to ramp up the SF to 9 and pull down the bandwidth to 125 KHz, with a similar transmit time. Strangely, no parallel programming was required, even though the modules themselves run in parallel, which is a bit counter-intuitive. During testing, other than actually getting a GPS 'Fix', I developed some simple indicators to check that the data was coherent such as detecting non - standard characters, checking for missing data chunks and measuring the time taken to transmit each chunk. The sleep time in the python script that performed the task of breaking the data down into chunks set the overall rate of the whole system and was simply the time recorded for each transmit divided by four. Having plenty of Blinkenlights available was useful and red LEDs were flashed on the receiver side every time a data chunk was missed - which was thankfully very rare!

The whole system could now be scaled up to get the maximum perfermance out of the LoRa modules ie a SF of 12 and this would required about 32 x 2 modules (SF 9 = 4 modules, SF 10 = 8 modules, SF 11 = 16 modules, SF 12 = 32 modules). However, it's getting to be expensive and for the time being tests out in the wild can be done with the current 2 x 4 set up. The next step is to sling the dog controller into a suitably sized enclosure and bolt it onto one of my robots ...... Hmmmmmn ..... which one will I choose ??

Step 10: Next Challenge

The system is now almost ready to test out in the wild. Watch This Space!

Remote Control Contest

Participated in the
Remote Control Contest