Oak

🌳 Outdoor LoRa-GPS tracker with E-Ink display 🔑

power 18650
wireless LoRa,
sensor GPS, E-Ink
mcu SAMD21G18
bom items 82
bom cost USD $78.93
vendors 6
completed July 2022

Transmit LoRa packet

LoRa transmission easy

Transmit LoRa with an increasing integer counter to no destination address


Before starting

Dependancies

Arduino LoRa

Pre-requisites

LoRa Rx

Steps

  1. Plug in the Oak PCB to the computer
  2. (Option A) Ensure the PCB can be detected with ls -al /dev/cu.usbmodem and arduino-cli board list. Run make to compile and upload the code to the board. (Option A) Ensure the PCB can be detected with <code>ls -al /dev/cu.usbmodem</code> and <code>arduino-cli board list</code>. Run <code>make</code> to compile and upload the code to the board.
  3. (Option B) Ensure the board can be detected with Arduino IDE. Compile and upload the code to the board. (Option B) Ensure the board can be detected with Arduino IDE. Compile and upload the code to the board.

Serial console

Serial output from the firmware.

Code

Download code
#include <LoRa.h>
#include <SPI.h>

int counter = 0;
#define LEDPIN 2

#define RADIO_CS_PIN 5        // D5 on Arduino Zero
#define RADIO_DI0_PIN 11      // D11 on Arduino Zero
#define RADIO_RST_PIN 6       // D6 on Arduino Zero
#define LORA_FREQUENCY 915E6  // 915 MHz Antenna and LoRa module

void setup() {
  SerialUSB.begin(9600);

  SerialUSB.println("Starting LoRa transmission...");
  pinMode(LEDPIN, OUTPUT);

  LoRa.setPins(RADIO_CS_PIN, RADIO_RST_PIN, RADIO_DI0_PIN);

  if (!LoRa.begin(LORA_FREQUENCY)) {
    SerialUSB.println("Starting LoRa failed!");
    while (1) {
    }
  }
}

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

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

  counter++;

  delay(2000);

  digitalWrite(LEDPIN, HIGH);
  delay(250);

  digitalWrite(LEDPIN, LOW);
  delay(250);
}

Makefile

BOARD?=hutscape:samd:oak
PORT := $(shell ls /dev/cu.usbmodem*)
BUILD=build

.PHONY: default lint all flash clean

default: lint all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright,-whitespace/line_length,-readability/casting,-readability/todo *.ino

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

flash:
	arduino-cli upload -p $(PORT) --fqbn $(BOARD) --input-dir $(BUILD) --verbose

clean:
	rm -r build

References