ESP32-LoRa Heltec: Difference between revisions

From air
Jump to navigation Jump to search
No edit summary
m (Donsez moved page ESP32-LoRa to ESP32-LoRa Heltec)
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Media:Esp32-LoRa.jpg|400px|center|ESP32 LoRa]]
[[Image:Esp32-LoRa.jpg|400px|center|ESP32 LoRa]]


ESP32 (32 bits, 2 cores, 180 MHz)
* Connectivity
** WiFi
** BLE
** LoRa (SX1276) 433MHz, 868MHz, 915MHz


Links
* [https://hackaday.io/project/26991-esp32-board-wifi-lora-32 ESP32 WiFi LoRa]
* [https://hackaday.io/project/26991-esp32-board-wifi-lora-32 ESP32 WiFi LoRa]
* [https://cdn.hackaday.io/files/269911154782944/Heltec_WIFI-LoRa-32_DiagramPinout.jpg Diagram Pinout]
* [https://cdn.hackaday.io/files/269911154782944/Heltec_WIFI-LoRa-32_DiagramPinout.jpg Diagram Pinout]
Line 7: Line 13:


=Installation=
=Installation=

* [https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/blob/master/InstallGuide/mac.md On MacOS]
* [https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/blob/master/InstallGuide/mac.md On MacOS]

<pre>
mkdir -p ~/Documents/Arduino/hardware
cd ~/Documents/Arduino/hardware
git clone https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series.git heltec
cd heltec/esp32
git submodule update --init --recursive
cd tools
python get.py
</pre>

=Configuration=
[[Image:Esp32-LoRa-config.png|200px|right|thumb|ESP32 LoRa Config]]

=Programs=
==Board 1 (Sender)==
Open and load the schetch : Examples > LoRaLibrary > OLED_LoRa_Sender

==Board 2 (Receiver)==
Open and load the schetch : Examples > LoRaLibrary > OLED_LoRa_Receiver

==Add LoRaWAN configuration==
Add the following statements into the 2 schetches.

<pre>

...

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

</pre>

==Simple LoRaWAN Sender (in ABP mode / No ADR)==
<pre>
Under construction
</pre>

==Install LMIC==
* https://github.com/berkutta/esp32_lmic
* https://github.com/espressif/esp-idf
* https://github.com/matthijskooijman/arduino-lmic

=Misc=
* https://github.com/unprovable/LoRaChat
* https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic/10247/18

Latest revision as of 18:57, 17 March 2019

ESP32 LoRa

ESP32 (32 bits, 2 cores, 180 MHz)

  • Connectivity
    • WiFi
    • BLE
    • LoRa (SX1276) 433MHz, 868MHz, 915MHz

Links

Installation

mkdir -p ~/Documents/Arduino/hardware
cd ~/Documents/Arduino/hardware
git clone https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series.git heltec
cd heltec/esp32
git submodule update --init --recursive
cd tools
python get.py

Configuration

ESP32 LoRa Config

Programs

Board 1 (Sender)

Open and load the schetch : Examples > LoRaLibrary > OLED_LoRa_Sender

Board 2 (Receiver)

Open and load the schetch : Examples > LoRaLibrary > OLED_LoRa_Receiver

Add LoRaWAN configuration

Add the following statements into the 2 schetches.


...

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

Simple LoRaWAN Sender (in ABP mode / No ADR)

Under construction

Install LMIC

Misc