Wednesday, June 21, 2017

My First Lora Gateway

FRM95
RFM95 back LoRa breakout

As i like doing some projects with IoT i also wanted to experiment with LoRa.
Some time ago i ordered a cheap LoRa shield for my Arduino. Unfortunate i did not get it working. I could not find out if it was something with the code, the jumper settings, a hardware error or perhaps my shield could not reach a LoRa gateway in Almere.
Perhaps in another LoRa post in my blog you will read more about this shield.
RFM95 front LoRa breakout

When asking advice someone was so friendly to send me documentation to make a simple one channel test LoRa gateway with an RFM95 and a Wemos D1 mini.

On Aliexpress i found two RFM95 breakout boards for 13 Euro so i decided to order them. I have done several experiments and projects with different ESP8266 boards but until now i never used the Wemos version.
Between the  RFM95 and the  Wemos D1 mini (ESP8266) you need to make the some connections.
Wemos D1 mini
Wemos D1 mini
According to a descriptions i connected this:
RFM95 pinESP8266 pin
3.3V3.3V
GNDGND
MISOD6 GPIO12/MISO
MOSID7 GPIO13/MOSI
SCKD5 GPIO14/CLK
NSSD8 GPIO15/CS
RESET*nc
DIO0D1, GPIO5

The Wemos D1 mini came with 2 sets of male pins, 2 sets of female pins and 2 sets of female with long male pins. I decided to build the circuit on a small prototype PCB board. (It is also possible to order a Wemos PCB for the RFM95 or connect them direct.)
I decided to solder the female with long male pins on the Wemos D1 mini. On the PCB i soldered the two sets of female pins so i could separate the ESP8266 from the circuit if needed. As the Wemos can be put in two ways in the connector of the PCB i marked the side of the Antenna.
The Lora RFM95 is not breadboard friendly. I soldered it direct on the prototype PCB next to female pins for the Wifi ESP8266 Wemos module. Each RFM95 pin (except the Antenna pin) is connected to a Dupont male pin. To the Antenna pin i soldered a 8,2 cm wire to use this as a first test antenna. (Perhaps after some testing i change this to an SMA connector as in the documentation.)
After this is soldered the wires between the RFM95 and the Wemos connector on the PCB as in the table above. (Most of these connections are made on the copper side of the PCB so you can not see them on the pictures in this blog article!) 
I added a button between D4 and ground to have a simple input button to test the ESP8266
The Wemos D1 mini already has a Reset button.
Next to the GND and 5V of the Wemos i added male pins to have easy access to GND and 5V and there is also a third pin connected to the 3V3. I only have tested my module by powering via USB
I tried to connect the Wemos to my computer using USB. At first it did not work as i used an USB power cable instead of an USB data cable. (I think i need to label my USB cables!).
After finding the right cable i tried to upload the Blinck sketch first to test the connection and the Wemos module.
I got the system message "Error board is unknown / (Package ESP8266 )" and solved this problem (
http://arduino-esp8266.readthedocs.io/en/latest/faq/a04-board-generic-is-unknown.html )
In the directory ' Users\<MyName>\Arduino15\packages\esp8266\hardware\esp8266 '  i needed to manual clean up old software. So i removed there everything and Blinck worked.

Now the 1ch Wemos gateway software. When installing this on my computer "Time" was already installed on my computer. As i did not know if this was the right version i decided to rename the old version.
Stupid as this did not work. When starting the Arduino software to upload it to my Wemos i got an error message that there where two versions of "Time" with a link to my renamed version.
So i moved my old "Time" version to another directory and this problem was solved.
Now i got the error message "Documents\Arduino\ESP-sc-gway30\ESP-sc-gway30.ino:67:92: fatal error: gBase64.h: No such file or directory"
Googled and installed another "base64" but this did not solve my problem.
Finally i found the latest 1ch gateway software ( Version 4. ) . This package included gbase64 and after adapting the configuration parameters it worked.
The error message "The management functions only work over _THINGPORT and not over _TTNPORT" also went away by adapting the parameters.
In the end i got a working 1 channel test LoRa gateway. The IP address of the Wemos ESP8266 gives a simple webpage to check and configure some parameters,
Some things i want to do with this device:
- testing this gateway with another LoRa device (my Arduino LoRa shield?),
- putting this device in an enclosure
- adding connector for another antenna
- adding one or more sensors (temperature) to this LoRa gateway
- adding a better power supply

No comments: