The Heltec LoRa V2 is a versatile and powerful development board designed for long-range wireless communication applications. It integrates an OLED display and a LoRa transceiver, making it ideal for IoT projects and remote sensor networks. The board is compatible with the Arduino IDE, which allows for easy programming and deployment of custom applications.
Pin Number | Function | Description |
---|---|---|
1 | GND | Ground |
2 | 3V3 | 3.3V power supply |
3 | 5V | 5V power supply (USB or VIN) |
4 | VIN | Input voltage for battery or external power |
5 | RST | Reset pin |
6 | 3V3 | 3.3V output from the onboard voltage regulator |
... | ... | ... |
21 | SDA (OLED) | I2C Data for OLED display |
22 | SCL (OLED) | I2C Clock for OLED display |
23 | MISO (LoRa) | SPI MISO for LoRa transceiver |
24 | MOSI (LoRa) | SPI MOSI for LoRa transceiver |
25 | SCK (LoRa) | SPI Clock for LoRa transceiver |
26 | NSS (LoRa) | SPI Chip Select for LoRa transceiver |
27 | DIO0 (LoRa) | LoRa DIO0 interrupt pin |
28 | DIO1 (LoRa) | LoRa DIO1 interrupt pin |
... | ... | ... |
Note: This is a partial list. Refer to the Heltec LoRa V2 datasheet for the complete pinout.
Q: Can I use the Heltec LoRa V2 with a battery? A: Yes, you can power the board with a battery connected to the VIN pin.
Q: What is the range of the LoRa communication? A: The range can vary from a few kilometers in urban areas to over 10 kilometers in open rural areas.
Q: How do I program the OLED display?
A: You can use libraries such as U8g2
or Adafruit_SSD1306
for Arduino to control the OLED display.
#include <SPI.h>
#include <LoRa.h>
// Define the pins used by the LoRa transceiver module
#define SCK 5 // GPIO5 -- SX1278's SCK
#define MISO 19 // GPIO19 -- SX1278's MISO
#define MOSI 27 // GPIO27 -- SX1278's MOSI
#define SS 18 // GPIO18 -- SX1278's CS
#define RST 14 // GPIO14 -- SX1278's RESET
#define DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request)
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("LoRa Sender");
// Setup LoRa transceiver module with the pins
LoRa.setPins(SS, RST, DI0);
if (!LoRa.begin(915E6)) { // Initialize LoRa module to 915MHz
Serial.println("Starting LoRa failed!");
while (1);
}
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
// Send LoRa packet
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(5000);
}
Note: This example assumes the use of the 915 MHz frequency band. Make sure to select the correct frequency according to your regional standards.
Remember to wrap your code comments to limit line length to 80 characters, as shown in the example above.