Single Channel Packet Forwarder part 1 [Deprecated]

@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

Indeed, channel 0 (868.1 MHz), SF 7, like your gateway log shows you.

But your node’s log shows it’s transmitting on at least two channels. Given @matthijs’ comment when his example sets up the channels:

Without this, only three base channels from the LoRaWAN specification are used

…and apparently lacking anything similar in @platenspeler’s example, I assume his code relies on those “three base channels”? Assuming that includes channel 0 (868.1 MHz), for testing just add:

LMIC_disableChannel(1);
LMIC_disableChannel(2);

But still then, assuming the base channels include channel 0 (868.1 MHz), some of the node’s transmissions should already use that, and hence be visible in the gateway.

Does the node’s pin mapping match?

Note that many SX127x modules only expose a single antenna connector and then use the SX127x’s RXTX pin and an onboard switcher to wire that single antenna connector to either transmission or reception, hence not needing the LMIC rxtx to control anything. See also Matthijs’ excellent documentation (but note that LMIC_UNUSED_PIN is a recent addition, not yet merged into every clone of Matthijs’ repo).

Note that it’s platenspeler’s repo, not TTN’s. Minor detail.

http://thethingsnetwork.org/map and http://thethingsnetwork.org/c/london with green being online and blue Kickstarter pledges—but the displayed range is just a configuration.

I’m make fork and add NiceRF LoRa1276 supporting (NiceRF modules have 2 additional pins: TXEN and RXEN)
I’m successfully received data from RN2483.

1 Like

@platenspeler
You said that DIO1 and DIO2 of the radio is not needed when setting up a gateway with the ESP module, freeing two pins on the module. The communication with the radio is done via SPI, which is a bus. Do you think we can add two more radio’s to the same bus, using the two free pins as chip-selects?

My thoughts are going in the direction of building a three channel, single datarate (single spreading factor) gateway, using three HopeRF RFM95w’s and one ESP8266. Do you think this will be possible?

Hi,

I was first thinking in the same direction, however I think it will be a major change in the software to keep track of all extra administration. Not only the DIO0 but also the slave select line is in general duplicated for every slave on the bus.

Since the ESP8266 only costs $2.70 or so, the same functionality can be achieved at little extra cost by just having 2 or more single channel gateways work in parallel.

This does mean multiple IP addresses but apart from that it works quite well. (I have 3 now: 2 ESP and one Raspberry).