Kickstart Hull's Smart City - free event Wed. 21st Feb

On 21st of February we'll be Kickstarting Hull's Smart City at the c4di. You're invited. You're especially invited if you're a developer wanting to get into city wide networking, a student looking for a new field to get your teeth into or someone who wants to do some good with technology. 

We'll be describing our plans for building a community to work with the latest low powered networking technology and use it to build solutions for local people. It's going to be great fun. 

The event is free, we'll have lots of expertise and maybe even biscuits. You can sign up here

Lora at the c4di Hardware Group

We had a great hardware meetup tonight. I showed off a bit of the latest Hull Pixelbot scripting stuff (once I'd got it to work - note to self - don't turn up with a machine and think you can install the software and it will just work. Doesn't happen). 

Then we talked a bit about Lora (or low powered radio to you). I've blogged a bit about this in the past but now we want to take things a bit further, and get going making Lora stuff. We've got all kinds of plans, none of them involving world domination. At least that's what we're saying for now. 

Anyhoo, expect to hear more about our Lora plans in the not too distant future. It looks like a great technology to get in on the ground floor of. If you fancy getting involved you should come along to our next meetup and utter the magic phrase "I fancy getting involved". You can sign up for the next meetup here

Single Channel Lora

I'm learning more about the Lora network. Lora links tiny, low powered, devices to an application. The devices talk to a Lora "gateway". The idea is that any device can talk to any gateway. Lora networks use different radio channels to pass data, and the node can select any data channel to send any particular message. Nodes usually cycle through the available channels.

A "proper" Lora gateway will listen on 8 channels at the same time. However, my tiny (and cheap) |Lora gateway from Dragino only listens on one channel.  This means that under normal circumstances I only receive one message in 8 on my gateway. Which is a bit of a limitation. 

Fortunately for me there is a way you can restrict a node to only using one channel. I found a forum post here which tells you how to do it. This is not something I'd advise anyone to do, because it is not in the spirit of the way that Lora works by spreading messages round different channels. However, I've made a script (called naughty) which does this, and it works fine. 

The really good news for us is that Hull centre is now served by a proper Lora gateway so if I use my Lora nodes in Hull they just work. 

Things Network Frame Counter

I'm getting the hang of Lora networks. And by that I mean "Spending quite a lot of time figuring out why things don't work when they really should".

Today I found out about Frame Counter Checks. Each Lora packet contains a frame counter value. This is set by the node when the packet is sent into the network. The Things Network likes it if the frame counters in packets always get bigger. This makes it slightly more difficult for someone to spoof messages into the network. 

Trouble is, if you're using a very simple node you'll find that the frame counter is reset to zero by the software each time you start the device. Which means that The Things Network will reject packets from the device until it seems a frame counter bigger than the one it's seen so far. 

Unless you know this, you'll spend ages trying to figure out why something that worked yesterday has suddenly failed. 

There's an option for the device settings for your application in the Things Network which turns off Frame Counter checks, which you can see above.

In a proper application you'd either save the frame counter in eeprom each time you've used it, or do something clever with the date and time to generate a frame counter value which is always bigger than the last one. 

Lora Node Live

Well, I've sent and received my first Lora packet sent from a node into a gateway. It turned out to be quite easy to set up. First you create an application, then you create a device, then you take the key data of the device web page and paste it into your node program. Then it works. 

Now I need to work out how to take the data off the server at the things network and do something with it. 

Great fun.

Learning about Lora

I don't know much about Lora networks. But I know more now that I did this time last week. Which is a good trajectory I suppose. Here are some things I know now.

  1. Lora is low-power, long-range. But very low data rates (just hundreds of bytes a second, if that). 
  2. Lora works. As I write this I've got a tiny Lora node sending lumps of data across Cottingham, where they are being received.
  3. You can get Lora devices for very low prices. I'm paying around 12 pounds for a node with a rather fancy OLED display, but you can get the interface chips for a round a third of that. 
  4. Frequency is important. In the EU you should get devices that work on 868Mhz, in the US go for 915MHz. There's another frequency, 433Mhz that you can use in the EU, but it might not work as well because this frequency is also used by radio amateurs and whatnot. 
  5. If you want to just use Lora to link a few devices that are a long way apart (up to a KM or so) then you can buy devices like mine and just use them. 
  6. Lora nodes in a proper Lora network talk to a gateway device that takes their messages, assembles them into lumps of JSON and sends them over the internet to a central server which makes them available to your application. You can buy gateways, or you can make tiny ones of your own. (That's what I'm trying to do at the moment)
  7. Lora uses a range of radio channels which are grouped around the working frequency of the particular node. A proper gateway implements a bunch of channels (usually 8) and cost at least 150 pounds, but you don't need one of these to start with. A single channel gateway will work fine for up to 50 or so nodes.
  8. You can register your gateway on the things network. This acts as the server in my description and allows other people can find and use it, and also lets your cloud service capture data and send commands to nodes. Commands are sent to nodes after the node has sent a message to the gateway. This saves power (and makes the networking easier) but it does mean that you can't just tell a node something, you have to wait until it reports in and then send a message. The node will listen for a while after it has sent a message. There are versions of Lora that allow messages to be sent to the node at any time, or in designated time slots, but these aren't in common use yet.  
  9. You create applications on the things network. An application is associated with one or more Lora powered nodes which use keys to authenticate their messages. You can bake the key into the node and use activation by personalisation (ABP)  or use over the air authentication (OTAA). OTAA is more secure, but not many devices (and certainly not simple gateways) do this. 
  10. Anyone can hear your Lora transmissions. The Lora standard offers proper end to end encryption but this doesn't seem to be available in devices just yet. 
  11. Andreas Spiess (aka 'The Guy with the Swiss Accent') has made some splendid videos that describe the technology. Great to watch during the lunch hour. 
  12. Lora is a great solution but I'm not completely sure what the problem is. But I'm still going to play with it. 

Lora Networking Hardware

Had a rush of blood to the head today and ordered a complete Lora networking kit from Tindie. Only slightly more expensive than a video game and a lot more fun. I'm going to set up a test Lora network in Cottingham for folks to connect their sensors. It's only a single channel gateway (hey - I'm not made of money) but it should be good for up to fifty sensors or so. . 

Then we can work out what to use it for......

The Lure of Lora

I was on AliExpress the other day, always an expensive experience, and I happened upon some boards from Heltec that offer an ESP32 (the upgrade of the ESP8266), a tiny OLED display and, most interesting, a connection to the Lora network. I've been meaning to spend some time playing with Lora for a while. It offers low power networking with a range that can go up into kilometres. At first I ordered one, and then it occurred to me that a network with only one node isn't really a network, so I got a couple more. 

They arrived on Friday the 13th last week and, much to my surprise given the date, they worked first time. I downloaded the sample programs, added them to my Arduino IDE installation and in no time at all I had two of the devices talking to each other.

Later on I discovered that I have been a little unlucky/stupid in that I've bought versions that work on the 433 MHz radio band, which is not the frequency that works the best for these devices. For the UK I should have bought the version that supports the 868 Mhz band that is used in Europe

Never mind. I can still use them, but I'll get more interference because this band is used by radio amateurs, car keys and building alarms etc. I'm looking forward to finding out more about how the network can be used.