LoRa PC Gateway

I generally use the Raspberry Pi to receive LoRa transmissions from balloons, and to upload the packets to the HabHub servers.  However it sometimes might be more convenient to use a PC or Mac, or a phone or tablet, for internet connectivity, in which case we need some way of interfacing a LoRa module to those devices.

Hardware

Here I have used an Arduino Mini Pro, connected to the LoRa module via SPI and 2 I/O pins, and using software derived from my Handheld LoRa Receiver to allow control of the module via the Arduino’s serial interface.  I’ve built 2 such devices, the first of which connects to a PC via USB, using a Prolific PL2303 USB-serial adapter:

IMG_2811

IMG_2809

The second device uses the same firmware, but connects to the PC (or Mac, tablet, phone) via bluetooth using a HC-06 bluetooth serial adapter.  Power comes from a small LiPo, using a USB charging module.

P1110723 IMG_2813

Firmware

The firmware handles incoming packets directly, copying them to memory before sending to the host PC or mobile device.  It also sends various status values – current RSSI every second, and packet RSSI, SNR and frequency error before each packet.  It accepts simple commands to set the LoRa frequency, bandwidth, spreading factor, error coding, packet header type and low data-rate optimisation.

Software

Currently I’ve produced Windows software that communicates with either device using a virtual serial port (USB or Bluetooth), and expect to make that cross-platform soon (OSX, Android, iOS).  This program allows the LoRa parameters (frequency, bandwidth, spreading factor etc.) to be set, displays incoming telemetry packets, and optionally uploads those packets to Habitat (so the balloon position is displayed on the live map).  SSDV isn’t supported yet.

WindowsGateway

Build

To make your own device, you will need:

  • Arduino Mini Pro
  • Programmer for above
  • LoRa Module (RFM96 for 868MHz or RFM98 for 434MHz)
  • Wire and solder
  • SMA Socket
  • Suitable case

Plus for the USB version:

  • FTDI or Prolific USB-serial adapter

or, for the Bluetooth version:

  • HC-06 Bluetooth interface
  • LiPo battery
  • USB LiPo Charger
  • On/Off Switch

Connections from the Arduino to LoRa are described in the firmware.  Remember to connect GND on Arduino to GND on LoRa, and Vcc on Arduino to 3.3V on LoRa.

For the serial version, first check if your USB adapter supplies 5V or 3,3V or both; for 5V you need to connect the 5V line to the Arduino “Raw” supply input; for 3.3V connect to the Vcc pin instead.  Also, connect 0V/GND from USB adapter to the Arduino GND pin.  The USB Tx connects to Arduino Rx, and USB Rx to Arduino Tx.

For the Bluetooth version, the LiPo connects to the Arduino Raw pin via a switch.  The Bluetooth device then takes power from the Arduino 3.3V line.  Rx/Tx pins connect as above.  All GNDs connect together of course, and to the battery -ve wire.  The LiPi charger connects to the battery directly.

Download the firmware and program the Arduino with it.

To the USB version to a PC, just plug it in and hope that Windows installs the driver OK; if not then download and install the driver appropriate to your device.  Check in Device Manager to see which serial port number it has installed.

For the Bluetooth version, connect and install a USB Bluetooth adapter if one is not already installed.  Power on your LoRa/Bluetooth receiver and then search for the bluetooth device in Windows.  You should see “HC-06” show up.  If you are asked for a PIN number it is 1234.  Check in Device Manager to see which serial port number it has installed; if it doesn’t show then be prepared to wait – for some reason it can take several minutes.

If you are using my Windows software, download that to a new folder and just run the .exe file.  Choose the serial port that was installed earlier, and within a couple of seconds you should see the “Current RSSI” value start to update.  Choose your LoRa settings and click the “Set” button.  Once you’ve done that, you should start seeing packets arrive (assuming you have a tracker running using those LoRa settings, of course).

 

This entry was posted in Weather Balloon. Bookmark the permalink.

7 Responses to LoRa PC Gateway

  1. Felix R says:

    How about a Moteino/MoteinoMEGA (the LoRa variants)?
    Would make it even more compact.
    http://lowpowerlab.com/moteino
    Sorry for the shameless plug.

    • dave says:

      The gateway isn’t size or power-restricted, and needs internet connectivity, so the Pi is a better solution. At the balloon side though size, weight and power consumption do matter, and the Moteino is a good solution there for those making trackers.

  2. Yaron Kraus says:

    Dear Dave,
    I’m following your projects with great interest, great job!!!
    Any reason for not using Arduino libraries like LowPowerLabs or RadioHead for the radio communication, or SoftwareSerial for the Bluetooth communication?
    Thanks,
    Yaron.

    • dave says:

      There were no libraries for these Lora devices when I started. As for SoftwareSerial, there’s no need as the hardware serial is available.

  3. john M0IDA says:

    Dave, nice blog. I’m thinking about a solar powered Lora gateway and was wondering about power consumption as I’d like to provision solar power for a similar gateway?

    • dave says:

      It’ll use roughly 500mW, depending on Pi model, WiFi adapter (built-in one on the Pi Zero W would be best), and what you switch off (e.g. HDMI saves 20mA).

      • John says:

        Thanks Dave, that gives me a guideline. I didn’t know about switching stuff off on the pi so that’s a good tip to investigate ? 73

Leave a Reply

Your email address will not be published.