Ultrasonic wireless

Hello All:
New member here. I’ve been designing a system to measure water level in our well at our cottage and send it to our cottage around 300m away. The problem is that there’s a lot of brush and trees between the well and the cabin. I first of all designed a system using NRF24L01. worked in the spring when there was no foilage, but not in the summer. I then designed (with help from some folks at arduino) a system using aLoRa Ra-02 units. They work well!
I then received a wifi LoRa 433 OLED unit and decided to try and integrate it into the system. That’s where I’m stuck. Using one of the provded simple receive sketches I can receive packets, I just can’t seem to figure out the right parsing to get it to print the packet info. Heres the program I’m trying to use to Receive data on the OLED unit;
</
#include <U8x8lib.h>
#include <LoRa.h>

String receivedText;
String receivedRssi;

// WIFI_LoRa_32 ports
// GPIO5 – SX1278’s SCK
// GPIO19 – SX1278’s MISO
// GPIO27 – SX1278’s MOSI
// GPIO18 – SX1278’s CS
// GPIO14 – SX1278’s RESET
// GPIO26 – SX1278’s IRQ(Interrupt Request)

#define SS 18
#define RST 14
#define DI0 26
#define BAND 433E6

// the OLED used
U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=/ 15, / data=/ 4, / reset=*/ 16);

void setup() {

SPI.begin(5, 19, 27, 18);
LoRa.setPins(SS, RST, DI0);

Serial.begin(115200);
while (!Serial); //if just the the basic function, must connect to a computer
delay(1000);

u8x8.begin();
u8x8.setFont(u8x8_font_chroma48medium8_r);

Serial.println(“LoRa depth”);
u8x8.drawString(0, 1, “LoRa Receiver”);

if (!LoRa.begin(BAND)) {
Serial.println(“Starting LoRa failed!”);
u8x8.drawString(0, 1, “Starting LoRa failed!”);
while (1);
}
}

void loop() {

// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print(“Received packet '”);
u8x8.drawString(0, 4, “PacketID”);

// read packet
while (LoRa.available()) {
  receivedText = (char)LoRa.read();
  Serial.print(receivedText);
  char currentid[64];
  receivedText.toCharArray(currentid, 64);
  u8x8.drawString(9, 4, currentid);
}

// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
u8x8.drawString(0, 5, "PacketRS");
receivedRssi = LoRa.packetRssi();
char currentrs[64];
receivedRssi.toCharArray(currentrs, 64);
u8x8.drawString(9, 5, currentrs);

}

}

/>

The sending program is:
</
// ask_transmitter.pde
// -- mode: C++ --
// Simple example of how to use RadioHead to transmit messages
// with a simple ASK transmitter in a very simple way.
// Implements a simplex (one-way) transmitter with an TX-C1 module

#include<LoRa.h>
//#include <SPI.h> // Not actually used but needed to compile

#include <NewPing.h>

#define TRIGGER_PIN 7 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 8 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

void setup(){
Serial.begin(9600);
while (!Serial);

Serial.println(“LoRa Receiver”);

if (!LoRa.begin(433E6)) {
Serial.println(“Starting LoRa failed!”);
while (1);

// LoRa.setTxPower(20);
}
//LoRa.setSpreadingFactor(10);
//LoRa.setSignalBandwidth(62.5E3);
//LoRa.crc();
}

void loop(){

delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
Serial.print(“Distance is: “);
Serial.print(sonar.ping_in()); // Send ping, get distance in cm and print result (0 = outside set distance range)
Serial.println(” inches”);
LoRa.beginPacket(); ///send packet
LoRa.print(sonar.ping_in());
LoRa.endPacket();
delay(200);
}
/>

As I said the OLED seems to know it’s getting packets… just need to know how to print them out:
Can anyone offer some suggestions?
Jeff

Can you try our examples?

We already made some examples with LoRa and OLED, and already assembled an OLED library, so you don’t need U8G2 lib anymore.

Hi:
I’ve tried the Heltec receive sketch, but it doesn’t seem to be receiving data from the above sketch. All I get is Wait for incoming data.
Any ideas how to modify this sketch to receive and display the packet being sent?
Jeff

Just try to download the two examples in red cycle, use two boards.

it will work well.