Oak

V1.0

🌳 Measure outdoor distance between 2 keychain holders 🔑

power LiPo
wireless LoRa
sensor GPS, E-Ink
mcu SAMD21E
status ongoing

Features

  • Get GPS location every 60 seconds
  • Display the GPS data on e-ink
  • Ping the GPS location to the other node device via LoRa every 60 seconds
  • Display the GPS data on e-ink for self and other node
  • Display the calculated distance between 2 GPS locations

Firmware

Download code
#define DEBUG

#include "DebugUtils.h"

#include "src/lora/lora.h"
#include "src/eink/eink.h"
#include "src/gps/gps.h"

long lastSendTime = 0;
int interval = 2000;

int count = 0;
char count_string[] = {'0', '0', '0','\0'};

void setup() {
  #ifdef DEBUG
  SerialUSB.begin(9600);
  while (!SerialUSB) { }
  #endif

  DEBUG_TITLE("Start Oak: With GPS, LoRa and E-ink...");

  if(!initLora()) {
    DEBUG_PRINT("LoRa init failed. Check your connections.");
  }

  // initGPS();
}

void loop() {
  if (millis() - lastSendTime > interval) {
    // count
    sprintf(count_string, "%d", ++count);
    DEBUG_PRINT(count_string);
    String sensorData = String(count);

    // E-ink
    if (!initEink()) {
      DEBUG_TITLE("E-ink initialization failed");
    }

    clearEink();
    setEink();
    displayEink(0, 50, count_string);

    // LoRa send
    sendMessage(sensorData);

    lastSendTime = millis();
    interval = random(2000) + 1000;
  }

  // LoRa receive
  receiveMessage();
}

Makefile

BOARD?=arduino:samd:mzero_bl
PORT := $(shell ls /dev/cu.usbmodem*)

.PHONY: default lint all flash clean

default: all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

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

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

clean:
	rm -r build

Serial console

Firmware serial console