Hello YouTubers, here is the guy with the Swiss accent.
In video #112 I introduced the LoRa technology.
Today we start to get our hands dirty and build our first device: An official gateway
and connect it to the things network.
The next video will be about the Lora Sensor Node and another one about an experimental
single channel gateway.
But before we start: Two answers to questions of my viewers:
1.
What about security of LoRa?
The transmission of LoRa is secured by a symmetric encryption.
You have to provide a particular code to each device.
We will see that in the next video 2.
Does LoRa have any collision detection mechanism.
No, it is a so called “Aloha” system which just sends the content and hopes, that nobody
else uses the same channel at the same time.
This might become a problem if thousands of devices are on-line.
Currently, the gateway changes its channel according a procedure I do not understand
right now.
So, if one channel is blocked, maybe communication is possible on another channel.
But now, let’s roll up our sleeves and start with the build:
You remember, that LoRaWAN is a network consisting of many Gateways connected to the internet.
These gateways are built and operated by people like you and me and are connected to the internet.
If such a gateway exists in your area, you are lucky and you can skip this episode and
save the money.
If not, you might consider to build your own gateway and later expose it to the public.
I am sure, you will be loved for that…
Such a gateway has to comply with some standards.
For example, it has to offer 8 parallel channels.
Because these devices are quite complex and not built in high series, they are also not
awailable through our normal channels.
For my gateway, I use the SPI version of the IMST IC880a.
This is a small PCB with all needed parts on it.
The next important part for a gateway is a Raspberry Pi.
You can use one of your old ones or buy a new model 3.
The Gateway does not need a lot of power.
Theoretically, you could even use a Raspberry Pi Zero.
Unfortunately, in Switzerland, these are not easy available, and also not for 5$.
And in addition, I need a network connection.
So, I ordered a quite cheap new Model 3 from the link provided below, and use my old model
2 for the gateway.
The IC-880a is built as a standalone device.
This means, that it does not fit to e.g. a Raspberry Pi.
Either you connect the two with jumper wires, or you buy an interface PCB.
You can choose from two different PCBs which are exactly designed for this purpose.
The one I have is a very simple one without any parts other than connectors.
The other one has some additional parts which are useful if you want to deploy your gateway
into harsh weather situations.
It can measure temperature and humidity and switch a ventilator accordingly.
It has also a built-in buck converter for power supply.
The assembly is simple.
Just plug the IC880a into the board and the board into the Raspberry Pi.
Pin 1 is marked.
At the end, it looks like that.Do not forget the antenna, because otherwise, the concentrator
can be damaged.
Antennas have to be for your frequency band, 868 MHz in Europe.
Now we are ready to install the needed software on the Raspberry Pi.
To do that, we have a perfect online tutorial done by Gonzalo Casas.
Just start with the chapter “Setting up the software”.
First, we have to install Raspbian on an SD card and insert it into the slot of the Raspy.
Then, we have to power the “gateway to be” with a USB cable or a 5-volt cable.
The power used by the concentrator is not big, so, you can use any power supply which
is available to be used with a Raspberry.
After booting up, we have to configure our Raspy according our time zone, etc.
Do not forget to enable SPI, because the concentrator communicates through SPI.
Now, bring the OS to the newest version.
Then, if we use Raspbian lite, we have to install git.
This is used to clone repositories later.
For security reasons, we create a new user and delete the default user “pi”.
If you want to connect the Gateway to your WLAN, you also have to plug-in a Wi-Fi dongle
and enter the credentials.
I use a normal ethernet cable for my setup.
Next, we have to get the needed software.
Fortunately, the guys from TTN Zurich have built a nice repository on github.
If we stay in the home directory of the user ttn and clone the repository, we will find
a new directory, called “IC880a-gateway”.
If we change to this directory, we only can start the installation script.
Please answer the question “Do you want to use remote settings file? “with yes.
If you answer with “no”, you have to answer a few questions concerning your Gateway right
away.
With yes, we store these answers and the software can read it in the future automatically.
Close to the end of the installation process, you get a so called EUI number.
This is the MAC address of the concentrator without colons.
Please note this number down, you will need it later on.
As said before, you have to create a file with the info concerning your Gateway which
can be read by the gateway during power-up.
This is done by creating a file with the EUI number and the ending .json on github in the
“Gateway Remote Config repository”.
The content of the file is simple.
Here, you see the needed entries.
The most important ones are the address of the ttn network server.
The coordinates of my location I got from google maps.
Then, you propose your file for publishing and Gonzalo will accept it if everything is
ok.
Now we are finished on the Raspy and can go-on to “The Things network”.
But because the acceptance can take a while, we now shut down our Raspberry and go for
a beer or so.
Tomorrow is another day…
If the remote file is accepted and we start the gateway again, the remote config is read
automatically.
And now, we can go on to the next step: To check if the TTN network recognized our gateway.
This can be done by going to this page and search for our EUI.
If you find it, it is already very good.
And if it is “active” and “now”, even better.
If not, maybe you give it a few minutes and check again.
Or you check on your gateway, how it works.
If you enter this command, you should get some log entries like these.
Even if the communication is not established yet, you can go on with the registration of
your gateway on TTN.
To do that, you go to the console and press “register a gateway”, use “bridge”
activation mode, and enter all needed info.
And with the EUI it should be connected to your gateway.
At least, you see the actual status.
This was the last step and now, you are the proud owner of a TTN gateway and can open
it to your neighborhood.
You just have to place it outside your house at a high place that its reach is maximized.
And you can check if it is already marked on the worldwide map.
As you see, mine is still in the lab, because it has no housing yet.
Here you see one example of a box, and here, you see another, much cheaper one.
Please do not forget lightning protection.
To set the gateway free is one of the next steps for me.
But before that, I will show you, how to build a sensor node and connect it to our newly
built gateway.
Stay tuned.
I hope, this video was useful or at least interesting for you.
Bye