Ping Pong test between CubeCell dev board and WIFI LoRa 32 (V2)

I’d like to do a ping pong test between the CubeCell dev board and the WIFI LoRa 32 (V2). Anyone have any pointers to communicate the two directly?

Thanks

Hi, wandering the same. Is there a simply LORA (no LORAWAN) ?, libray maybe RadioLib?
If you have any clue, please tell us.

Thanks

Christian

Yes, +1. This was essentially what I was asking here, but there didn’t seem to be an answer…

I am trying to do this exact same thing, also without success so far. I discovered that the default LoRa configurations for the WiFi LoRa32v2 are the same than in the pingpong example of the CubeCell. I’m running both on 868MHz and the other configs are:

From pingpong.ino:

#define LORA_BANDWIDTH                              0         // [0: 125 kHz,
                                                              //  1: 250 kHz,
                                                              //  2: 500 kHz,
                                                              //  3: Reserved]
#define LORA_SPREADING_FACTOR                       7         // [SF7..SF12]
#define LORA_CODINGRATE                             1         // [1: 4/5,
                                                              //  2: 4/6,
                                                              //  3: 4/7,
                                                              //  4: 4/8]
#define LORA_PREAMBLE_LENGTH                        8  

You can see from this README that the WiFi32v2 has these defaults.

I don’t know what I’m missing?

The issue is related to the default syncword used by the two boards. The new cubecell boards use a 16 bit syncword as opposed to a 8 bit sync word. At least that is what I deduced.

On a V1 Heltec Lora board , these settings worked for me (using default Cubecell settings on the other board).

  LoRa.setSpreadingFactor(7);
  LoRa.setSignalBandwidth(125E3);
  LoRa.setCodingRate4(5);
  LoRa.setPreambleLength(8);
  LoRa.disableCrc();
  LoRa.setSyncWord(0x12);

I haven’t tried to get a V2 talking to a Cubecell board yet, but this worked perfectly for a V1.

Some technical guidance on setting syncword on the cubecell boards would be appreciated if anybody from Heltec is reading this.

2 Likes

This worked for me on a V2 board.

2 Likes

If you figure out precisely how syncword works on the cubecell boards, do let me know!

While my workaround works, would be good to understand the issue fully.

Could someone provide the essentials of the relevant CubeCell script? I am particularly interested in the relevant libraries (and associated function calls) that have been used.

Perhaps more specifically, if I have a WiFi LoRa 32 (or appropriate ESP32/rfm95) board configured according to this tutorial, what would be the corresponding CubeCell script(s)?

If you head over to Github I have raised a issue relating to the lack of simple example sketches for the cube cells. I’m not sure that Heltec realise how many rookies/noobs use their kit.

If you have time, it would be great if you could go and comment on the issue I have raised to make sure they know that some of us need some help…

I did just post this same query on GitHub, but what libraries and function calls are you using in your CubeCell sketch?

My code’s nothing to be proud of either, but anything helps… Here’s the essence of what I use to communicate between WiFi LoRa 32 and/or Wireless Stick Lite boards (sender side):

#include "LoRa.h"

// 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 917E6

bool PABOOST = true;

<other stuff>

LoRa.setPins(SS,RST,DI0);
if (!LoRa.begin(BAND, PABOOST)) {
  while (true);
}

<other stuff>

LoRa.beginPacket();             // start packet
int totalByteCount = LGO_HeaderSize + outgoingPacket.content.byteCount;
for (int i = 0; i < totalByteCount; i++) {
  LoRa.write(outgoingPacket.packetByte[i]);
}
LoRa.endPacket();             // Finish packet and send it

Notwithstanding the above comments about the SyncWord and other parameters, what I would like to know is the equivalent LoRa library and function calls for the CubeCell to those used above for the WiFi LoRa and Wireless Stick boards. The above code will not compile if I have CubeCell selected as the board in the Arduino IDE (‘class LoRaClass’ has no member named ‘Init’, which suggests that I need to be using something other than ‘regular’ LoRa.h for the CubeCell)—it compiles just fine for the WiFi LoRa and Wireless Stick boards.

It may be the way I have the [libraries in the] IDE configured, bit it’s a bit hard to tell if I don’t even know the libraries that I should be using. And if it is just the IDE configuration that I need to fix, what are the pins that I need to specify in the LoRa.setPins() function call?

OK, sorry, on closer inspection I see that the ping pong example is only using LoRa (not LoRaWAN as I had assumed on my original cursory inspection), so I’ll go play with that and see where I get. I was looking for something as simple as the current [WiFi LoRa] LoRa configuration, but it seems we’re not quite there yet with the CubeCell.

Thanks for the comments. I think I at least now have a direction to follow.

For anyone who might still be interested. here’s some code that I think originally came from Robot Zero One (but similar to any number of OLED_LoRa_Sender/Receiver sketches out there), modified a little to interact with the CubeCell pingpong sketch using the settings provided above by @stonehedge. It doesn’t actually play ping pong, the WiFi LoRa 32 board just ACKs the packets sent by the CubeCell. Nonetheless, it should provide the configuration details required to get the two communicating.

#include <Wire.h>  // Only needed for Arduino 1.6.5 and earlier
#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`

#include <SPI.h>
#include <LoRa.h>

SSD1306 display(0x3c, 4, 15);

//OLED pins to ESP32 GPIOs via this connection:
//OLED_SDA — GPIO4
//OLED_SCL — GPIO15
//OLED_RST — GPIO16

// 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

// LoRa Settings 
#define BAND 915E6
#define SpreadingFactor 7
#define SignalBandwidth 125E3
#define PreambleLength 8
#define CodingRateDenominator 5
#define SyncWord 0x12

bool PABOOST = true;

bool statusCheck = false;
int availableBytes = 0;

String data = "";

void setup() {
  pinMode(16,OUTPUT);
  digitalWrite(16, LOW); // set GPIO16 low to reset OLED
  delay(50);
  digitalWrite(16, HIGH);

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

  display.init();
//  display.flipScreenVertically();
  display.setFont(ArialMT_Plain_10);
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.drawString(5,5,"LoRa Receiver");
  display.display();

  SPI.begin(5,19,27,18);
  LoRa.setPins(SS,RST,DI0);
  Serial.println("[setup] LoRa Receiver");
  if (!LoRa.begin(BAND, PABOOST)) {
    display.drawString(5,25,"[setup] Starting LoRa failed!");
    while (1);
  }
  
  Serial.print("[setup] LoRa Frequency: ");
  Serial.println(BAND);
  
  LoRa.setSpreadingFactor(SpreadingFactor);
  Serial.print("LoRa Spreading Factor: ");
  Serial.println(SpreadingFactor);
 
  LoRa.setSignalBandwidth(SignalBandwidth);
  Serial.print("LoRa Signal Bandwidth: ");
  Serial.println(SignalBandwidth);

  LoRa.setCodingRate4(CodingRateDenominator);
  Serial.print("LoRa Coding Rate Denominator: ");
  Serial.println(CodingRateDenominator);

  LoRa.setPreambleLength(PreambleLength);
  Serial.print("LoRa Preamble Length: ");
  Serial.println(PreambleLength);

  LoRa.setSyncWord(SyncWord);
  Serial.print("LoRa Syncword: ");
  Serial.println(SyncWord);

  LoRa.disableCrc();
  Serial.println("CRC Disabled");
    
  Serial.println("[setup] LoRa Initialisation OK");
  Serial.println("");
  display.drawString(5,25,"LoRa Initialisation OK");
  display.display();

}

void loop() {
  // try to parse packet
  if (LoRa.parsePacket()) {
    // received a packet
    Serial.print("[loop] Received packet: ");
    
    display.clear();
    display.setFont(ArialMT_Plain_16);
    display.drawString(3, 0, "Received packet ");
    display.display();
    
    // read packet
    while (LoRa.available()) {
      data = LoRa.readString();
      Serial.print(data);
      display.drawString(20,22, data);
      display.display();
    }
    
    // print RSSI of packet
    Serial.print(" with RSSI ");
    Serial.print(LoRa.packetRssi());
    Serial.print(" and SNR ");
    Serial.println(LoRa.packetSnr());
    Serial.println("");
    
    display.drawString(0, 45, (String)LoRa.packetRssi() + "dB (" + (String)LoRa.packetSnr() +"dB)");
    display.display();

//  Acknowledger receipt
    LoRa.beginPacket();
    LoRa.print("ACK");
    LoRa.endPacket();
    
  }
}

The only change to the stock version of the CubeCell pingpong sketch was the setting of the frequency that I’m using:

#define RF_FREQUENCY                                915000000 // Hz