Receiving RAK7249 LoRaServer MQTT feed with Arduino

What is the purpose of including LMiC in the sketch.

What device is sending the DHT22 data?

If you coded the device payload format, then you just reverse the process on the Arduino when you an incoming MQTT uplink message.

Hi Nick. Thank you for your reply. I mucked-up presenting the code in my post. However you will see in the final piece that I sent -

Unit16_t payloadTemp = LMIC_f2sflt16(rawHumid) * 100

You need the LMIC library for this.

I am using an Arduino UNO + Dragino LoRa shield + DHT22 to do the sending. That part is working very well. The code comes from the RAK4260 GitHub page.

I think my problem is not using compatible data types.

Regards

Most likely. Mostly we’d not transmit a float as it gets messy turning the byte array back in to a float in a variety of languages. And loading LMiC for just that function is a proverbial sledgehammer to crack a nut.

When you take a reading that is a float, multiple by 10’s for the precision you need and send that. Then divide appropriately at the other end.

So humidity reading of 45.2% gets x 10 and sent as an integer of 452 - very easy to decode in JavaScript, PHP, Python as well as C, and you just divide by 10 to get back to the original value.

The RAK4260 doesn’t do any form of Arduino as it’s all Microchip with ASF and MLS - which repro are you thinking of?

Not sure which which example you are thinking of - bit confused as that’s not a RAK4260 repro, although someone has pointed out that the 4260 can do a sort of LoRaWAN on Arduino using Bestwan.

I’m using this one -

I am using an Arduino Mega + Dragino LoRa shield. I have had a lot of difficulty getting a node to work on AU915, however, recently I have been successful. In the meantime, I discovered this RAK/Demo code. I trust anything RAK, so set it up and it worked first time. I have since used this code as the basis for other sensor applications. Making great progress.

As I have been discussing, I’m using an Arduino Mega + Arduino Ethernet Shield v2 for the MQTT client connected to a RAK7249 gateway. I’v managed to get that going perfectly. The problem there was the size of the buffer.

Now I’m trying to decode the payload and have pretty much got that going as well.

I really appreciate all your advice and help. Regards.

Can I use ArduinoJson.h to decode the payload in my Ardunio MQTT Client?

Yes, I had the same issue whether to directly interface with the 7249 MQTT-bridge or whether to go through the MQTT.fx RPi MQTT and then to the Arduino application. But then I got assistance from Reliance electric motor and it was really helpful for me. Hope it can too be useful for you.
Thanks.

flt16 is a portable, compact floating point format well suited to LoRaWan for uses where the magnitude of numbers can vary to a degree that challenges integer/fixed point, hence why it’s in MCCI LMiC.

You are right however that it’s probably not useful for humidity. Especially given how inexact humidity sensors typically are, a single byte with half percent is probably fine.

A post was merged into an existing topic: Help to send data to thingspeak using MQTT and Arduino+Draginoshield v 1.4 through RAK 7249