Dependancies
🌳 An outdoor LoRa-GPS tracker with an E-Ink display 🔑
Display simple string on E-Ink with increasing counter
Dependancies
Check the E-Ink display module for the version number. Here, version 1 is used and the number is not marked on the module.
The 4 non-SPI pins are defined in epdif.h
file:
#define RST_PIN 8
#define DC_PIN 9
#define CS_PIN 10
#define BUSY_PIN 7
The SPI pins for Arduino Zero / SAMD21G are defined as following:
SAMD21G Pin | I/O Pin | SERCOM-ALT | Name |
---|---|---|---|
19 |
PB10 |
SERCOM4/PAD[2] |
COPI |
20 |
PB11 |
SERCOM4/PAD[3] |
SCK |
Schematic label | Arduino Zero pin name | SAMD21G pin name |
---|---|---|
EINK_BUSY | D7 | PA21 |
EINK_RST | D8 | PA06 |
EINK_DC | D9 | PA07 |
EINK_CS | D10 | PA18 |
COPI | ICSP_COPI | PB10 |
CLK | ICSP_SCK | PB11 |
CIPO | ICSP_CIPO | PA12 |
ls -al /dev/cu.usbmodem
and arduino-cli board list
. Run make
to compile and upload the code to the board.
#include <SPI.h>
#include "epd1in54.h"
#include "epdpaint.h"
#define COLORED 0
#define UNCOLORED 1
unsigned char image[1024];
Paint paint(image, 0, 0);
Epd epd;
int count = 0;
char count_string[] = {'0', '0', '0', '\0'};
void setup() {
SerialUSB.begin(9600);
SerialUSB.print("e-Paper init ");
if (epd.Init(lut_full_update) != 0) {
SerialUSB.print("e-Paper init failed");
return;
}
}
void loop() {
sprintf(count_string, "%d", ++count);
SerialUSB.println(count_string);
epd.ClearFrameMemory(0xFF); // bit set = white, bit reset = black
epd.DisplayFrame();
epd.ClearFrameMemory(0xFF); // bit set = white, bit reset = black
epd.DisplayFrame();
paint.SetWidth(50);
paint.SetHeight(120);
paint.SetRotate(ROTATE_270);
paint.Clear(COLORED);
paint.DrawStringAt(10, 4, "hello", &Font24, UNCOLORED);
paint.DrawStringAt(10, 30, count_string, &Font24, UNCOLORED);
epd.SetFrameMemory(paint.GetImage(),
80, 72, paint.GetWidth(), paint.GetHeight());
epd.DisplayFrame();
delay(1000);
epd.Sleep();
}
BOARD?=hutscape:samd:oak
PORT := $(shell ls /dev/cu.usbmodem*)
BUILD=build
.PHONY: default lint all flash clean
default: all flash clean
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