Help with LoRa 9x programming

Hey I am having a lot of problems with programming my Adafruit RFM 9x LoRa device. I am tryin to get sensor data sent over the connection of my LoRa:s but have not had any success doing that.

The problem is that i don´t quite understand the code behind the send function and am not able to put the codes together from the LoRa and my sensors. My one sensor i am trying to get working is an Adafruit 3115A2. The sensor is connected to the Arduino threw I2C pins and the LoRa is connected with the recommended wiring.

I get them talking to each other until adding the code for the sensor. Any help is highly appreciated!

Here is the code for the LoRa i´ve tried:

#include <SPI.h>


#include <RH_RF95.h>
#define RFM95_CS 10
#define RFM95_RST 9
#define RFM95_INT 2
#define RF95_FREQ 433.0
RH_RF95 rf95(RFM95_CS, RFM95_INT);


void setup() 


{
 pinMode(RFM95_RST, OUTPUT);
 digitalWrite(RFM95_RST, HIGH);

 while (!Serial);
 Serial.begin(9600);

 delay(100);


 Serial.println("Arduino LoRa TX Test!");


 // manual reset
 digitalWrite(RFM95_RST, LOW);

 delay(10);

 digitalWrite(RFM95_RST, HIGH);

 delay(10);


 while (!rf95.init()) {

   Serial.println("LoRa radio init failed");

   while (1);

 }

 Serial.println("LoRa radio init OK!");

 if (!rf95.setFrequency(RF95_FREQ)) {

   Serial.println("setFrequency failed");

  while (1);

 }

 Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);
 rf95.setTxPower(23, false);

}

int16_t packetnum = 0;

void loop()

{
 Serial.println("send #");
 // Send a message to rf95_server

 char radiopacket[20] = "Hello World #      ";
 itoa(packetnum++, radiopacket+13, 10);
 radiopacket[19] = 0;

 rf95.send((uint8_t *)radiopacket, 20);
 rf95.waitPacketSent();

 uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
 uint8_t len = sizeof(buf);
delay (1000);

}

And here is the code for MPL3115A2 sensor:

#include <Wire.h>
#include <Adafruit_MPL3115A2.h>

// Power by connecting Vin to 3-5V, GND to GND
// Uses I2C - connect SCL to the SCL pin, SDA to SDA pin
// See the Wire tutorial for pinouts for each Arduino
// http://arduino.cc/en/reference/wire
Adafruit_MPL3115A2 baro = Adafruit_MPL3115A2();

void setup() {
 Serial.begin(9600);
 Serial.println("Adafruit_MPL3115A2 test!");
}

void loop() {
 if (! baro.begin()) {
   Serial.println("Couldnt find sensor");
   return;
 }
 
 float pascals = baro.getPressure();
 Serial.print(pascals/3377); Serial.println(" Inches (Hg)");

 float altm = baro.getAltitude();
 Serial.print(altm); Serial.println(" meters");

 float tempC = baro.getTemperature();
 Serial.print(tempC); Serial.println("*C");

 delay(250);
}

Thanks for using code tags on your first post!

There is not much you need to understand about the send() function. It will send whatever information is in the "radiopacket" character array (buffer).

 rf95.send((uint8_t *)radiopacket, 20);

So, all you need to do is collect the data from the sensor, put it in that buffer (as ASCII characters or binary data) and send it as in the above line.

What have you tried?

jremington:
Thanks for using code tags on your first post!

There is not much you need to understand about the send() function. It will send whatever information is in the "radiopacket" character array (buffer).

 rf95.send((uint8_t *)radiopacket, 20);

So, all you need to do is collect the data from the sensor, put it in that buffer (as ASCII characters or binary data) and send it as in the above line.

What have you tried?

Yes i have tried it but im not sure if i have got it right. I tried changing the radiopacket to {2, 3, 4, 5, 6, 7} for testing purposes.

 char radiopacket[20] = {2, 3, 4, 5, 6, 7};
  itoa(packetnum, radiopacket+13, 10);
  radiopacket[19] = 0;

But the thing i recieved was :
Received:
2 3 4 5 6 7 0 0 0 0 0 0 0 31 0 0
0 0 0 0
Got: . <---- Empty

So at the recieving end im not getting any text. Correct me if my array is wrong.

So at the recieving end im not getting any text.

The string you are sending is not text.

This initialization of radiopacket codes for unprintable characters in the first six bytes.

char radiopacket[20] = {2, 3, 4, 5, 6, 7};

Instead, try the following, which will create an ASCII text representation of packetnum, and zero terminate the C-string.

    char radiopacket[10] = {0};
    itoa(packetnum, radiopacket, 10);

Hey sorry for not being able to test the code you posted in a long time. I tried it out but its still not working. all i get is

Received:
30 0 0 0 0 0 0 0 0 0 0 67 0 8E 15 9
9E 0 1 0
Got: 0. <-indicates the packetnumber that is set to 0
RSSI: -95
Sent a reply

So basicly i still havent managed to get it working right (I´m just recieving the packetnumber but nothing else.) and i whould like to get some help with going forward with the code and getting it functioning with the sensors.

This is the code i tried out now

// LoRa 9x_TX

#include <SPI.h>
#include <RH_RF95.h>
#include <Wire.h>
#include <Adafruit_MPL3115A2.h>

#define RFM95_CS 10
#define RFM95_RST 9
#define RFM95_INT 2

// Change to 434.0 or other frequency, must match RX's freq!
#define RF95_FREQ 433.0

// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);


void setup() 
{
   
  pinMode(RFM95_RST, OUTPUT);
  digitalWrite(RFM95_RST, HIGH);

  while (!Serial);
  Serial.begin(9600);
  delay(100);

  Serial.println("Arduino LoRa TX Test!");

  // manual reset
  digitalWrite(RFM95_RST, LOW);
  delay(10);
  digitalWrite(RFM95_RST, HIGH);
  delay(10);

  while (!rf95.init()) {
    Serial.println("LoRa radio init failed");
    while (1);
  }
  Serial.println("LoRa radio init OK!");

  // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
  if (!rf95.setFrequency(RF95_FREQ)) {
    Serial.println("setFrequency failed");
    while (1);
  }
  Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);
  
  
  // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on

  // The default transmitter power is 13dBm, using PA_BOOST.
  // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then 
  // you can set transmitter powers from 5 to 23 dBm:
  rf95.setTxPower(23, false);
}


  
//float pascals = baro.getPressure();
int16_t packetnum = 0;


void loop()
{

  Serial.println("send #");
  // Send a message to rf95_server
  
    char radiopacket[10] = {0};
    itoa(packetnum, radiopacket, 10);
  radiopacket[10] = 0;
  

rf95.send((uint8_t *)radiopacket, 20);

  rf95.waitPacketSent();
  uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);
delay (1000);

}

It is working fine. You sent the ASCII representation for packetnumber 0 and received the correct result. The "30" at the beginning of the following string is the ASCII character for 0.

30 0 0 0 0 0 0 0 0 0 0 67 0 8E 15 9

This is wrong:

rf95.send((uint8_t *)radiopacket, 20);

Replace it with

rf95.send((uint8_t *)radiopacket, strlen(radiopacket)); //for valid character strings

Thank you! Now im recieving

Received:
30
Got: 0
RSSI: -113

But the question is that how do i adapt it to working together with the sensors, and to get sensor-data transferred over the connection?

I prefer to put sensor data into a C struct and send it all at once, in binary. On the RX side, you can do a memcpy() from the RX buffer into a matching struct. That way, if you add / subtract sensors in your setup, you just need to adjust the struct definition. Using a struct also allows you to mix data types (float, uint16_t, etc) depending on what your sensor produces.

Also, if you tell the library how many bytes to send using sizeof() on your struct, then it will automatically be adjusted if you change its definition.

If your sender and receiver are different processor types, you do need to be careful of word size and Endianness. But, that’s easily accommodated once you know what each processor wants.

gfvalvo:
I prefer to put sensor data into a C struct and send it all at once, in binary. On the RX side, you can do a memcpy() from the RX buffer into a matching struct. That way, if you add / subtract sensors in your setup, you just need to adjust the struct definition. Using a struct also allows you to mix data types (float, uint16_t, etc) depending on what your sensor produces.

Also, if you tell the library how many bytes to send using sizeof() on your struct, then it will automatically be adjusted if you change its definition.

If your sender and receiver are different processor types, you do need to be careful of word size and Endianness. But, that’s easily accommodated once you know what each processor wants.

Hello, and thank you for you answer. I am very sorry to say but I'm totally newbie with arrays and structs. So i whould once again need some help with getting the sensor data into structs and how the "memcpy" works. Both LoRas are the same

For example I am using this code for the sensor.

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME680 bme; // I2C
//Adafruit_BME680 bme(BME_CS); // hardware SPI
//Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO,  BME_SCK);

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println(F("BME680 test"));

  if (!bme.begin()) {
    Serial.println("Could not find a valid BME680 sensor, check wiring!");
    while (1);
  }

  // Set up oversampling and filter initialization
  bme.setTemperatureOversampling(BME680_OS_8X);
  bme.setHumidityOversampling(BME680_OS_2X);
  bme.setPressureOversampling(BME680_OS_4X);
  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
  bme.setGasHeater(320, 150); // 320*C for 150 ms
}

void loop() {
  if (! bme.performReading()) {
    Serial.println("Failed to perform reading :(");
    return;
  }
  Serial.print("Temperature = ");
  Serial.print(bme.temperature);
  Serial.println(" *C");

  Serial.print("Pressure = ");
  Serial.print(bme.pressure / 100.0);
  Serial.println(" hPa");

  Serial.print("Humidity = ");
  Serial.print(bme.humidity);
  Serial.println(" %");

  Serial.print("Gas = ");
  Serial.print(bme.gas_resistance / 1000.0);
  Serial.println(" KOhms");

  Serial.print("Approx. Altitude = ");
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");

  Serial.println();
  delay(2000);
}

and this code for the RX side

// Arduino9x_RX
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messaging client (receiver)
// with the RH_RF95 class. RH_RF95 class does not provide for addressing or
// reliability, so you should only use RH_RF95 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example Arduino9x_TX

#include <SPI.h>
#include <RH_RF95.h>

#define RFM95_CS 10
#define RFM95_RST 9
#define RFM95_INT 2


// Change to 434.0 or other frequency, must match RX's freq!
#define RF95_FREQ 433.0

// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);

// Blinky on receipt
#define LED 13

void setup() 
{
  pinMode(LED, OUTPUT);     
  pinMode(RFM95_RST, OUTPUT);
  digitalWrite(RFM95_RST, HIGH);

  while (!Serial);
  Serial.begin(9600);
  delay(100);

  Serial.println("Arduino LoRa RX Test!");
  
  // manual reset
  digitalWrite(RFM95_RST, LOW);
  delay(10);
  digitalWrite(RFM95_RST, HIGH);
  delay(10);

  while (!rf95.init()) {
    Serial.println("LoRa radio init failed");
    while (1);
  }
  Serial.println("LoRa radio init OK!");

  // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
  if (!rf95.setFrequency(RF95_FREQ)) {
    Serial.println("setFrequency failed");
    while (1);
  }
  Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);

  // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on

  // The default transmitter power is 13dBm, using PA_BOOST.
  // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then 
  // you can set transmitter powers from 5 to 23 dBm:
  rf95.setTxPower(23, false);
}

void loop()
{
if (rf95.available())
  {
    // Should be a message for us now
    uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);

    if (rf95.recv(buf, &len))
    {
      digitalWrite(LED, HIGH);
      RH_RF95::printBuffer("Received: ", buf, len);
      Serial.print("Got: ");
      Serial.println((char*)buf);
       Serial.print("RSSI: ");
      Serial.println(rf95.lastRssi(), DEC);

      // Send a reply
      uint8_t data[] = "And hello back to you";
      rf95.send(data, sizeof(data));
      rf95.waitPacketSent();
      Serial.println("Sent a reply");
      digitalWrite(LED, LOW);
    }
    else
    {
      Serial.println("Receive failed");
    }
  }
}

Maybe the attached code for an Adafruit Feather Lora (AKA Lora32u4) with a BME280 & LDR sensor will help.
I use a different Lora library and it works well for me.
The project is battery powered so sleeps most of the time but every 30 minutes sends data over Lora. I pack the data into a JSON style string so the receiver just forwards the payload onto Node-Red where it gets extracted and used. I opted for this format so I don't need to also reprogram my Lora gateway every time I alter the Feather code/sensors.

LoRa_32u4_BME280_1.ino (8.07 KB)

The following code uses the itoa() function to convert the variable "packetnum" into a human-readable ASCII character array (C-string) and sends it to the receiver.

   char radiopacket[10] = {0};
    itoa(packetnum, radiopacket, 10);
    rf95.send((uint8_t *)radiopacket, strlen(radiopacket));

You can do the same for several integer variables, separated by commas, using the snprintf() function. For example:

   char radiopacket[30] = {0}; //make sure this is large enough
    snprintf(radiopacket,sizeof(radiopacket),"%d,%d,%d",pressure, humidity, temperature); //assuming p,h,t are integers
    rf95.send((uint8_t *)radiopacket, strlen(radiopacket));

Riva:
Maybe the attached code for an Adafruit Feather Lora (AKA Lora32u4) with a BME280 & LDR sensor will help.
I use a different Lora library and it works well for me.
The project is battery powered so sleeps most of the time but every 30 minutes sends data over Lora. I pack the data into a JSON style string so the receiver just forwards the payload onto Node-Red where it gets extracted and used. I opted for this format so I don't need to also reprogram my Lora gateway every time I alter the Feather code/sensors.

jremington:
The following code uses the itoa() function to convert the variable "packetnum" into a human-readable ASCII character array (C-string) and sends it to the receiver.

   char radiopacket[10] = {0};

itoa(packetnum, radiopacket, 10);
   rf95.send((uint8_t *)radiopacket, strlen(radiopacket));




You can do the same for several integer variables, separated by commas, using [the snprintf() function](http://www.cplusplus.com/reference/cstdio/snprintf/). For example:



char radiopacket[30] = {0}; //make sure this is large enough
   snprintf(radiopacket,sizeof(radiopacket),"%d,%d,%d",pressure, humidity, temperature); //assuming p,h,t are integers
   rf95.send((uint8_t *)radiopacket, strlen(radiopacket));

Hey i have been trying out this code and this is what i came up with

#include <LoRa.h>
#include <Adafruit_SleepyDog.h>
#include <Adafruit_BME280.h>
#include <Wire.h>
#include <Adafruit_MPL3115A2.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include <RH_RF95.h>



#define RFM95_CS 10
#define RFM95_RST 9
#define RFM95_INT 2
#define RF95_FREQ 433.0
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME680 bme;
RH_RF95 rf95(RFM95_CS, RFM95_INT);

uint8_t pktNumber = 0;
float temperature;
float pressure;
float altitude;
float humidity;

// OCCAL Tuning value. Calculated from expected 30 minutes actually taking about 33.5 minutes
#define ocCAL 900
const uint32_t delayRead = 10UL * 1 * ocCAL;               // Delay time between reads (10 min)
const uint32_t delaySend = 10UL * 1 * ocCAL;               // Delay time between sends (30 Mins)
uint32_t lastReading = delayRead;                           // Time last reading taken (Set to delayRead so reading happens straight away)
uint32_t lastSending = delaySend;                           // Time last send happened (Set to delaySend so sending happens straight away)
uint32_t sudoMillis = 0;




bool BME680Setup()
{
  bool status = bme.begin();
  if (!bme.begin()) {
    Serial.println("Could not find a valid BME680 sensor, check wiring!");
    while (1);
  }
    bme.setTemperatureOversampling(BME680_OS_8X);
  bme.setHumidityOversampling(BME680_OS_2X);
  bme.setPressureOversampling(BME680_OS_4X);
  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
  bme.setGasHeater(320, 150); // 320*C for 150 ms
}



void readBME680()                                           // Get BME280 readings
{
  BME680Setup();
  
  // Start with temperature, as that data is needed for accurate compensation.
  // Reading the temperature updates the compensat ors of the other functions in the background.
  temperature = bme.temperature;

  delay(10);
  
  pressure = bme.pressure / 100.0;

  delay(10);
  
  altitude = bme.readAltitude(SEALEVELPRESSURE_HPA);
  delay(10);
  
  humidity = bme.humidity;
  delay(10);
  
}

void sendResults2(Stream& XXX, bool lora = false)           // Send readings to Stream
{
  if(lora)
  {
    LoRa.beginPacket();
  }
  
  XXX.print("{");
  
  XXX.print("@N@:");
  XXX.print(pktNumber);
  XXX.print(",");
  delay(1);
  
  XXX.print("@T@:");
  XXX.print(temperature, 2);
  XXX.print(",");
  delay(1);
  
  XXX.print("@P@:");
  XXX.print(pressure, 2);
  XXX.print(",");
  delay(1);
  
  XXX.print("@A@:");
  XXX.print(altitude, 2);
  XXX.print(",");
  delay(1);
  
  XXX.print("@H@:");
  XXX.print(humidity, 2);
  XXX.print(",");
  delay(1);
  
  XXX.print("}");
  delay(1);
  
  if(lora)
  {
    LoRa.endPacket();
    delay(1000);                                                             
    pktNumber++;
  }
}

/*
void errLoop()
{
  while(1)
  {
    Watchdog.sleep();
  }
}
*/
void setup() 
{
  
  
  
    
  pinMode(RFM95_RST, OUTPUT);
  digitalWrite(RFM95_RST, HIGH);

  Serial.begin(115200);
//#ifdef DEBUG
    //while (!Serial);                                        //  Wait for Serial Port Connection (Remove in final code)
//  #endif
  delay(10);
  Serial.println("Arduino LoRa TX Test!");
  
//  LoRa.setPins(SS,RST,DI0);
  
  while (!rf95.init()) {
    Serial.println("LoRa radio init failed");
    while (1);
  }
    Serial.println("LoRa radio init OK!");
    
  LoRa.setPreambleLength(20);
  LoRa.enableCrc();

    if (!rf95.setFrequency(RF95_FREQ)) {
    Serial.println("setFrequency failed");
    while (1);
  }
 Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);


  
  BME680Setup();
  
  // Take initial readings to prime the rolling averages
  temperature = bme.readTemperature();
  delay(10);
  pressure = bme.readPressure() / 100.0F;
  delay(10);
  altitude = bme.readAltitude(SEALEVELPRESSURE_HPA);
  delay(10);
  humidity = bme.readHumidity();

  rf95.setTxPower(23, false);
  
//  #ifdef DEBUG
//    sendResults2(Serial);
//  #endif
  
  Serial.println(F("\nInitial OK!"));
  sudoMillis = millis();
}

void loop() 
{
//  #ifdef DEBUG
    uint32_t now = sudoMillis;
    while(sudoMillis - now < 10)
    {
      {
        bme.performReading();   // Do the readings

        
        #ifdef DEBUG
          Serial.print(F("\nForce Sending Values: "));
          sendResults2(Serial);
          Serial.println();
        #endif
        
        sendResults2(LoRa, true);


      }
      delay(10);
      sudoMillis += 10;
    }

  
  if(sudoMillis - lastReading > delayRead)
  {
    #ifdef DEBUG
      Serial.print(F("\nReading Values: "));
    #endif
    lastReading = sudoMillis;
bme.performReading();                                           // Do the readings
    #ifdef DEBUG
      sendResults2(Serial);
    #endif
  }
  
  if(sudoMillis - lastSending > delaySend)                  // Time to send readings via LoRa
  {
    #ifdef DEBUG
      Serial.print(F("\nSending Values: "));
      sendResults2(Serial);
      Serial.println();
    #endif
    lastSending = sudoMillis;
    
    sendResults2(LoRa, true);
    sendResults2(LoRa, true);
    //sendResults2(LoRa, true);
//    LoRa.sleep();                                           // Power down radio
  }
}

But this is not working at all, not even getting the setup done so what is wrong/how should i fix it. And is it possible to send data via LoRas that are not integers, lets say for more accurate sensor readings,/gps cordinates.?

seba_254:
And is it possible to send data via LoRas that are not integers, lets say for more accurate sensor readings,/gps cordinates.?

LoRa devices talke to each other in packets of data and that data is in 8 bit bytes.

You can do with these bytes whatever you want, send bytes, integers, floats or text.

But this is not working at all, not even getting the setup done so what is wrong/how should i fix it.

Who knows how that gigantic mess is supposed to work? It looks to me like you tossed every imaginable bell and whistle into the mix, hoping it would all somehow work.

Go back to the code that worked and work your way up, adding one new detail at a time, and solving one problem at a time.

seba_254:
Hey I am having a lot of problems with programming my Adafruit RFM 9x LoRa device.

Just a suggestion, but since you have paid for an Adafruit device, have you asked them for advice on how to program the devices they sell ?

jremington:
You can do the same for several integer variables, separated by commas, using the snprintf() function. For example:

   char radiopacket[30] = {0}; //make sure this is large enough

snprintf(radiopacket,sizeof(radiopacket),"%d,%d,%d",pressure, humidity, temperature); //assuming p,h,t are integers
    rf95.send((uint8_t *)radiopacket, strlen(radiopacket));

Hey thank you for all your help so far! I have gone back to the code you suggested and guess what i got it working somewhat! I put in the code:

char pressure=15.5; 
char humidity=31;
char temperature=15;

What im receiving now is:

Got: 15,31,1506214?ç˝>oø1-‹ˇÔ˚ˇ˜Kıflˇ}s͈¢øißz™fi3Œuv}fl^1fl˛flúÅ˘˘∂æ/ÙØ.ˇıÎøfl}zßflµfl?OÊZΩW‰.ˇvθéÙ<fl|Øø5ófiÛ«˜áE.áu˘˝“≈è.ø¯Ù˚?Õ◊ˇfiá,;Uúq¨‹Ôv√˜s‹–.¸
∏k˘˜æO}‹.}:N›wöªΩΩìÔ!d˜ ®{˛÷˙_∑ˇ”È,∑”ß◊.w„ˇ›r=._yJì˛„˝Wfi≠˛æÙ˛[Ãˇ˜gˇ˘.Ì∫.uÔˇÿ¨M÷Íı.

The problems are now the big amount of symbols in the end of the 15,31 and 15. And how about then when the readings are not integers. Lets say for example 15.3°C. It didn't work with that code.

This is what the code looks like:

int16_t packetnum = 0;
int pressure=15.5;
int humidity=31.6;
int temperature=18.9;

void loop()
{

  Serial.println("send #");
  // Send a message to rf95_server
  
   char radiopacket[30] = {1000}; //make sure this is large enough
    snprintf(radiopacket,sizeof(radiopacket),"%d,%d,%d",pressure, humidity, temperature); //assuming p,h,t are integers
    rf95.send((uint8_t *)radiopacket, strlen(radiopacket));
  

  rf95.waitPacketSent();
  uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);
delay (1000);

}

The extra characters are printed because you are not properly zero-terminating the received message.

jremington:
The extra characters are printed because you are not properly zero-terminating the received message.

Ok, and what about then when the readings are not integers?

The message consists of ASCII characters, not "integers".

jremington:
The message consists of ASCII characters, not "integers".

Yea but what Im saying that when i declare, lets say pressure to 150.98 i only get 150 in the receiving end.