Send data from gateway

Hi, sorry if it is an stupid question or it’s has been answered before…but I couldnt find the answer.
I have a gateway (Rpi zero and a RAK7243) that is already connected to TTN (the TTN dashboard shows it connected). I want to know if is it possible to send data to TTN directly from that gateway (I have an I2C temperature sensor attached to the RPI and it is working well) without any device connected. Is it possible to program an Application with the gateway as the device that sends the data?.

Yes, but it’s very tricky as you have create a virtual device that then injects the packet in to the gateway software.

But as your Pi is online, why not just send it directly to your backend database?

I dont know what you mean with this. What I want is to upload the data to TTN directly from the gateway.

Why do you want to send specifically to TTN? We assume from here you want to get it to somewhere useful like an application server, a database, or a dashboard/presentation application managed somewhere? The point is that as the Pi is on 'the net, and the end destination(s) beyond TTN is on 'the net, bypass the middle man, avoid complications or putting undue load on the TTN Server - leaving it to deal with handling LoRaWAN vs direct traffic and just send it straight through to the end point!

Yes, got that, fully understood, but why? The only thing that TTN does is receive chunks of encrypted data from the devices it manages some elements of and passes that data on to your endpoint / backend / database.

So as it is rather hard to do what you want and isn’t “off the shelf”, why not bypass TTN and just send it directly to your endpoint / backend / database.

If there is something in TTN that you perceive provides some benefit, please explain so we can tell you how you can live without it, given the complexity of writing the stack to inject in to the packet forwarder just to send temperature data that will eventually end up in your endpoint / backend / database …

Sorry…that reply was wrong. English is not my native language so it’s difficult to write what I want to. At this time I dont have any devices (there will be in the future), I only have an I2C temperature sensor in the gateway and I want to send that data to TTN to download anywhere I want. Late it will be attached with the devices data.

Yes, I think we understood what you were saying in the context of a sensor inside the gw itself rather than being on a remote node which broadcasts and then is heard by the GW. Our point still stands. As the GW, of necessity, is connected directly on the internet, it does not need, and indeed is undesirable to have a mechanism to encasulate the temp readings into a LW structure to give to the GW to then pass through its Packet Forwarder to the TTN LNS and onwards. Instead you simply use the Pi to read the I2C sensor directly and send the read value over IP directly to the server hosting your database or presentation service. It never touches the TTN provided services and has no need to…

When you finally do get some actual LW sensors that you deploy remotely from the GW the GW will hear them broadcasting LW based messages when in range and it will then act in the usual manner capturing those RF modulated symbols, constructing packets, checking for CRC errors etc. and then acting as a form of RF to IP media convertor it will send the (at that point) encrypted payload along with all of the metadata associated with the received signal then appended to your basic payload (encrypted sensor data + device identification related info) over to the TTN LNS. This will be a logically parallel excersise along with sending your raw directly injected I2C readings to their end destination.

The point is that you don’t download data from TTN - it passes it along - you have to have your own database to send your data that TTN sends to you to store it.

And because you have to have your own database, you can send that information from the gateway directly to your database.

But overall, if you have a gateway and no devices, you haven’t learnt about LoRaWAN yet - buy a couple of devices and see what happens when they start transmitting uplinks and you will understand better.

Thank you Descartes and Jeff for your help, now I have some clues on how to solve what Im trying to do.