Table des matières

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

ESP32 WiFi LoRa

Diagram Pinout

Github

Esp32-Lora EN

Exemples : Lora et LoraWan ESP32 FR

ESP32 LORA TTGO OLED

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();
...