You can use LoRa to pass small messages between devices, but it is much more useful to make a device part of a LoRaWAN application. In an application, messages are sent to a local gateway which provides a connection to a LoRaWAN service running in the cloud. You can set up your own LoRaWAN infrastructure, but most people use ‘The Things Network’, which is free to access and underpins a huge number of community-operated gateways. You can check the gateway coverage in your area by using the TTN mapper site. Your programs can interact with a LoRaWAN application in a variety of ways, including MQTT (Message Queuing Telemetry Transport) endpoints. The Waveshare board is supplied with an example that transmits values from the temperature sensor on the Pico. You can connect more sensors to the Pico, and send their readings in LoRa packets.
For your money, you don’t just get the device – you also get an external antenna and a rechargeable battery. You just need to add a Pico and any sensor inputs or control outputs that you want to connect to it. The hardware is especially well thought out. You plug your Pico into it, but it also provides pass-through pins to connect to other devices, or for plugging into a breadboard.
You program the device in C++ using Visual Studio Code. And this is where things start to get a bit tricky. Installing Visual Studio Code on a computer is easy enough, but configuring it to create Pico programs turns out to be a bit trickier. The best solution is to use a Raspberry Pi as the development device. The getting started guide describes how to use a batch file that sets up everything automatically. It even shows you how to set up in-circuit debugging, which turned out to be very useful when testing this device. The in-circuit debugging works by linking the Pico directly to the development device. C++ programs are compiled on the Raspberry Pi and then sent into the Pico. The additional connections on the top of the Pico are used to control the debugging process. Note that if you want to use the serial output from the Pico to interact with your programs, you can connect the USB port on the Pico to a device and then run a terminal program on that device to talk to it.
Before a device can interact with a LoRaWAN application, it must first be added to the application. You do this on The Things Network console web page. Each device in an application has a unique address, and all messages sent by the device contain this address. Any messages the device sends are received by any gateway, and the device address is used to direct the message to the corresponding applications. And here we hit a snag. Whenever our device tries to connect to LoRaWAN, it uses an incorrect device address.
Fortunately, we traced the problem to a small part of the driver that converts the addresses from text into the numeric values used in the transmission. Thanks to Brian N for his help with this. At the time of writing, Waveshare is aware of the problem and an updated version of its software will be available soon.
This board would be a great way to get started with LoRaWAN using the Raspberry Pi Pico. You get an awful lot for your money.
Price £14.50 inc VAT