PC Pro

Discover everything you’ve ever wanted to know about antennas and public networks as Paul continues his LoRaWAN series.

Discover everything you’ve ever wanted to know about antennas and public networks as Paul continues his LoRaWAN series

- PAUL OCKENDEN

Thanks for the feedback so far on this short series of columns covering LoRa and LoRaWAN. It’s nice to hear that the idea of low-powered long-range radio is grabbing your interest.

I briefly mentioned antennas last month, but let’s take a look in a bit more detail now. Actually, I say “detail”, but antenna theory gets very complex and you’d need a thick book to cover it all, not just a few paragraphs in a magazine column, so as usual I’ll try my best to simplify things. Apologies in advance if you’re a radio nerd and my simplifica­tion goes a step too far!

There are many different types of antenna, but perhaps one of the first things to look at is whether they’re directiona­l or not. Actually, to a degree, all antennas are directiona­l. You’ll never get a truly 360° pattern, “isotropic” in antenna parlance, but that’s just being pedantic – certain antennas are designed to pick up signals from all around, while others are looking for a single point some distance away.

Think about TV aerials for a moment. In particular, think about those big transmitte­rs you see. Some look like versions of the Eiffel Tower, with Crystal Palace an excellent example. Others are more like tall concrete poles; for instance, you might have spotted the Emley Moor transmitte­r if you’ve driven up the M1 through Yorkshire as it’s the tallest free-standing structure in the UK (there’s a taller mast in Cumbria, Cumb but it’s secured with guys). The Th antennas at these transmitte­r transmitte­rs are obviously not directiona­l; that would be no use at all. But they also aren’t truly isotropic, either. After all, there’s no point in beaming episodes of EastEnders up into the sky and out into space. These TV transmitte­rs need to radiate out in a plane, and perhaps counterint­uitively counterint­uitivel they’re called “omnidirect­ional”. “omnidirect­ion l If you’ve ever played with microphone­s, you’ll know that the term omnidirect­ional is used for a mic that will pick up sound from all directions in 3D space, so all around as well as above and below. However, when we’re dealing with antennas the usage of the word is quite different. An omnidirect­ional antenna receives or transmits in all directions perpendicu­lar to an axis. So when you think of those big TV masts, the transmissi­on pattern looks a bit like a ring doughnut radiating from the pole in the middle, ensuring that people from all around get to receive the signal and allowing for variations at ground level such as hills. These simple pole antennas with their characteri­stic doughnut radiation pattern are called “monopoles”.

Now think about the TV aerial on your roof. That’s not just a pole is it? There are a few different designs, but usually they will have numerous elements and be quite directiona­l. After all, you don’t need to pick up signals from all around, just a TV transmitte­r mast in the distance.

The more focused this directiona­lity, the more the antenna can home in on the point in the distance. But a narrow beam also means that the aerial needs to be really secure, because if it sways in the wind then that tight beam might miss the target. So if you live within a reasonable distance of the transmitte­r and get a strong signal, it can be a false economy to invest in a large and very directiona­l onal antenna – you’ll do better er with a shorter, cheaper aerial. rial. An even more tightly focused ocused antenna is a Sky dish, and it’s because of the narrow angle that you’ll usually find a dish bolted to your house using strong wall anchors – you certainly don’t want a satellite dish flapping around round in the wind.

The two ends of the TV transmissi­on mission are good examples

“It can be a false economy to invest in a large and very directiona­l antenna”

that help you visualise when you need directiona­l and when you need omnidirect­ional antennas.

Now think just about transmitte­rs for a moment. Imagine that you have one pumping out 1W of radiated power. If you use a very directiona­l antenna, you’re sending nearly all of that power to a point in the distance. The point won’t receive all of it because the beam still has a width that will be wider than the receiving antenna, but it helps a lot if you send all of that radiated power in the right direction. Contrast that with an omnidirect­ional antenna where that radiated power is spread out in all directions and where the point in the distance will only see a small part of that radiated watt. Perhaps think of it like a torch. In normal use, you can shine it and see a small area of the bottom of your garden; remove the reflector from the torch so that the light goes in all directions and the bottom of the garden will remain dark. The bulb is the same brightness, but the “signal” isn’t directed.

A similar thing happens in reverse when you’re receiving, although in this case it’s also to do with noise. A directiona­l receiving antenna allows you to focus in on that distant point where the transmissi­on is coming from. But an omnidirect­ional antenna will be picking up all kinds of stuff from all directions, making it tough to pick out the signal that we want to listen to.

There are many different types of aerial. I’ve already discussed monopoles, but there are dipoles too. There are reflectors, travelling wave antennas, horn and slot antennas, array antennas, helical antennas, PCB antennas, loop antennas, folder dipoles… the list is almost endless. And for the purposes of messing around with LoRa, you really don’t need to worry about any of that. All that’s important is whether the an antenna is directiona­l or not. And in mo most cases it will be “not” – we’ll be usi using monopole or helical antenna antennas in an omnidirect­ional manner. The only exception will be where you’re using LoRa for point-to-point communicat­ion between two fixed places.

Next, we need to think ab about how well an antenna is going to w work.

Imagine that you have a simple monopole antenna (like the ones on the top of the TV transmitte­r towers, but smaller) and you’re sending 1W of power into it. Ideally, you’d want it to fully radiate that 1W to the outside world, but unfortunat­ely that’s never going to happen. Antennas are always imperfect and don’t radiate all of the energy. So what happens to the rest? Is it like a light bulb and radiated as heat? Well, a very small amount might be, but the vast majority of the unused signal will be reflected and sent back down the feeder cable.

A term that’s used here is VSWR, which stands for voltage standing wave ratio, but nobody ever says it in full (although you might find people pronouncin­g VSWR as “vis-war”). It’s a measure of the ratio of the injected and reflected signals, and so is a way to quantify an antenna’s imperfecti­on. It’s important to note that for any antenna the VSWR varies depending on the frequency, and that VSWR is affected by the feeder cable as well as the antenna itself.

If you want to dive deeper into this, take a look at the YouTube video at

pcpro.link/320VSWR, which was posted by Paul Denisowski at Rohde & Schwarz. If anyone knows about RF stuff, it’s that company.

Ideally, you want an antenna that, at the chosen frequency (868MHz for the LoRaWAN kit we’ve been looking at), has a VSWR as low as possible. You’ll never get it as low as one, which means there’s zero reflected signal. A VSWR of two means there’s about a tenth of the signal being reflected, and three means your loss is around a quarter. That’s really the limit for a useful antenna. By the time you get to a VSWR of six, you’ve lost over half the signal, and VSWR has a maximum of infinity, so you really need to focus in on those small numbers. Stick to three or less, and ideally lower. Incidental­ly, if you get the VSWR completely wrong when you’re using a high-powered transmitte­r you can end up with nearly all the signal being reflected back into the transmitte­r, which can fry the RF amplifier. It won’t affect the LoRa kit, though.

You might also see the term SWR quoted in antenna literature. SWR is the theory of standing waves and VSWR is the practical way that you measure it, but many people seem to use the terms interchang­eably, so don’t worry if you see it quoted without the “V” – people are still talking about the same thing.

You’ll occasional­ly see the VSWR quoted in the adverts for antennas, but usually it will just show the frequency (or frequency range) that the antenna was designed to use. The trouble is that those descriptio­ns aren’t always accurate. I recently bought a cheap antenna on Ebay that claimed to be for 868MHz but the performanc­e was terrible. When I tested it, the VSWR at 868MHz was over five. It was actually tuned to work at 960MHz. I’ve no idea what it was intended for, but it certainly wasn’t LoRaWAN communicat­ion.

Testing, testing…

How did I test it? Well, I’ve no doubt the chap in the video I mentioned above would love you to buy some test gear from Rohde & Schwarz – it produces some stunningly good kit, but it’s not what you’d describe as cheap. If you’re running a high-end test lab like the esteemed Mr Honeyball, that’s not a barrier, but if you’re more of a hobbyist then you want something that’s softer on the bank balance.

I used a brilliant little dev ice called a NanoVNA. A trusted UK supplier of the original design is Mirfield Electronic­s ( mirfield

“You want an antenna that, at the chosen frequency, has a VSWR as low as possible”

electronic­s.co.uk), but it’s an opensource design and there are plenty of clones on the market. Just be aware that they vary in quality: for example, some of them don’t use shielding to protect the sensitive parts of the PCB, so tread carefully or buy an original. At £50 (around half that for a clone), these things are brilliant.

There are all kinds of things you measure with a NanoVNA, and you’ll find that by default there are several traces displayed on the screen, but for simple antenna tests you can turn them all off except for VSWR (on the NanoVNA, it’s called SWR).

You set a start and a stop frequency, and the screen becomes a graph of the SWR between those two frequencie­s. What you’re looking for is dips in the trace because these show the frequencie­s that the antenna is designed to use.

You control the device using either a touchscree­n or the little wheel control at the top of the screen – if I have one criticism it’s that the thing is sometimes fiddly to drive. Also, you’ll need to recalibrat­e it using the supplied dummy loads every time you change the frequency range, which is a faff, although you can save this calibratio­n data to a number of banks if you find yourself regularly using the same frequency ranges.

Alongside your NanoVNA, I’d advise getting a set of RF adapters – something like pcpro.link/320ant – as there’s a weird and sometimes perverse range of connectors out there. Take the most common of small antenna connectors, which is called SMA. There are the usual male and female varieties, but then there are also so-called reverse polarity versions (RP-SMA), where you’ll find a male connector in a female body and vice versa. A kit like the one above means that you can hook up with pretty much anything.

Going public

Last month, I mentioned The Things Network when I wrote about LoRaWAN gateways. But The Things Network, or TTN as it’s usually called, is so much more than a gateway manufactur­er. The whole idea behind TTN is to provide a public access LoRaWAN network globally. See more at thethingsn­etwork.org.

It’s not like the mobile networks where the network operators have their own call towers. There are alternativ­e

LoRaWAN operators that use this model, but these are mostly geared towards big infrastruc­ture projects like smart meters and the operators don’t want hobbyists or small-time players using their network. TTN is different: it’s open to everyone, and although the likes of you and I can use it, there are bigger projects that use it too.

With TTN, you can hook up your own gateway to it so that others can use it. This is more useful if it’s an external gateway and in an elevated position. You can also use gateways provided by other people. Take a look at ttnmapper.org, which will give you an idea of how many public gateways there are near you – just be aware that it can take the map a long time to fully load.

As you scroll around the map, you’ll see that some of the gateways have coverage areas shown – you do this using an associated TTNMapper mobile app and carrying some kind of LoRaWAN transmitte­r. Every time the transmitte­r pings your gateway it will upload the data to TTN, which the

TTNMapper app then queries. When it sees a ping recorded, it updates the coverage on the map.

You might be concerned about security if you’re channellin­g data through someone else’s gateway, but don’t be. Although they’ll see the connection, the data you send uses AES 128-bit security for encryption and message integrity checking, meaning there’s little chance of them intercepti­ng the data. There’s a unique 128-bit encryption key for each device that connects to TTN.

There’s much more to TTN than using other people’s gateways or allowing them to use yours. You can also keep everything private, and just use the system to build your own data applicatio­ns.

At its simplest, you register your gateway on the network; once that’s done, you register any sensors, dev boards or other LoRaWAN devices that you want to. There’s a list of compatible hardware on The Things Network ( pcpro.link/320things), but it isn’t exhaustive – I’ve got a couple of sensors that aren’t shown. It’s certainly extensive, though: on that list, you’ll find everything from water meters to vehicle trackers and even rat traps!

When it comes to working with your data, TTN supports MQTT (Message Queuing Telemetry Transport), which regular readers will remember me writing about in previous columns. There are also SDKs that allow you to speak to TTN from languages such as Java, Node.js, Python, Node-RED and Go. There are other useful integratio­ns too, from simple HTTP webhooks through to a decent AWS IoT linkup.

Next month, I’ll conclude my LoRaWAN mini-series with a more detailed look at how to create an applicatio­n using TTN, as well as revealing some of the better sensors I’ve discovered.

“On the TTN list, you’ll find everything from water meters to even rat traps!”

 ?? @PaulOckend­en ?? Paul owns an agency that helps businesses exploit the web, from sales to marketing
@PaulOckend­en Paul owns an agency that helps businesses exploit the web, from sales to marketing
 ??  ?? BELOW One of the wonders of modern Yorkshire: the Emley Moor transmitte­r
BELOW One of the wonders of modern Yorkshire: the Emley Moor transmitte­r
 ??  ?? BELOW If you mess around with antennas, the NanoVNA is a really useful bit of kit
BELOW If you mess around with antennas, the NanoVNA is a really useful bit of kit
 ??  ?? ABOVE VSWR shows an antenna’s balance between injected and reflected signals
ABOVE VSWR shows an antenna’s balance between injected and reflected signals
 ??  ?? ABOVE From left to right SMA male, SMA female, RP-SMA female, RP-SMA male
ABOVE From left to right SMA male, SMA female, RP-SMA female, RP-SMA male
 ??  ?? BELOW With TTNMapper, you can check out the TTN nodes in your area
BELOW With TTNMapper, you can check out the TTN nodes in your area

Newspapers in English

Newspapers from United Kingdom