Long Range Report

Off-Grid LoRaWAN Weather Station

Luke Prior

Issue 42, January 2021

This article includes additional downloadable resources.
Please log in to access.

Log in

We show you how you can build, program, and deploy your very own Arduino-based LoRaWAN weather stations, including an off-grid option.

BUILD TIME: 4 hours

Many makers would have made some form of weather related project before that measures temperature and other environmental conditions, such as humidity. There are an abundance of Arduino projects available to do so online and also some that we have published before.

Knowing the temperature is something that almost every curious adult on the planet wants to know, whether it’s to explain why they are feeling hot or cold, or to work out what to wear before going outdoors.

Many commercially available weather stations are available these days, but they are usually limited to just displaying the weather conditions on an LCD screen, which is probably located in a room that isn’t frequented. There is also a limitation on the distance where you can mount any external sensors.

This brings us to our weather station project. Well, two projects in fact, which will enable you to keep an eye on all sorts of weather conditions from anywhere in the world over the Internet.


This month, we are presenting you with two weather stations using LoRaWAN technology. The first uses Pycom gear, which is available from our friends at Core Electronics, and the second uses a LoRa development board made by Heltec that provides an off-grid solution.

We’ll show you how to build and code either circuit and how to setup a Ubidots weather dashboard to see real-time weather over the Internet.

In addition, we will describe how to setup a LoRaWAN gateway on The Things Network if coverage is limited in your area.


When designing an off-grid weather station our main technical considerations are communications, hardware, and power. The very first decision needs to be what our weather station will detect, we settled on temperature, humidity, and pressure, however, this project could easily be modified to include additional sensors for air quality, UV, etc.

With a good idea of what information we will need to transmit we can consider potential communication protocols. Communication technologies continue to become more affordable with more capability, while consuming less power. The main options considered for this project were WiFi, GSM, and LoRaWAN. These technologies were judged on their range, bandwidth, cost, and power consumption.

WiFi range varies greatly depending on what frequency and device are used but on 2.4GHz we can estimate a range of a few hundred metres in an optimal line-of-sight deployment. Mobile networks including NB-IoT feature a range of ~10km and have strong coverage from major providers in most countries. A LoRaWAN gateway can reach 2 to 3km of coverage in an urban environment while in rural areas this can reach 5 to 7km.


WiFi bandwidth on 2.4GHz has a theoretical maximum of 600Mbps, while in reality, this will be significantly less but still more than enough for a constant stream of weather data. The speed of IoT mobile network will be in the low Kbps, which while significantly slower than WiFi, will still allow for a continuous stream of basic weather data. LoRa features a maximum theoretical speed of 27kbps which is comparable to NB-IoT, however, if we wish to use a public LoRaWAN network, such as The Things Network, our speeds will be severely limited, ruling out the option of continuous data streams.


WiFi is the cheapest technology to implement due to the abundance of devices and modules and the lack of ongoing subscriptions. NB-IoT requires more expensive GSM boards and antennas along with a monthly network access subscription. LoRaWAN devices have been coming down in cost to the point where they are cheaper than GSM solutions but still more expensive than WiFi alternatives.

The power consumption for WiFi devices can vary greatly depending on the device and specific technologies used but, with sleep modes, is very manageable. The power consumption for IoT-focused GSM networks is significantly higher than WiFi and LoRaWAN but still within the limits of an off-grid solution. LoRaWAN has similar power consumption characteristics to WiFi when transmitting but typically features better sleep power management.

We considered these benefits and limitations of each device and decided LoRaWAN would be the best option as it offered a good compromise between range, bandwidth, cost, and power consumption. We also decided to go with LoRaWAN through The Things Network which imposes other conditions.


The Things Network is a global community building an open-source and decentralised LoRaWAN network. The Things Network is available in 150 countries and consists of over 16,000 community-run LoRaWAN gateways. These gateways are what our weather station will connect too so we will need to check the coverage in our area.

If you are in Australia, you can check The Things Network coverage in your area by visiting the Australian country page and looking for your local community. If it isn't there, you can always start one with some other makers and begin the LoRa revolution in your neighbourhood.

Your local community page will show you the active gateways and give you a basic coverage estimation.

If you have a local community and want to check potential coverage we can use TTN Mapper to get an idea of availability. Simply visit and zoom into your location, you should see local gateways and lines appear. The coloured areas of the map show areas where actual devices have connected to the network so should work as a fairly reliable indicator of coverage.

If the area where you want to deploy your weather station doesn’t have any coverage you may want to consider hosting a LoRaWAN gateway and expanding The Things Network. We have more information on how to set that up later on.

The Prototype: Pycom Solution

We decided to create a prototype weather station to test the core sensing and transmission elements. We went with the Pycom LoPy 4, Pycom Expansion Board 3.1, Pycom LoRa Antenna Kit, BME280 Temperature Humidity Pressure Sensor, along with a Solderless Breadboard and the Pioneers Platform for Pycom.

We chose the Pycom route for our initial prototype as they have a strong community and are officially recommended by the Core Electronics team.

The Pycom LoPy4 is a quadruple network MicroPython enabled development board with support for LoRa, Sigfox, WiFi, and Bluetooth, which makes it a great choice for any electronics project.

We need to use the Pycom Expansion Board 3.1 to establish a USB connection with the LoPy4 for programming. The Expansion Board 3.1 also comes with a variety of helpful features including exposing the GPIO pins for easy prototyping and the integrated LiPo battery management system.

To access The Things Network via LoRaWAN we will need to add the official Pycom LoRa Antenna Kit to the LoPy4, LoRaWAN will not work without this antenna and its exclusion could cause serious damage to the device.

To keep all these components neat and tidy we opted for the Pioneers Platform for Pycom which is made in-house by Core Electronics on their laser cutter along with the recommended Solderless Breadboard which sticks right on.

Pioneers Platform by Core Electronics
Parts Required:JaycarAltronicsCore Electronics
1 x Pycom LoPy4--CE05399
1 x Pycom Expansion Board 3.1--CE05545
1 x Pycom LoRa Antenna Kit--CE04928
1 x Pioneers Platform for Pycom--CE05770
1 x BME280 Temperature Humidity Pressure Sensor--ADA2652

Parts Required:

A breadboard and prototyping hardware is also required.

Finally, we decided to go with the BME280 Temperature Humidity Pressure Sensor as it offers accurate readings at a good price with great software support. The BME280 sensor is made by BOSCH but is sold by a variety of manufacturers on breakout boards which allow us to communicate with the device via I2C or SPI.


The assembly of our project started with installing the Pycom LoPy4 module in the Pycom Expansion Board 3.1

Note: It is important to ensure that the RGB LED on any Pycom development board must be orientated above the USB port on the Expansion Board.

Next, assemble the Pioneers Platform by peeling off the protective film from the acrylic sheets and locating the including screws.

Secure the Expansion Module 3.1 with installed LoPy4 on the Pioneers Platform with the four included screws and nuts, making sure the USB port on the Expansion Module is on the exterior side of the Pioneers Platform.

Install the LoRa antenna on the integrated antenna mount on the Pioneers Platform with the antenna nut. The antenna can be connected to the 915MHz LoRa antenna port located on the top left of the LoPy4 above the RGB LED.

The final step in our prototype build is installing the solderless breadboard and wiring the BME280 to the LoPy4. Peel off the adhesive film from the back of the breadboard and place it in position on the Pioneers Platform, below the Expansion Board.

To wire the BME280, use some male-to-male breadboard jumper wires. We will need four cables to power and communicate with the sensor via I2C.

Software Setup

To program the LoPy4 we need to use the Visual Studio Code IDE platform with the Pymakr Plugin.

Install the latest versions of the following:




Once Visual Studio Code, NodeJS, and Python are installed we can set up the Pymakr plugin. Open Visual Studio Code and navigate to the extensions page (5th option down on sidebar) In the search bar enter Pymakr and install the extension. The extension will now be downloaded and installed. After a few minutes, select the reload button that will appear. The Pymakr extension will then be installed and we can proceed.

Programming the LoPy4

Now that we have the required applications installed, we can connect to the LoPy4.

With Visual Studio Code open, plug the USB port from the Expansion Board into your computer. In the Terminal you should see confirmation that your board has been connected. If this is not the case, you can manually connect to the board by going to All Commands and selecting Pymakr > Connect.

Once we are connected to the LoPy4 we can begin to code the device. Our first step will be to retrieve the device EUI so it can register it on The Things Network.

In Visual Studio, select Open folder, create a folder, then select it. This will be where your code is stored.

In the explorer panel, select the new file icon to create our code file. Name it and press enter.

In the file you just created, paste the following code:

from network import LoRa
import binascii
lora = LoRa(mode=LoRa.LORAWAN) </p>

This code will print our 16 character device EUI in the console for us. With the LoPy4 connected, select Upload from the bottom toolbar and wait for the program to upload to the board. If everything works as expected you should see your device EUI. Record this for later.

We can now register the LoPy4 with The Things Network which will allow it to connect to, and send, data on the network. Create a Things Network account here:

Once we have created and set up our account, go to The Things Network console and select Applications.

Select add application to begin registering our LoPy4. We need to fill out some fields. For application ID, choose a name for our application. Add a short description, then select ttn-handler-asia-se for our Handler registration as this is the closest location in Australia.

We then need to add our LoPy4. To do this, simply select the Device tab and choose a device name, then enter our device EUI in the Device EUI field.

We can proceed to register the device. This will take us to the device page where we record the Application EUI, and the App Key required to authenticate with The Things Network.

Now that our device is registered on The Things Network, we can install the weather station code.

Download and unzip the weather station code from GitHub or from the resources section of our website:

We need to open the code folder in Visual Studio Code. To do this, go File > Open Folder and select the code folder in the unzipped file we downloaded. This will open the project in Visual Studio Code and allow us to configure and upload the program.

In, enter our Application EUI and App Key that we recorded earlier.

We can now upload the code to our board with the Upload button from the bottom toolbar. The program files will be uploaded to our board and should start running. First check the LoPy4 is working if it flashes red when starting, green when connected to TTN, and blue when sensing and uploading weather data to TTN.

If everything worked correctly we should begin to receive data in The Things Network Application Data tab. This data won’t be of much use to us until we convert it back from bytes to readable values for temperature, humidity, and pressure. To do this, we need to create a Payload Format.

Navigate to Payload Formats and create a new decoder. You can name this anything you’d like. We need to add the following code to correctly decode the weather data our LoPy4 sends. This code can also be found on the Github page or on the DIYODE website.


function Decoder(bytes, port) {
  function bytesToFloat(bytes) {
    var bits = bytes[3]<<24 | 
bytes[2]<<16 | bytes[1]<<8 | bytes[0];
    var sign = (bits>>>31 === 0) ? 1.0 : -1.0;
    var e = bits>>>23 & 0xff;
    var m = (e === 0) ? (bits & 0x7fffff)<<1 : 
(bits & 0x7fffff) | 0x800000;
    var f = sign * m * Math.pow(2, e - 150);
    return f;
  return {
bytesToFloat(bytes.slice(0, 4)).toFixed(2)
    pressure: (bytesToFloat(bytes.slice
(4, 8))/100).toFixed(2)
bytesToFloat(bytes.slice(8, 12)).toFixed(0)

Save this Payload Format and return to the Data tab. You will now see data entries with temperature, pressure, and humidity readings. This data is now in a usable format and can be exported to other services with integrations.

Weather Dashboard Creation

The easiest way to display our weather data is with the Ubidots STEM integration. Ubidots is an IoT cloud platform that we can use to display our data on a live dashboard.

To get started with Ubidots we will need to create a Ubidots STEM account at

With the account created, log in and go to API Credentials. Here, we need to record the Default token so that The Things network can authenticate with Ubidots and automatically send our data to the platform.

Add the Ubidots integration to our application by selecting add integration from the integrations tab and selecting Ubidots. Choose any Process ID, set the Access Key to default key, and copy our default token into the Token field. Add the integration and return to our Ubidots dashboard.

On the Ubidots dashboard page, go to Devices where we should see our weather station listed. If we click on the device we should see the information about our LoPy4, along with the weather data it’s recording.

Now that the Ubidots platform is receiving our weather station data, we can create a dashboard to display it. Navigate to Data - Dashboards and create a new dashboard. We now have a blank dashboard where we can add and customise our data.

By using the blue + in the top right, proceed to add widgets that will display our information. Go ahead and set up multiple widgets and rearrange them until you’re happy with the layout of the dashboard.

Share this dashboard by going to the sidebar and selecting share, located next to our dashboard. This will create a public link that anyone can use to see your weather dashboard. You can view our public dashboard here for inspiration:


You can easily add more sensor modules to the LoPy4 via I2C or any number of the other available pins. If you wanted to deploy the Pycom solution for off-grid operations, you could consider picking up a rechargeable solar USB battery bank and attaching it to the USB port on the Expansion Board.

This solution won’t give you insight into the battery levels but will allow for continuous operations if the battery and integrated solar panel are large enough.

The Main Build: Off-grid Heltec Solution

The Pycom based prototype worked great for testing our weather sensor and The Things Network integration, however, we needed a smaller, more power efficient solution with integrated power management systems viable for long-term off-grid deployment.

Our final build uses the Heltec CubeCell HTCC-AB01, rechargeable battery and solar panel.

Power Requirements

The cost of solar power and Lithium-ion battery storage has fallen dramatically in the past 10 years, opening new possibilities for small form factor off-grid projects. We know the mainboard and sensor we will be using for our weather station so we can now calculate a suitable battery and solar combination to ensure the project will always have power.

The Heltec CubeCell and BME280 are both relatively low power components, especially when they are not actively operating. Our weather station will be idle for the large majority of the day, only transmitting and recording weather values for a short period of time each day.

The datasheet for our Heltec CubeCell reports a power draw of 105mA while transmitting and just 3.5μA or 0.0035mA when in sleep mode. The sensor module reports a power draw of 1mA when sensing and 5μA or 0.005mA while idle. We already know we will be limited to 30s of active transmit time each 24 hour period, and assuming a total of 60s for sensor measurement taking and transmission with the rest of the 24 hour period in sleep mode, we can then calculate the power draw of our system.

The average power draw of our entire system using these power figures over 24 hours is 0.08mA, which is very low for any electronics project. It means almost any solar battery combination will be sufficient.

Parts Required:JaycarAltronicsCORE ELECTRONICS
1 x Heltec CubeCell HTCC-AB01This part is sourced from online retailers.
1 x 6V 4.5W Solar Panel-- PRT-13782
1 x 2000mAh Lithium Battery--CE04378
1 x BME280 Temperature Humidity Pressure Sensor--ADA2652
1 x Suitable EnclosureThis part is sourced from hardware stores.

A breadboard and prototyping hardware is also required.

If we were designing an off-grid solution for a more power-hungry solution, we would have to calculate the exact power draw and solar generation figures to ensure that, even in the worst solar conditions, the battery could be fully replenished.


We paired the Heltec CubeCell and BME280 with a 3.7V 2000mAh LiPo and a 6V 750mA solar panel. We choose these components for their high duration storage, powerful power output, low prices, and for peace of mind.

Note: We used components sourced from an overseas online retailer, however, the PRT-13782 3.5W solar panel and CE04378 3.7V 2000mAh Li-Po from Core Electronics would be suitable.

The battery can run the entire system for several weeks on a single charge and the solar panel can fully recharge the battery in a single day. If you are looking to create a more compact system or reduce the cost you can greatly reduce the power output of the solar panel down to ~100mA. Regardless of the power output of the solar panel it is important you select one with a voltage between 5.5 - 7V. If you wish to use a solar panel of a different voltage with the Heltec CubeCell you will need a voltage regulator to get it within range.

Initial Assembly

With all our components decided, we were ready to create the final weather station. We began by soldering the connections for our battery and Heltec CubeCell. The next step was to attach the BME280 with some breadboard jumper wires to power and I2C.

We could then connect the LoRa antenna and battery via the onboard connectors.

We decided to test the system in this minimal state, and with everything working, we continued on to package the device in an external enclosure.

We could now prepare our solar panel. We created a basic 3D printed frame and scaled it to the correct size for our solar panel. Securing it in place with some epoxy, we then attached it to some wood that would allow us to securely screw it in place. The 3D files can be found in the Resources section.


This initial build was very compact but we encountered some problems with attaching the weather sensor and securely mounting the housing.

We decided to revisit our housing decision and choose a larger enclosure with ample room for our components and integrated mounting hardware.

We secured our components in the enclosure with double-sided tape and mounted the BME280 on the interior wall of the enclosure with several holes for airflow. We fed the solar panel wires out of the enclosure via the integrated grommet and mounted the solar panel.

Programming the Heltec CubeCell

The Heltec CubeCell is programmed with the Arduino IDE so we need to use a different set of code than what we used with the LoPy4. To get started, we installed CubeCell board via the Arduino Board Manager by adding the following URL in our preferences:

With the board manager installed, we could configure the board settings for our region:




LORAWAN_RGB to DEACTIVATE (to save power)

With the board configured, we can register the device on The Things Network and set up our code. We will navigate back to The Things Network dashboard and create a new Application, the same as last time, setting a unique Application ID and providing a short description. We can also select ttn-handler-asia-se as our Handler registration.

To register our device on the application is slightly different. The Heltec CubeCell does not have a Device EUI like the LoPy4 so set this field to be randomly generated. We also need to create a unique ID for the device.

Once the device has been added, we need to record the following items from The Things Network device page Device EUI, Application EUI, and App Key. We will use these keys to authenticate with The Things Network.

Download the Arduino sketch for our device from GitHub or from our website:

Open the main.ino file from the code folder. This will open the code in the Arduino IDE. Before uploading the sketch, we need to apply our authentication keys to the code.

We cannot copy our keys directly into the Arduino sketch as we did with the LoPy4 code. We need to enter the data in groups of two, as per the instructions in the sketch. Once we have filled out the three fields with our devEui, appEui, and appKey, upload the code to our Heltec CubeCell.

The Heltec CubeCell should now begin recording and transmitting our weather data to The Things Network. Check the device Data page to see if our data is being received. Once we have confirmed our data is being sent, set up a custom Payload decoder, similar to the one we used with our LoPy4.

Navigate to Payload Formats and select decoder. Copy the payload code from the GitHub page or down below into our decoder and save the format. When we return to the Data tab, our temperature, humidity, pressure, battery, and battery level data should all be correctly decoded and displayed.

Heltec Payload Decoder

function Decoder(bytes, port) {
  var temperature = bytes[0]<<24>>16 | bytes[1];
  var humidity = (bytes[2] << 8) | bytes[3];
  var pressure = ((bytes[4]) << 24) + ((bytes[5]) 
<< 16) + ((bytes[6]) << 8) + ((bytes[7]));
  var battery = (bytes[8] << 8) | bytes[9];
  var battery_level = bytes[11];
  return {
    temperature: temperature / 100,
    humidity: humidity,
    pressure: pressure / 100,
    battery: battery / 1000,
    battery_level: battery_level

Weather Dashboard Creation

Create a Ubidots weather dashboard, which is exactly the same way we did with our LoPy4 dashboard. We need to get our account Default token and add the Ubidots integration to our new Heltec application. This will add our new device to Ubidots and will allow us to import data from it to our dashboards to be displayed in various widgets.

Gateway Setup:

Gateway Options

The Things Network consists of user-run gateways that our node devices connect to, allowing them to send and receive information. In most cities, you will find there is decent coverage due to the wide area covered by a single gateway. In Australia, we have 46 communities with over 750 active gateways. We can search for our local community on the Things Network website at If you can’t find a community for your area you can start a brand new community and add the first gateway.

You may find that coverage in your location is limited, or that you just want to experiment with hosting a gateway you can add to the network.

LoRaWAN gateways come in many different flavours and varieties. We can get indoor and outdoor units, along with single-channel and 8 channel devices. If you plan to deploy your gateway for public use, we strongly recommend going for an 8 channel gateway as single-channel gateways have a vastly reduced capacity and can cause issues for users of the network.

With these considerations in mind, we have a few options for gateways. The budget options include a DIY gateway like the uGateway DIY Kit (CE06076) from Core Electronics or the Dragino LPS8, which can both be had for under $250. These gateways will work well for nearby devices but, as they are both indoor gateways, their range will be limited in comparison to outdoor gateways. On the higher end, Core Electronics sells the Laird Sentrius RG191 outdoor gateway which is perfect for long term deployment, and can be bought for around $500.

Dragino LPS8 Gateway Configuration

In this tutorial, we will be using the Dragino LPS8 indoor gateway. Steps to set up the other gateways can be found from their respective manufacturers.

The LPS8 comes in a nondescript cardboard box along with a USB-C cable for power and an indoor antenna. The first step, before powering on the device, is to attach the antenna to the rear connector. Powering on any LoRa device without an appropriate antenna attached can cause permanent damage to the unit.

Once the antenna is attached, insert the USB-C power cable and plug it into an appropriate power supply that can supply 5V 2A. A phone brick should meet this requirement. We should begin to see the device status LEDs blink as the device starts.

Once the status LEDs have stopped changing, begin the software setup for the gateway. You can use ethernet or WiFi with the device. If you are using ethernet, you can wire that in and connect to the gateway from a web browser with http://IP_ADDRESS:8000. If you wish to use WiFi, you will need to connect to the public WiFi network. The device creates dragino-xxxxxx with password dragino+dragino. Once you are connected to the WiFi access point, you can connect to the web interface by visiting

Once you have connected to the Gateway, log in with user name root and password dragino. This should bring you to the general web interface for the LPS8.

We need to update the firmware on our device before we are able to configure network and TTN settings. The current firmware version is listed in the bottom left. Find the latest dragino firmware from:

Download the latest lgw--build version. Upload the firmware and flash it to the gateway. To do this, navigate to System - Firmware from the top menu, choose the downloaded .bin file, and upload the file. Proceed with the flash, ensuring the preserve settings option is unticked. The device will now flash the firmware and restart, which could take a few minutes.

Once the gateway has rebooted, configure the network and TTN settings. The first thing is to set up internet connectivity. If the gateway is connected via ethernet you won’t need to configure anything.

If you want the device to use WiFi, we need to set this up by navigating to System - Wifi - WiFi from the top menu. On this page, under WAN Client Settings, enter the details of the local WiFi network. Select your network from the drop-down WiFi survey menu and enter the passphrase. You can now save and apply.

Your gateway should now be connected to your local network and you can switch back to that and reach the gateway interface from: http://IP_ADDRESS:8000

With the gateway updated and connected to the internet, connect it to TTN. We need to find the Gateway ID of our device, which is listed under LoRaWAN - LoRaWAN from the top menu.

Once you have noted down your gateway ID, proceed to register the device on TTN. Navigate to and click register gateway.

On the next page, enable the legacy packet forwarder. This will open up an option to input your gateway ID in the eui field. For frequency plan, we will be using Asia 920-923MHz.

Note: Some regions in Australia may use a different frequency band so make sure to check your community page and update this setting accordingly.

For router, select ttn-router-asia-se, as this is the closest main router for Australian gateways. Add a short public description and select the gateway location on the map (this can be hidden from public view). Finally, select the correct antenna location and continue.

Configure the LoRaWAN settings on our gateway to match the details we just registered. Going back to the LoRaWAN settings, on the LPS8 via LoRaWAN - LoRaWAN from the top menu, configure the primary LoRaWAN Server settings. For service provider, select The Things Network and for router, choose TTN-router-Asia-SE1. Uplink and Downlink ports should both be set to 1700. Save and apply these changes.

Finally, configure the LoRa settings. Navigate to LoRa - LoRa from the top menu. Set the frequency plan under Radio settings to AS923 Asia (920-923). Once saved, the gateway should now be ready to connect and start handling TTN requests.

Check if the gateway is connected and sending data to the TNN by returning to the gateway dashboard from the TTN console. If the gateway is connected, it should display connected as its status. If this is not the case, review these steps and check the gateway’s internet connection.

External Antenna

The Dragino LPS8 comes with an antenna port to attach an external antenna for greater coverage. We can use a LoRa outdoor antenna, such as the CE05943 from Core Electronics, and attach it to our LoRa gateway. This will extend The Things Network and enable a greater range for our LoRa projects.

Where to from here?

The Things Network is an amazing global community that is made possible by all the makers who create projects, deploy gateways, and promote the network. This off-grid weather station is the perfect introduction to LoRa and its capabilities.

Note: It is worth checking out the TTN fair use/duty cycle/time on air limitations at