First idea was to build a weather station “house” based on ESP8266 WiFi module for connectivity since I know it quite well and GSM for backup. And even though We managed to create a over-decent WiFi coverage in our apple orchard(65Mbps/10Mbps) using Mikrotik Metal 2 router the system is not scalable to others in the vicinity since the microclimate changes quite significantly due to diversity of terrain from near river(like ours) to slopes on the surrounding hills.
I have been quite interested in LoRa from 2014 Münich electronica(with their 6 gateway covered the city campaign), but started dabbling with it only last year. I was quite impressed with the field test when we managed to reach 10km with just wire sticking from the breadboard.
Few months ago I got my hands on FCC certified LoRa modules with processor(SX1276+STM32L072 from Murata) and we decided to ditch the ESP version(because of consumption and limited range) and focused on the new LoRa module.
Items with long leed time....
When I noticed the Hackaday prize for IuT!, I decided to put more of my time in the project to speed things up and try to catch a 12.6. deadline with working prototype. (also best mood to design complex systems called: “last minute panic” 🙂 )
– Best thing about LoRa is that the signal range is Literally as far as the eye can see and even where it doesn’t if the node is close enough.
– ESP will still be used in combination with SX1272 LoRa module to create a gateway from a hill peak where the concentrator will be placed to a friends house over WiFi.
But the first things first. The most important thing was to order all the things that will arrive from china because the shipping time is usually about 4 weeks.
items on the list were sensor casing, radiation shield, solar panel, ESP modules, long(to reach out of the case) SMA connectors…
3D printing for PCB design
Designing the sensor board took me more time than expected which in combination with surprisingly fast delivery of temperature/humidity case with protective shell meant that the case arrived before I sent the boards to production.
A rainy Saturday was spent basically on: printing the 3D model of PCB, checking if it fits, fixing the shape of PCB, exporting 3D … REPEAT
The final version of board is at widest 11.8mm wide which is less than 12mm inner diameter of sensor casing and more than the module width of 11.6mm.
Following the “improvement” of the shape was modification of all the connections and components to meet new space restrictions.
Yesterday my boards arrived and first task of designing any RF circuit board is making sure that all the lines are 50ohm(or thereabout) at the intended frequency (868MHz and 917MHz in my case), so few boards had to be sacrificed to determine the values of components for antenna matching.
Because of stability only NP0 capacitors were used.
For testing I used a PCB with only RF line and DC feed components mounted and a semi-rigid coaxial cable with SMA connector soldered where RF pin of the LoRa module will be.
As load I was switching between direct 50ohm termination and a stub SMA monopole antenna.
Beside the main board, the solar power supply circuit also needed to be tested, but luckily the already planed ferrite bead for power injection was all it was necessary to get 50ohms.
Final results of S11 parameter were around:
-30dB to -40dB on power supply + antenna
-25dB for the sensor board
-12db for the ESP compatible PCB module (worse results were expected since PCB antennas always have lower performance than proper ones)
Populating the PCBs
Since the module is in QFN package, without any exposed leads the only sensible way was to populate the boards using solder stencil and reflow owen.
Therefore when I ordered PCBs from PCBway I also purchased framed stencil which consisted of all the boards I have ordered.
The module has quite a decent spacing between pins which makes it easy to be populated without any shorts. I managed to successfully run all 5 out if 5 boards.
The sensor sticks worked in the first iteration. But ESP replacement modules require a small connection to be made to rf_vdd.
For programming a footprint for tag connect is used.
Image: Mostly populated boards prepared for the reflow owen
With wireless communications a first “Hello, World!” program can be quite difficult to achieve since it requires not only working IDE and correct setting for programming with only a few lines of code to light a LED but also correctly formatting and sending data and correctly receiving and decoding send data.
For that reason we decided to omit LoRaWAN(protocol) in the beginning and just sent anything over LoRa(Physical layer).
On one side there is B-L072Z-LRWAN1(official development board from STM and Murata) and on the other side, ESP8266 Wemos board and SX1272 LoRa module from Semtec, just stuck in a breadboard with 1/4 of wavelength or 86mm of breadboard wire (btw. 86mm also length of a credit card)
For this ESP wasn’t even set-up as with wireless and was used basically as 3.3V arduino for receiving data and sending them to the serial port. Later we will design a board for a 1-channel gateway with SX1272 and a ESP-07 module since it can be used with external directional WiFi antenna and all the electronics for MPPT tracking and battery management and place it on top of a local hill.
When first data finally passed through it was time for a range test. Which consisted of placing dev board on a fixed location and driving around with “gateway” connected to a phone over USB OTG to check the received packets in the android terminal(DroidTerm)
The range for the offical board on 1dBm TX power was about 3km line of sight and a over 1km when behind the hill. The sensor stick had around half the rang of the offical one. When power will be increased to 14dBm and a proper antenna instead of wire will be used on the gateway I estimate the range beyond 10km.
Which ANTENNA to choose for gateway
We got to semifinal of hackaday prize(yay!) , which also means some extra founds to pour in to the project. One of the things that cost money but it is well worth of buying one over building one is proper BIG outdoor antenna for the gateway which can cost around $100.
– By proper I mean designed to withstand elements(UV, snow, ice…) while maintaining performance at set frequency through years.
– By BIG I mean, the larger the better because there are either small OR good antennas. Similarly to camera optics where bigger aperture means better images in the dark/dusk in RF bigger antenna has better performance receiving very week signals send by low power SLoRa nodes from far away.
But there is another parameter to keep in mind directivity(misleadingly called gain) of antenna. Since antenna doesn’t have built in amplifier the Gain is not actually amplification but directivity or ratio between radiating with same power in perfect sphere(0dBi) or radiating more sideways(in this case) and less up-down.
Luckily for me, the list for only 868MHz antennas is not long and I have 5dBi(~40°) and 8dBi(~27°) to chose from.
Before choosing antenna I have to know where it will be positioned. Since I want a gateway to be placed as high as possible I marked the potential spots, checked the ownership of the land at possible spots to know who to ask for permission for placing the antenna “tower”.
We have managed to find the location that matches all the above criteria and even has a line of sight to our house which will enable us to use ESP-07 module with directional antenna to upload data to the internet. Using Ruler Tool in Google Earth I can make a cross-section of the hill to see elevation profile of the hill.
Cross-section of the hill with slope converted to degrees(in green)
On the left we have the average slope of 10°(14° max) and on the right 17°(21°max). On one side we don’t want the antenna radiating to much in to the ground because of reflection and on the other hand we don’t want to have any blind spots.
In my case I am estimating that relative vicinity to the antenna will be enough to get LoRa packet through even from the spots on the right of above cross-section, while in both North-South and East-West cross-sections I have mostly elevation profile around 12-14° x2 = 24-28°(times 2 because omnidirectional antenna radiates equally upwards as downwards). Therefore I will chose the 8dBi model to reduce reflection from the ground and also increase the long range sensitivity.
When antenna arrives and we set up the gateway I hope for 20km line-of-sight range and at least 2km non-line-of-sight(hopefully).
(even though 2G antennas are designed to operate at same frequency ~900MHz + 1800Mhz, they are usually smaller since they are meant to work with higher power over shorter distances)
For better feeling how omni antenna radiates just google: omni antenna radiation pattern