#124 Cheap LoRa Gateway: Tutorial on how to Build with one with Raspberry Pi and Dragino
Hello YouTubers, here is the guy with theSwiss accent. If you plan to start with LoRa and do notwant to spend lots of money you can start with an Arduino Uno and a Dragino shield foraround 20 dollars and connect it to the nearest gateway. In episode #117 I built such node. But, if no gateway is around your location? Then, you can build your own full blown publicgateway as I done so in episode #115. This payments you around 300$. Which is too much for most of us. Today, we will build a gateway for much lessusing an old raspberry and a LoRa hat. The hat is around 30$ and the whole gatewayis quite simple to build. And I goes to show you its shortcomings, and whatyou have to do to avoid troubles. In parallel, we will learn a little more aboutthe LoRa protocol. So, gives get started with making thehat and the Raspberry Pi. This is straight forward. I use a small Brass stand to make it morestable. This hat also has a GPS module, but today, we do not use it.After assemble the hat and the Pi, we haveto create an SD card with the needed software. We begins with an SD card with an installedRaspbian jessie exhaust. You find a association in the description on howto proceed. Now, we can start to setup the remainder. You too find connections with the tutorial onhow to do that and I will follow this document for the next steps.The tutorial does not use a Pi hat, it justuses the bare RFM9 5W module. This is also a alternative, if you want tosave another 20 dollars, which is the difference between the Pi hat and the bare module. Harmonizing to the instructions, you first haveto clone the repository of the gateway application. Then, we have to enable SPI, if not alreadydone. Next, we have to install wiringpi. This software enables the possibility to controlthe various GPIO pins of the Pi. In the next step, we have to adjust some constantsin the main.cpp file. Please check firstly the rod job. Then, you convert the server address, the frequencyyour gateway operates on, and the latitude and longitude of your gateway. I use here 868.1 MHz, but you can use likewise. 3 or. 5, which are the three obligatory directs for TTNThen, you become the executable folder and start the gateway software.Be aware, that your gateway merely directs aslong as this programme executes. If you pulp ctrl C, the programme stops andyour Pi is no more a gateway. Right at the beginnings of the gateway software, you get the unique number of your machine. This will be needed to connect to the TTNnetwork later. So, write it down and remove all colons. Now, you go to the page of TTN and createan account( if not already done ). Then, you enter the management console andregister a brand-new gateway as packet forwarder. Key-in your gateway crowd from before andenter the frequency strategy. If you did not enter the position of yourgateway in the main.cpp record, you have now a chance to enter its position here. After registering the gateway, you shouldsee status connected and a small number of seconds in the field last-place ensure. Thats all. Your gateway is now ready and can receiveand transfer words! Now, apart from the premium, what are the differencesof the expensive gateway on my ceiling compared to this one in my lab.There are three main differences: 1. My tiny gateway now, as its name says, hasonly one channel 2. It is impossible to deal with one spreading factorat a time 3. Currently, it has no downlink possibility. However, “thats really not” a equipment limitationand perhaps, once mortal will enhance the software to include this featureSo, causes play around with it to discover, if these differences truly matter. To do that, I have here my LoRa node fromepisode #117. It communicates every minute a letter in the air. Let see now on TTN, what happens. The first theme sent by the node arrivesand we examine, that it was received by both gateways. Great! Our big gateway creations! The signal on the roof was, of course, muchweaker. But still acceptable. Spreading factor was SF7. The next letter, however, did exclusively arriveat the gateway on the roof. Why is that? I did not change anything and the signal shouldstill be very strong. So, This cheap gateway does not to be veryreliable. Lets give it a second chance and wait forthe next message. And also here, it is not received by my newgateway.So, I dedicate it a last chance. Maybe it knew, that it was its last mutate. It moved this message again. So, this small device is not very reliable. Should I propel it into the trash bin? Was this just a joke? If we have a close look at the transmissionfrequencies, we witness, that the node reformed it with every word. This is a good behavior. If canal one would be disturbed, we wouldget at least the next send on channel two.But we said before, our single direct gatewaywas compiled for path 0. So, it did not hear the signal on channel1 or 2. So, we have at least an explanation of itsbehavior. But how can we deal with that? Makes usurp, our node would ever sendits senses on direct 0, then, our brand-new gateway would receive all contents and we would haveresolved this issue. But what kind of other troubles do we causeby that? For a fertile environment with hundredsof nodes, the concept of frequency hopping is useful. But if you precisely want to test the technologyor use it around your house, then you merely have a handful of sensors, and this frequencyhopping is not necessary. So, we just have to find a possibility toswitch it off in our node software. This is easily done by this command. We precisely disable all paths we do not miss. For Europe, the latter are channels 1 to 8. Now, all sends are sent on channel 0, whichis 868.1 MHz. So, we have now a gateway for our own use.And even our neighbor can use it, if he constrainshis node to just our channel, extremely. No difficulty. Really to show you, that the node can only receiveone spreading influence at a time, I change my node to SF12. An, the content is not received, even on channel0. So, we also have to make sure, that the nodesand the gateway uses the same Spreading factor. So, summarized We built a simple a less expensive TTN gateway with a raspberry Pi and a LoRa hat The software is easy to be installed and changed If we make sure, that our node simply uses one channel, this setup is very usable forour own intent The capability of such a node is good forat least 20 coinciding sensors or more, depending on the sending intervals.And the best: Because we are connected tothe ttn network, we can profit from other things. For example, we easily can connect our devicesto our node-red installation. A TTN node already exists and we can connectour device straight-out to node-red. At the end, we see here as an example thefrequency of the dissemination and the RSSI values of both gateways.With this, you can now attach your sensors( or buttons) via LoRa and TTN to your home-automation structure. I hope, this video was useful or at leastinteresting for you. If true-blue, then like. Bye.