LoRaWAN arduino

Hello..im absolute begginer to this subject and i have some issues.Im trying to do a lorawan connection from one arduino to a raspberry pi.Arduino have a temperature sensor and send it to print the value to raspberry pi well i have do correclty this communication between them so my problem is that to send packets with lorawan protocoll the packet must be hex string for example "30322E321" and the value of the temp sensor is float for example 24.60 so i convert the float value to ascii string and then to a hex string correclty with this code:

dtostrf( temp, 1, 2, float_str);
  
  // use snprintf() to include the float representation
  snprintf( message, sizeof(message), "%s", float_str);
  //Serial.println( message );

Utils.hex2str((uint8_t*)message, payload_hex, strlen(message));

So my problem is that i cant do the opposite i receive the hex string packet correclty but i cant to convert it to ascii string again to print it

can you help me?Im new to this and im a little confused

If you have a problem with the receiver code, post that.

i cant to convert it to ascii string again to print it

Why not?

So do you know about my problem or i must ask it in new post with that you said?Am i in wrong topic?

Stay with this Thread.

...R

You could post all your code so we know which LoRa library you are using.

Are you sure your using LoRaWAN, there is a differance between that and LoRa itself ?

I use arduPiLoRaWAN.h to raspberry which is the receiver of the packet and Wire.h, arduinoUART.h,arduinoUtils.h,arduinoLoRaWAN.h to arduino which is the sender of the packet.And I do a connection P2P.

I have not used the RN2483 myself, but be aware that although the library may be called LoRaWAN, your not in fact using LoRaWAN itself, that has no concept of P2P connections.

It just hapepns that the RN2483 also supports P2P mode.

So which librarie has a function that can do this?(hex string to asci string)or can i do it manualy?without a librarie and fuctions?

dimitris21:
So which librarie has a function that can do this?(hex string to asci string)or can i do it manualy?without a librarie and fuctions?

I am not aware of a library that will parse the received buffer automatically into a mixture of ASCII HEX and a float sent as text.

So your probably going to need write the code to parse the buffer yourself. How you do that with the RN2483 I dont know.

i have a variable for my situation LoRaWAN._buffer which saved the sending packet from arduino this variable has a hex string value and i want to print it as ascii string.I write in arduino ide so in c language why suppose module RN2483 or libraries for lorawan block my code?If i want to build a fuction which do that converter is possible right?but my problem is that i dont know to do that fuction im absolute begginer :frowning:

@dimitris21, if you really want help then post the complete program you are using and describe in as much detail as possible what happens when you run it. Then tell us what you want it to do that is different.

A few examples of the data that is sent to the Arduino would be very useful and the corresponding data as received by the Arduino.

...R

I did guys thank for your attetion if anyone has the same problem i can share the code i did :slight_smile: :slight_smile:

dimitris21:
I did guys thank for your attetion if anyone has the same problem i can share the code i did :slight_smile: :slight_smile:

I cant work out what you mean by that ?

And so that the thread is useful as a reference to others, post the code so that after you have long gone the 'solution' is known.

here is the function that do my job the hex stirng into ascii string

void hexStrToStr(char *x_hex_string){
  
  char sub_payload[2+1];
  uint8_t x_index=0;

  for(uint8_t i=0; i<(uint8_t)strlen(x_hex_string); i=i+2){
    strncpy(sub_payload, x_hex_string+i, 2);
    sub_payload[2] = '\0';
    x_hex_string[x_index] = (char)strtol(&sub_payload[0], NULL, 16);
    x_index++;
  }
  x_hex_string[x_index] = '\0';
}