What is Lorawan
First of all, what is Lorawan. It is a wireless technology that allows small amounts of data to be sent between a remote sensor (such as a river level detector), and the Internet.
Lorawan technology is very efficient at sending the sensor data over long distances, whilst consuming very little power. This means that a the sensor devices can be battery powered, whilst the batteries last for years.
What is a Gateway then
A Lorawan Gateway is the device that receives the wireless signals containing data, that has been transmitted (using Lora wireless technology) from the remote sensors (river level monitoring, air quality etc).
Once the Gateway has received the wirelessly transmitted data, the gateway forwards the data onto the Internet.
Gateway connection to the Internet can be via a variety of means, such as Wifi, Ethernet, 3G, 4G, 5G etc.
Building the DIY Gateway
For beginners to building their own DIY gateway, I would recommend joining, or founding a local Things Network .
The Lorawan Gateway that I am going to describe here, is designed to operate on the Things Network, however other lora networks can easily be installed.
The main components that you will need are:-
1) A Concentrator board from IMST of Germany. The Concentrator board is the wireless communications part of the system, responsible for receiving the wireless data signals, from the remote environmental sensors (Air quality sensors etc).
2) A small computer to store the software that controls the Concentrator board. We are going to use the UK designed Raspberry PI 3.
A Micro SD Card, for holding the software used by the Raspberry PI. A small 4 GB card is fine.
3) A suitable Antenna (or Aerial), with pigtail connecting cable.
4) A suitable 2 Amp rated power supply, with a micro USB connector.
5) 7 Female to Female connecting leads, suitable for raspberry PI.
4) A suitable case, to house the components.
The first thing I need to make you aware of is the risk of static electricity, to your IMST ic880a Concentrator and Raspberry PI.
Static can damage the sensitive electronic components, therefore it is advisable to take precautions, such as not touching the board components, and wearing an anti static wrist strap.
The first thing you need to do is to format the micro SD card, that will be fitted to the raspberry PI, to hold the gateway software.
The SD card association has a free piece of software, for Windows PC and Mac, to do this. My card was already formatted, so I skipped this step.
The next step is to burn the actual software that will power your gateway, onto the Raspberry PI.
To do this, I used https://etcher.io/
I first installed Etcher onto my linux desktop computer. As most people use Windows PC, or Mac, you will need to find a suitable alternative to Etcher.
I also downloaded the operating system needed to run the Raspberry Pi, which is called Raspbian Stretch Lite , onto my desktop PC.
Put your micro SD card into your computers micro SD card reader. If your computer (like mine) does not have a card reader, then external USB plug in ones can be purchased cheaply (I got mine from my local Asda supermarket for £6).
Fire up Etcher, or whatever card burning software you prefer, and select the copy of Raspbian Stretch Lite , that you previously downloaded to your PC.
Follow the instructions, and burn the operating system software onto the micro SD card.
Once you have successfully burned your Raspbian Stretch Lite, onto your SD card, insert it into the Raspberry Pi (the slot is on the underside of the Pi).
The next thing to do is to connect your Raspberry Pi to a suitable monitor (I used a TV, that had a HDMI connection), and also connect a USB keyboard, power supply, and mouse.
The power supply should be 5 Volts DC, and Raspberry Pi power supplies are widely available. I used a USB phone charger, with 5 Volts output, and a current rating of 2000mA.
Boot up your Raspberry Pi (connect the power), and you will see lots of computer code scrolling across your screen (if you have done everything successfully, so far).
When the Raspberry Pi asks you for a user name and password, use the following default ones (the bit after the ‘ : ‘ ).
Username: Pi
Password: Raspberry
After you have successfully logged in, type:
sudo raspi-config
Numbered options will now hopefully be on your monitor screen.
Select [5] Interfacing Options, and then P4 SPI
Then select [7] Advanced Options , and then [A1] Expand Filesystem.
You now need to exit the raspi-config utility, either by hitting the ‘CTRL’ and ‘X’ keys, or by typing sudo reboot
Next you are going to Configure the locales and time zone.
Type this in, to set the locales, and follow instruction.
sudo dpkg-reconfigure locales
Next, type this in to set time zone.
sudo dpkg-reconfigure tzdata
The next stage is to update the raspberry Pi software, do this by typing:
sudo apt-get update
Then install any upgrades to the operating system software, by typing sudo apt-get upgrade
Next we are going to install Git , which is needed to be able to download the Things Network software from Github.
Type:
sudo apt-get install git
The next step is to create a user called TTN (the things network). This user will eventually replace the default raspberry pi user, which we will delete.
sudo adduser ttn
Then: sudo adduser ttn sudo
Logout, by typing logout
Once you have logged out, log back in using the user name and password that you have just set up, when you added a user.
You can now delete the default Raspberry Pi user, by typing
sudo userdel -rf pi
Set the WIFI SSID and password details, which can be found on the back of your home router / Hub (usually).
To set the WIFI details type
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Once you have typed in the above text, you should see some code on the screen. Add the following to the end of the existing code, making sure that you enter your SSID and password details, in place of the shown text.
network=
{
ssid="The_SSID_of_your_wifi"
psk="Your_wifi_password"
}
Now we are going to clone the installer from Github. This will download the software which runs the gateway, from the Github repository. Type each of the following three code lines into your Pi, one at a time, hitting the return key after each line of code.
git clone -b spi https://github.com/ttn-zh/ic880a-gateway.git ~/ic880a-gateway
cd ~/ic880a-gateway
sudo ./install.sh spi
Identifying the LoraWAN Gateway
The software will give the gateway the default name of ttn-gateway
.
This however may need to be changed, to prevent issues with other Things Network Gateways within wireless range.
Wiring it Up
The next step is to connect the Concentrator board, to the Raspberry Pi, and also connect the antenna.
The components including the antenna should be mounted in a protective box, and the antenna connected to the Concentrator board.
It is very important that the Concentrator board is not powered up, with no suitable antenna connected, of damage could occur to the board.
Once the antenna is connected, then the next step is to connect the Concentrator to the Raspberry Pi.
Connect using female to female connecting wires, as follows:
iC880a Concentrator pin | Description | RPi physical pin |
21 | Supply 5V | 2 |
22 | GND | 6 |
13 | Reset | 22 |
14 | SPI CLK | 23 |
15 | MISO | 21 |
16 | MOSI | 19 |
17 | NSS | 24 |
IMPORTANT DISCLAIMER:
It is important that you identify the correct pins, by referring to the manufactures data sheets (Both IMST & Raspberry Pi).
We accept no liability for loss or damage caused, by following these information only instructions.
For help, as to which pin is which on the Concentrator and Raspberry Pi boards, why not get in touch.
I also offer workshop training, where I can train your students to build their own Lorawan Gateways.
@acraigmiles
www.craigmiles.co.uk
Craig Miles (C) 2018 , all images and content, unless stated separately.