LoRa TX

Updated on 4 September 2021
dev board Arduino UNO
features LoRa TX SPI
This tutorial is more than 1 year old. If the steps below do not work, then please check the latest versions and the documentations of the individual tools used.

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Pre-requisites

Try these simpler or similar examples:

Code

Download code lora-tx.ino
#include <SPI.h>
#include <LoRa.h>

int counter = 0;

void setup() {
  Serial.begin(9600);
  while (!Serial) {}

  Serial.println("LoRa Sender");

  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1) {}
  }
}

void loop() {
  Serial.print("Sending packet: ");
  Serial.println(counter);

  LoRa.beginPacket();
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;

  delay(5000);
}

Makefile

BOARD?=arduino:avr:uno
PORT?=/dev/cu.usbmodem14101

.PHONY: default lint all flash clean

default: lint all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright,-readability/casting,-runtime/int *.ino

all:
	arduino-cli compile --fqbn $(BOARD) ./

flash:
	arduino-cli upload -p $(PORT) --fqbn $(BOARD) ./

clean:
	rm -f .*.hex
	rm -f .*.elf

Prototype

A photo of the actual setup.

LoRa TX prototype

Schematic

Wire up the hardware accordingly

LoRa TX schematic

Serial console

Serial output from the firmware.

LoRa TX serial console

Description

Transmit from a LoRa point with 433 MHz. Use this with receiving from a LoRa point.

References

Watch