Single Channel Packet Forwarder part 1 [Deprecated]

This looks really cool! Trying to compile the code … can you point me to where gBase64.h comes from?

me to :smile:
found some spare parts in the junkbox

Stupid me, sorry …

I changed the name from base64 to gBase64 as I had more versions around on my system. The base64 library is made by Adam Rudd, see details below.

So you either change its names to gBase64 like I did, or modify the header file in my sketch from gBase64.h to base64.h :smile: (if that works on your system).

name=base64
version=1.0.0
author=Adam Rudd
maintainer=Adam Rudd
sentence=A base64 library for the arduino platform, written in C
paragraph=
category=Data Processing
url=https://github.com/adamvr/arduino-base64
architectures=*

I made an extra comment in the .ino file

@platenspeler
Indeed really cool! Hardware is in the junkbox so …:grinning:
I am trying to compile the code as well. Your last answer solved the same issue i had, but now i get :

ESP-sc-gway:1122 error: 'setTime’was not declared in this scope
setTime((time_t)getNtpTime());
exit status 1
'weekday 'was not declared in this scope

@PH3V, you probably did not load the Time library.

name=Time
version=1.5
author=Michael Margolis
maintainer=Paul Stoffregen
sentence=Timekeeping functionality for Arduino
paragraph=Date and Time functions, with provisions to synchronize to external time sources like GPS and NTP (Internet). This library is often used together with TimeAlarms and DS1307RTC.
category=Timing
url=http://playground.arduino.cc/code/time
architectures=*

Maarten

Using base64.h didn’t work for me. The recent ESP Arduino code has a base64 with different function signatures which i couldn’t stop conflicting, so i had to rename the adamvr one to gBase64 like you had - in the properties file and rename the .h and .cpp file names, and also in the base64.cpp change include for avr/pgmspace.h to just pgmspace.h. (Doesn’t seem ideal so will look for a better way, maybe use the ESP/Arduino base64 functions?). Anyway, now:

WiFi connect to: BTHub5-72W5
WiFi connected. local IP address: 192.168.1.119
Wlan Connected
Connecting to UDP
Connection successful
MAC: 18:fe:34:9b:1d:e0:
SX1276 detected, starting.
Gateway ID: 18FE34FFFF9B1DE0, Listening at SF7 on 867.70 Mhz.

Woohoo!

1 Like

is there GPIO / memory free for a little I2C display ?

look what i found in some junkbox, the HLK-RM04 , maybe also usefull for a little gateway

There are more gpio pins available than wien using the ESP as an LMIC node. Dio 1 and 2 are not used. So i2c should be possible. I’m not aware of any memory limitations as well.
But as usual with the ESP you have to avoid any spurious watchdog resets in case your I2C code will take a lot of cpu time.

Maarten

Pictures?

Its using one of these SX1276 modules i’d just received in the post.

Nice, I have a pair of these modules as well. Good to know they work!

Maarten

NodeMCU single channel (test) gateway [beware that not all clone nodeMCU boards might fit]

NodeMCU -
RFM95 - http://www.ebay.com/itm/RFM92-RFM95-RFM96-868MHz-915MHz-433MHz-LoRa-TM-Wireless-Transceiver-Stable-/331749297679?var=&hash=item4d3dcc8e0f:m:mWs1_m5lf5MtHmJ3h4pyD7g

2 Likes

I’m trying to use this gateway with the ESP node code from here, but can’t get it to work.

I have both the Gateway and node connected to a PC to see the console logs and they both look like they are running ok, just no message gets from the node to the gateway.

The node console output shows:

hal_init: ESP architecture
os_init() finished
LMIC_reet() finished
LMIC_setSession() finished
LMICsetAddrMode() finished
Init done
loop: Starting

Time: 0
Send, txCnhl: 0
Opmode check: ok, ready to send: Starting ESP8266 Dallas

Event EV_TXCOMPLETE, time: 5

Time: 120
Send, txCnhl: 0
Opmode check: ok, ready to send: Hello ESP8266

Event EV_TXCOMPLETE, time: 126

Time: 240
Send, txCnhl: 1
Opmode check: ok, ready to send: Hello ESP8266

Event EV_TXCOMPLETE, time: 246

The gateway console shows:

WiFi connect to: BTHub5-72W5
WiFi connected. local IP address: 192.168.1.119
Wlan Connected
Connecting to UDP
Connection successful
MAC: 18:fe:34:9b:1d:e0:
SX1276 detected, starting.
Gateway ID: 18FE34FFFF9B1DE0, Listening at SF7 on 868.10 Mhz.
time Friday 12:12:51
Admin Server started on port 8080

stat update: <221> {“stat”:{“time”:“2016-4-15 12:13:14 CET",“lati”:51.586742,“long”:-0.102353,“alti”:25,“rxnb”:0,“rxok”:0,“rxfw”:0,“ackr”:0.0,“dwnb”:0,“txnb”:0,“pfrm”:“ESP8266”,“mail”:"ant.elder@gmail.com”,“desc”:“ESP Gateway”}}
Received packet of size 4 From 54.72.145.119, port 1700, Contents: 1:2D:CF:1:

stat update: <221> {“stat”:{“time”:“2016-4-15 12:13:44 CET",“lati”:51.586742,“long”:-0.102353,“alti”:25,“rxnb”:0,“rxok”:0,“rxfw”:0,“ackr”:0.0,“dwnb”:0,“txnb”:0,“pfrm”:“ESP8266”,“mail”:"ant.elder@gmail.com”,“desc”:“ESP Gateway”}}
Received packet of size 4 From 54.72.145.119, port 1700, Contents: 1:46:29:1:

[…]

And in the web interface it shows 0 Packages Received.

Any tips on how to debug whats wrong? Would the consoles be showing all that if i had a wire connected wrong somewhere on one of the SX1276’s?

(Also bit of a newbie at TTN so is the right place to be asking for help, or if not where?)

I had that with my second 1ch gateway. When I measured the pin on the RFM chip to the connection at the Wemos D1 and antenna I found that the antenna pin on the RFM95 was not connected and that if I remember well DIO0 did not mak a good connection at some point.

The interface will behave nicely, but you will never receive any messages :smile:

Maarten

PS. the good news: proabably you did not make any wrong connections

O, please make sure that you use channel 0 (868.1 Mhz frequency) at your Gateway. That is the most generic frequency, and I’m not sure if all new frequencies gave been added to the node sketch (would be sad if the Gateway is listening to a channel that the node will never send to).

Maarten

Yes. All you see is the software sending its 30 second statistics somewhere, and getting a reply. That would even happen if you’d remove the LoRa chip…

See the notes above about the gateway using a single channel, single spreading factor (yours is saying channel 0, SF7), while your node is sending on multiple channels (I see Send, txCnhl: 0 and Send, txCnhl: 1) and maybe also using a different spreading factor.

Also beware that the node saying Send, txCnhl: 0 does not mean it’s actually using 868.10 MHz; it only counts the configured channels (so, if one would only enable channel 1 and 3, 1 would show as 0 and 3 as 1) before sending, LMIC.txChnl actually refers to the previous channel that was used, 0 if no previous transmission happened yet.

See Matthijs’ example to explicitly set TTN frequencies. And if any channel other than 0 is already configured in some library, then you could disable it using LMIC_disableChannel(i).

Mmm, still no joy. Tried pulling out all the wires one by one. The gateway does seem to happily send the stats every 30 seconds, but it doesn’t start up after a power off/on without the wires plugged in correctly, and the same with the node which will only start up and get the “Event EV_TXCOMPLETE” after a send when the wires btw the SX1276 and ESp are correct. The only ones that don’t seem to matter are SX1276-REST to ESP/GPIO16 which can be left disconnected and SX1276-DIO2 to ESP/GPIO3 which i seem to have to leave disconnected or the ESP wont flash. Also tried swapping around which ESP/SX1276 is the gateway or node and either works the same. So given all that and that the node comes back “Event EV_TXCOMPLETE” when its wired up correctly it seems like the hardware is working ok?

The code for the Gateway and Node is exactly whats in the TTN repo, and as far as I can see both using SF7 - Gateway and Node. And the Gateway channel freq here.

Not sure about the comment “the node saying Send, txCnhl: 0 does not mean it’s actually using 868.10 MHz; it only counts the configured channels” - where do i check that?

With the comment " I found that the antenna pin on the RFM95 was not connected" - do you mean within the SX1276 module itself, so i’d need to remove the metal shielding cap on the module to check that?

No.

I used an adapter board (as you can see in the picture). You should only be concerned about the outer soldering pins.

EV_TXCOMPLETE may not be a guarantee that the message was actually sent over the air, but whenever I made a mistake in cabling or so, then normally I would not get that event.

I do not know what other LoRa devices you have in your area, but I would start making sure that I knew whether it is the node or the gateway that is not functioning properly (or both).

Maarten

No idea what other LoRa stuff is in my area (London, UK). Kind of hooked on this now. Or try some RFM95s like you use? I’ve lots of those white adapter boards, if i bought a couple of these, which would arrive early next week, would those spiral antennas from my China modules work just solder on to that?

I just got my single channel gateway to work. ESP8266 + RFM95W. Thanks a lot @platenspeler for all the effort to port the code to this platform. Very much appreciated. I think a new era in IoT has just dawned on us by providing us with a cheap way of making a LoRa gateway.

Crows nest that first ran a RFM95w TTN node, now running a gateway:

My single channel gateway uses exactly the same hardware as described in my post at: Node with ESP8266 and RFM95W