Ever wondered how to get Arduino to communicate wirelessly over hundreds of meters? Ever wanted to create a small IoT device, but then bit discouraged by just how much power the long range communication takes? Or do you just want to build a robot that could be controlled from your comfy chair while it drives outside and explores the world? Well, there is a solution! Here I present to you “LoRenz – Arduino shield” that can do all of that and much more. And the best part of LoRenz is that both the software AND the hardware are completely open-source!
What exactly can this shield do? It is compatible with both Arduino UNO and Mega, and provides means of communication over several hundreds of meters, while keeping the power cost as low as 80 mA while transmitting. That is about as much as 5 average LEDs – all of that packaged together with a library that makes the whole thing extremely easy to use, even for beginners. Really! You want to send a message? Type a command! Boom, done!
Before we get started, there is something that has to be said: even though LoRa technology operates in the license-free bands like 433 or 868 MHz (usually called ISM – Industrial, Scientific and Medical), some legal restrictions may apply in your area of residence. These may include power output restrictions, bandwidth limits, or even restrictions on the type of data you can transmit and receive. Since I don’t know which state or country you live in, I can only give you the most general advice:
Always follow the current legal regulations in your area of residence!
Neither the author, nor DevicePlus.com takes any responsibility for your actions while using LoRenz shield or LoRaLib.
Now that we have the legalities out of the way, let’s start at the core of this shield functionality – the LoRa modulation.
LoRa – an obvious shorthand for Long Range – is a clever type of modulation of electromagnetic signals. Modulation of a signal is itself a really clever way of encoding more information into wireless signals. Different types of modulation have been around for quite a while, in fact, they date back all the way to the late 1800s and the invention of the radio. In fact, most people are familiar with the term modulation precisely because of radio: ever heard of AM (amplitude modulation) or FM (frequency modulation)? With amplitude modulation, the information is encoded by changing the amplitude of the carrier wave. Similarly, with frequency modulation, only this time, the frequency of the carrier wave is being changed. The main reason for using modulation is that we can “fit” low-frequency information – like voice or music – into a high-frequency carrier wave.
So then, which one of these is LoRa? Well, none of them. LoRa is a different type of modulation, although it shares some similarities with FM. LoRa is actually a CSS – Chirp Spread Spectrum modulation. The technology itself is proprietary and patented, but the basic principle is that information is encoded using chirp – a gradual increase or decrease in the frequency of the carrier wave over time.
This modulation is extremely resistant to noise and even to the Doppler effect, making it really useful when communicating over long distances using low power. Fortunately for us, modules incorporating this technology are very cheap and easily available. The most widely used one is the SX1278 chip manufactured by Semtech and modules with this chip can be bought as cheap as 7 USD. Just google the phrase “SX1278 module”, I’m sure you’ll see a lot of shops selling them.
Now that we have a basic idea of what LoRa is and how to get it, let’s take a look at the shield itself – for start, how do you actually get your hands on one?
Unfortunately, you can’t just buy one of these shields in a store, simply because no one is actually producing them. This shield is completely custom, so if you want to get one, you will have to download the Eagle files from my GitHub, buy all the components, get a PCB manufactured somewhere and solder everything together. The total price for components on this shield should be around 20 USD, so it’s not the most expensive shield out there. In fact, while I was developing this, the most expensive part was actually shipping the PCBs. But even including that, the total price per one shield should not exceed 30 USD – depending on where you live, of course.
Let’s go through all the parts on this shield, to see what they actually do:
Another part you will need is what I call a breakout board. Since there are several different types of SX1278 modules on the market, we need some sort of an “adapter” to allow you to connect any of them to the LoRenz shield. That’s where this little guy comes in. The breakout board is a PCB onto which you solder the SX1278 module and then simply insert the whole thing into the slot on the shield. These breakout boards also feature a small connector for coaxial cable, so you can connect an external antenna for even longer range!
All of that sounds pretty good, right? Well, there’s still one more very important part missing. Hardware is usually pretty useless without software. In the next part, I’ll introduce LoRaLib, an open source Arduino library I developed for the SX1278. With its user-friendly API, we can start experimenting with LoRa communication.