RAKWireless / WisBlock

Quickstart, tutorials and examples for the RAKwireless WisBlock product line.
https://www.rakwireless.com
MIT License
156 stars 117 forks source link

Receive Data #41

Closed Famosi closed 2 years ago

Famosi commented 2 years ago

LoRaWan communications.

How to receive data instead of send? In the examples folder there are examples about how to send data from a device to a server. But how to handle data received from a server? In particular I’m sending data through the helium console “downlink” tool.

beegee-tokyo commented 2 years ago

Hi,

In the LoRaWAN examples you receive the data in the callbacks for RX, e.g. in the LoRaWAN_OTAA_ABP example it is in

void lorawan_rx_handler(lmh_app_data_t *app_data)
{
  Serial.printf("LoRa Packet received on port %d, size:%d, rssi:%d, snr:%d, data:%s\n",
          app_data->port, app_data->buffsize, app_data->rssi, app_data->snr, app_data->buffer);
}

In LoRaWAN are three node classes:

But Class C is not supported by the Helium Console (at least I cannot find how to set it).

So you receive a downlink packet from Helium Console only after the the RAK4631 node has sent an uplink packet. You set the node class in the lmh_init(&g_lora_callbacks, g_lora_param_init, doOTAA, g_CurrentClass, g_CurrentRegion); call. The forth parameter g_CurrentClass sets the node class. Default is Class A. If you want to change to Class C, you have to do on both the node and in the Helium Console

Famosi commented 2 years ago

Hi @beegee-tokyo thank you so much for the fast response! :smile: I will let you know if I manage to set a Class C node on the helium console.

If it's possible I have another question for you. I put it here but let me know if it would be better to open a new Issue.

I'm using this example to implement a GPS Tracker but without using the 3AXIS sensor. Everything works fine but I have two problems:

  1. When I upload a new version of the code to the RAK4631 it takes too much time to localize itself. Sometimes 1 hour, sometimes 3 hours, sometime 6 hours. Is it normal? Can you explain me why it takes so long or how to fix it?
  2. The RAK4632, when localized, send a packet every 20 seconds. However when I move the RAK (e.g driving around the city) the position is updated rarely (like every minute). What i mean is that for 1 minute sends always the same [LAT,LONG] coordinates.

Thanks again for your time. Really appreciate your work!

beegee-tokyo commented 2 years ago

@Famosi

Where are you testing the GPS tracker example code? I am getting a location fix within 12 to 30 seconds when outside of the building. Inside the house I never get a location fix when the device is on my table. Moving it to a (not tinted) window, I can get a location fix within ~40 seconds.

Sending every 20 seconds, when moving is too fast in my opinion.

And last question, how is your GPS antenna located? The antenna has a white sticker on one side. This side should be oriented towards the sky to get a fast location fix.

Famosi commented 2 years ago

I was testing it on my table (indoor).... that's should be the reason! :smiling_face_with_tear: Now outside the window it takes about 1 min. I didn't test it cause I didn't have a 3V battery to move it outside.

I think you can close this issue, hope it helps someone else. Thank you for your time!

beegee-tokyo commented 2 years ago

Will close this now. If you have more questions, you can open a new issue here or (better, because more people can support) open it on our Forum