Back in May we looked at deploying the software to run a balenaFin as a TTN LoRa Gateway, today we’re working on the natural progression from this; mounting the hardware up a mast and making the installation more permanent. The techniques we look at here will allow us to install hardware in a weatherproof enclosure outdoors which can then be used for a variety of applications such as the planned LoRa gateway, or weather monitoring, or ADS-B flight tracking, and any other application where having outdoor hardware is beneficial.
- Hardware required
- Hardware assembly
- Mast installation
There are some key hardware components that we need to think about and consider to figure out what’s going to work best when mounting the gateway in a particular location.
The below is not intended to be a definitive list, as the requirements will almost certainly change depending upon your installation location and other hardware. However, I hope that it serves as a good starting point for you to start assembling a kit of parts to install your own gateway.
Tools and accessories
You don’t need anything special for this project, a basic DIY toolkit should do the trick. It’s going to vary slightly depending on your chosen installation location and method but the basics are:
- A drill
- Metal/general purpose drill bits (including a step bit for making large holes in the enclosure for cable glands)
- Masonry drill bits (if wall mounting)
- Spanners/pliers (for tightening RF cable connections
- Wall/Rawl plugs (if wall mounting)
- Stainless steel screws
- Glue (for mounting the Fin standoffs within the enclosure)
We’ll go into more detail about the major components below.
Generally speaking, although LoRa is a much lower frequency than technologies such as WiFi, meaning it can penetrate solid objects (buildings, mainly) more readily, you’re going to achieve better coverage by mounting your antenna as high as practicably possible given your location. I personally live in a valley and so because the range is limited to a few kilometres at the most I’m not going to be setting any distance records with my setup, even when mounted on a tall mast. Unless the transmitter is flying, of course.
The types of mast you can use can be dictated by your local authority, but in a location where terrestrial and satellite television antennae are permitted, a small pole mounted to the roof of your property is unlikely to be a problem with the neighbors. In certain circumstances you may be able to fix to an existing TV or satellite dish pole; I recommend as a first step to go outside to your proposed location with a rough plan in mind and take a look to see what options you have.
The mounting of a mast to a roof or building also depends on your level of confidence and/or access to ladders and other equipment for working at height – if you’re not 100% confident with this stuff I recommend contacting a local TV aerial installation engineer who would probably be able to help. Although, hiring your own cherry picker or scissor lift can be fun too!
The other option is to use a ground level mast, which is essentially a pole supported by guy wires.
I highly recommend A.T.V. Poles, Brackets & Aerials for sourcing all types of things you’ll need for this installation. Their site is a wealth of information and I’ve used them countless times in the past to obtain parts.
I personally have a wooden pole which I already use for my weather station, so I’m fixing my enclosure and antenna to that.
Antennae vary by application and frequency response so this will vary depending on your application. For a LoRa gateway you’re likely to be receiving/transmitting signals from every direction, as you don’t have an idea of where nodes are going to be. This, of course, is different if you’re installing a gateway for a specific project where you may want to provide coverage for a specific area. The two types of antennae we’re talking about here are directional (designed to transmit/receive in a specific direction) and omnidirectional (transmit and receive in all directions).
I’m building a general purpose LoRa gateway so I chose an omnidirectional antenna from AliExpress. You can also get antennae from suppliers such as PiSupply.
This antenna came fitted with a female Type N connector that needs to be converted into the U.FL/iPEX connector on-board the LoRa gateway module we installed into the mini-PCIe slot on the balenaFin in the LoRa gateway setup post.
Remember when choosing an antenna to be mindful of the frequency for operating LoRa in your country – you’ll want the frequency of your antenna to match the range shown for your country. My gateway is in the UK so I chose an 868MHz antenna.
Cables and connectors
Working with radio-frequency (RF) cables and connectors can be a daunting task as there are so many different types it can be hard to know, and then to find exactly what you need. Luckily nowadays sites like AliExpress sell a whole variety of connectors, converters, adapters and pigtails (short cables with connectors pre-fitted) so you can easily obtain what you need to connect your nice new antenna to the radio card in your balenaFin.
I used a short cable to go from U.FL/iPEX to RP-SMA Female, then a RP-SMA male to N-type male to connect to the antenna.
Some of the connections between antennae, cables, and radios will be outdoors, so it’s good practice to protect these from the weather, especially if your installation is going to get rained on a lot. I like to use self-amalgamating tape for this. It’s a soft rubber tape that when stretched out and layered upon itself, it amalgamates and becomes one solid piece of rubber that forms a seal around any threaded connections. As with lots of other things in this guide, you can get some from AliExpress if you can’t find it locally. I may be a little obsessed with AliExpress… don’t mind me.
You’ll notice that connectors designed to be mounted in the wall of an enclosure to provide an external connection have a longer thread and a nut on them. Later in this post we’ll look at how these are used to make a weatherproof connection for the antenna.
The choice of enclosure is somewhat dependent on where you intend to mount it – some enclosures are designed for mounting to a pole, others are more easily mounted on a flat surface.
The next thing you’ll want to consider is the IP rating of the enclosure, sometimes NEMA in North America. The IP rating defines the extent at which an enclosure will protect its contents (your project, in this case!) from solid particle and liquid ingress. For example, you’ll see a rating such as ‘IP54’, the first digit, ‘5’ in this case represents a rating from 0-6 specifying the solid particle or dust resistance ability of the enclosure. The second digit, ‘4’ in this case, represents a rating from 0-9 specifying the liquid resistance of the enclosure.
For outdoor, all weather use, you’ll be interested in enclosures that have a liquid resistance (second digit) rating of 5 or above. Level 5 means that the enclosure has been tested with “water jets” from any direction. All of the levels are explained in detail on the IP Code Wikipedia page. The fact that the enclosure is able to resist water jets from any direction usually means that it has satisfactory dust protection as well, hence it would be unusual to find an enclosure that has a 6 on liquid ingress protection and something less for solids. For most climates apart from the extreme, this should be enough protection from the weather.
If your installation is in a hot climate you may need to investigate ventilation options. The temperature outdoors never usually gets above around 30ºC where I am, but on a sunny day the CPU temperature on the Fin can easily reach 80ºC.
The specific enclosure I ended up using is a Marlanvil 009.PL (190x145x70 IP66). This comfortably provides enough room for the Fin as well as the possibility for future peripherals. The enclosure I purchased is available on eBay, on Electrical Wholesaler and other places. It’s by no means critical that you use the same one I did, but these dimensions may give you an idea of what to look for.
Power supply & connectivity
Next up, power supply! Even if you’re connecting your device to a wireless network and don’t need a cabled ethernet connection, you’re still going to need to provide power to your device somehow.
For my installation, I took advantage of the fact that the balenaFin supports both passive power-over-ethernet (PoE) and active PoE (with a HAT). Due to the fact I’m running a LoRa gateway with an Adafruit GPS HAT, I wasn’t able to easily add the required PoE HAT to use active PoE. Instead, I opted to use passive PoE. The difference between active and passive is essentially that active PoE negotiates the supply requirements with the device before enabling full power, passive sends the full power to the device regardless of if it supports it or not. Don’t plug non-PoE devices into passive PoE ports!
If you decide to use active PoE on the Fin with a compatible HAT (such as this one by DSLR Kit) everything will be taken care of; the HAT automatically negotiates power requirements with your switch and powers the Fin via the HAT pins. Note: the official Raspberry Pi PoE HAT is not compatible with the Fin as it has components on the underside (not part of the HAT specification) which foul components on the Fin).
If, like me, you’re using a different HAT, you can consider the use of passive PoE; something which isn’t an option on the Raspberry Pi. The use of passive PoE without a HAT requires that the device have some method of regulating the input voltage. The Raspberry Pi requires a 5V input whereas the balenaFin accepts a range between 6-24V, meaning we can safely feed it 24V passive PoE. To do this we connect the PoE HAT pins directly to the power input of the Fin and use a 24V passive PoE injector or switch.
I personally like to use Ubiquiti equipment. They produce a range of switches and power injectors suitable for this task. I used the POE-24-24W in the photo above and ran an Ethernet cable to my mast from my home network.
For my installation I also found some neat weatherproof RJ45 (Ethernet) plugs and sockets to use on the enclosure.
If you can’t find these (admittedly overkill) connectors, you can use cable glands, just make sure to get the right size for whatever cable you happen to be using.
Now time for the fun stuff! Let’s take the enclosure and make some holes for the cables, and then mount the hardware inside.
At this point I’m making holes for the LoRa gateway antenna, and for the waterproof RJ45 socket. I’ve positioned the balenaFin in the enclosure to get an idea of what positioning I would like. I’ve positioned it closer to the top of the case to ensure there is room for the cabling at the bottom.
For making holes in plastic enclosures like this, I usually like to use a step drill bit. These work really well in thin material like enclosure walls, and allow you to create a variety of hole sizes with a single bit. They also produce a very clean finish!
Next up is the process of providing a mounting for the Fin. When mounting boards in enclosures like this I like to use plastic standoffs. The standoffs are securely fitted to the board that you intend to fit with a nut, epoxy resin-based glue is applied to the bottom of them and then the board positioned in the case. Once the resin(👀) has cured, the nuts can be removed from the standoffs and the board removed if necessary, leaving them fixed in position.
With this setup you have an easily maintainable installation, should the board fail or need maintenance to the mPCI-express card or the Raspberry Pi compute module on the rear, it’s easy to remove and replace. You can see how the threaded RF connector has been pushed through the hole in the enclosure and the nut fitted and tightened on the outside to provide a solid fixing and seal.
After a quick bench-test, it’s time to move on to the mast installation.
That’s everything done for the preparation works, so now comes the time to install your equipment on your chosen mast!
The main thing I would recommend for outdoor installations is to use stainless steel fittings wherever possible. I live near the ocean, and so anything less does not last very long at all due to the salt water in the air accelerating corrosion. If you’re a long way from water and in a dry climate this is less of an issue, but if you can get them and the cost difference is negligible I would always recommend stainless steel parts for outdoor installation. This means U-bolts, screws, nuts, and bolts etc. You can also coat exposed screw heads and threaded bolts in regular grease after installation to help prevent corrosion as well.
I can recommend Westfield Fasteners as a good source of a wide variety of screws, nuts, and bolts. If you’re looking for stainless steel hardware, it’s usually denoted by ‘A2’ and ‘A4’. ‘A2’ is suitable for all outdoor uses including near the ocean, unless you’re working in a marine environment – i.e. on a ship or underwater. ‘BZP’ means ‘bright-zinc-plated’ and is a coating applied to steel to provide corrosion resistance – this would be suitable in dry areas away from the ocean.
If you’re mounting to a wall or post like me, you’re likely able to get by with screws, but if you’re mounting to a pole then U-bolts or larger sized jubilee hose clips are a good option to consider.
Don’t forget to seal all your connections with self-amalgamating tape as mentioned earlier!
There are a lot of factors to consider when working on an installation like this, a lot of which will change and require some problem solving depending on the exact circumstances of your environment.
In the process of installing my Fin I’ve discovered a lot of useful resources which I’ve included in the post; it’s not intended to be a definitive guide, but more a selection of things I’ve used in solving the challenges of my particular installation. I hope the resources and information provided here has been useful and inspired you to get started with your own installation.
Once you have your setup installed and working, it’s going to be a lot easier to add additional functionality. For example, I’ve already expanded my own setup to include an SDR and antenna for receiving ADS-B transmissions from aircraft using this project; maybe we’ll take a look at that another time.
As always if you need any help, I and the rest of the balena team are always hanging out in the forums at https://forums.balena.io and will be happy to help!