Close

Raspberry Pi LoRaLAN gateway for Vinduino

A project log for Vinduino, a wine grower's water saving project

Monitoring soil moisture at different depths to determine when to irrigate, and - more importantly - how much water is needed. Save 25%!

reinier-van-der-leeReinier van der Lee 12/24/2016 at 17:000 Comments

LoRa Sensor Gateway

The Vinduino gateway receives LoRaLAN sensor data from the Vinduino sensor stations and forwards via WiFi to a ThingSpeak account.
To date, the Vinduino project has been using an Electric Imp solution, which required some soldering and PCB assembly.

The following project update, describes a gateway that uses a LD20-H USB LoRa dongle from Globalsat, and does not require any electronics tinkering. This dongle is basically a USB version of the Globalsat LM-210 LoRa module used in the Vinduino sensor station, and, alike the module, works as a wireless UART. Combined with a serial terminal program, this dongle also makes a great debug tool to check out the LoRa network and sensor stations.

The Vinduino LoRa gateway can handle up to 300 sensor stations within a range of 5 miles, and can be made for less than $100, assuming that an old PC’s useful life can be extended for the task of working as gateway. Because the software is based on the operating agnostic Python-3 programming language, the supported PC platforms that can function as gateway include Windows, MacOS, Ubuntu Linux , and of course Raspberry Pi. For increased traffic handling, more USB dongles can be added, working on different frequencies.

The Python-3 gateway script, although tested to be working reliable for its basic gateway function, can be customized/improved as needed. For locations where access to Internet is not reliable, or intermittent, we added a SQLite database to store all sensor data locally.

One possible application could be to store data locally and upload when an internet connection is available. This may also be a good starting point for developing smart irrigation algorithms.

The Globalsat LD20-H is available on Tindie

PS: This LoRaLAN gateway is not compatible with LoRaWAN sensor stations.

LD-20H features

Installation

Python modules needed for the Vinduino gateway script:

  1. serial
  2. time
  3. thingspeak (linux install: $ sudo pip3 install thingspeak)
  4. sqlite3

DB browser for SQLite (http://sqlitebrowser.org) is a great program to manage the SQLite database.

Linux install: $ sudo apt-get install sqlitebrowser

For Windows, install the Cypress USB serial driver

For Linux:

Linux does not require a special drivers for the USB serial interface, however ensure that you have qt4, gcc, and libusb installed. The USB driver stack in Linux has a built-in driver for CDC-ACM class devices. The Cypress chip inside the LD-20 supports CDC-ACM class, CDC-ACM driver gets automatically bound to the device and creates a device node in /dev/ttyACM*(* -The name of device node will vary based on the number of devices connected).

Here is a good description for testing the USB serial connection in Linux:

http://www.cypress.com/knowledge-base-article/testing-usb-serial-bridge-controller-configured-usb-uart-linux-kba92551

I found that Ubuntu and RPI recognized the USB serial port, but assumed it was an AT-command modem.

A solution that worked for me is to bypass the ModemManager:

sudo systemctl mask ModemManager.service

Discussions