Outils pour utilisateurs

Outils du site


start:arduino:esp32b:lora

Esp32 - Lora

ESP32 (32 bits, 2 cores, 180 MHz)

  1. -Connectivity
    1. -WiFi
    2. -BLE
    3. -LoRa (SX1276) 433MHz, 868MHz, 915MHz

Brochage ESP32 Lora

Liens web

Configuration

Programmes

Carte1 (envoi)

Ouvrer et televerser le programme : Examples > LoRaLibrary > OLED_LoRa_Sender

Carte 2 (Reception)

Ouvrer et televerser le programme : Examples > LoRaLibrary > OLED_LoRa__Receiver

Ajouter la configuration LoRaWAN

Ajoutez les déclarations suivantes dans les 2 programmes.

Lorawanconf.ino
 
...
 
// LoRa API https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/blob/master/esp32/libraries/LoRa/API.md
 
// LoRaWAN Parameters
#define BAND    868100000  //you can set band here directly,e.g. 868E6,915E6
#define PABOOST false
#define TXPOWER 14
#define SPREADING_FACTOR 12
#define BANDWIDTH 125000
#define CODING_RATE 5
#define PREAMBLE_LENGTH 8
#define SYNC_WORD 0x34
 
void configForLoRaWAN()
{
  LoRa.setTxPower(TXPOWER);
  LoRa.setSpreadingFactor(SPREADING_FACTOR);
  LoRa.setSignalBandwidth(BANDWIDTH);
  LoRa.setCodingRate4(CODING_RATE);
  LoRa.setPreambleLength(PREAMBLE_LENGTH);
  LoRa.setSyncWord(SYNC_WORD);
  LoRa.crc();
}
 
String loraCfg = "Cfg:";
void  displayLoRaConfig(int x, int y){
  loraCfg = 
            "fr " + String(BAND/1000000, DEC)
          + " sf" + String(SPREADING_FACTOR, DEC)
          + " bw" + String(BANDWIDTH/1000, DEC)
          + " cr" + String(CODING_RATE, DEC) + "/4";
  display.drawString(x, y, loraCfg);
  loraCfg =        
          + " pr" + String(PREAMBLE_LENGTH, DEC)
          + " pw" + String(TXPOWER, DEC)
          + " sw" + String(SYNC_WORD, HEX)
          ;
  display.drawString(x, y+10, loraCfg);
}
 
...
 
  // should be done before LoRa.begin
  configForLoRaWAN();
 
  if (!LoRa.begin(BAND,PABOOST)) {
    display.drawString(0, 0, "Starting LoRa failed!");
    display.display();
    while (1);
  }
  displayLoRaConfig(0,20);
  display.drawString(0, 0, "LoRa Initial success!");
 
...
 
  display.display();
...
/home/chanteri/www/fablab37110/data/pages/start/arduino/esp32b/lora.txt · Dernière modification : 2023/01/27 16:08 de 127.0.0.1