Instruction for epaper display development board(EPD) with the spark_ereader library
Introduction
The spark ereader is a library that displays images and text. It's designed to work with MCUs that has small amount of RAM. To display text a font is read from the SD-card and translated to graphics. Images are stored on the sd-card in the so called 'wif' format. The continued example assumes local development. A spark dev compilation folder can be found here.
To debug the setup and wiring the first example tests the SD card only. And then the ereader library is tested. The ereader library demo is run and the application shows images and text from the SD card.
Set up the sd-card:
Connect the Sd card brakeout board:
CS Chip Select A2
DI: MOSI A5
DO: MISO A4
CLK:SCK A3
GND GND
VCC (3.3v) 3V3
Local developmen libraries for spark-Core
For local spark development you need core-firmware, core-common-lib, and core-communication-lib. You can use git to download the repositories. For more information look at the tutorial for local development.
Compiling with Spark dev
The following folder contains the full spark-ereader example.
Libraries for SD card and epaper display
Download or clone the sd-card-library. And for the Ereader application download the spark-ereader files for ereader with spark core.
Test the Spark-CardInfo example to verify the SD card and the connections.
- copy the .cpp and .h files to core-firmware/src &../inc.
- copy the examples/Spark-CardInfo.cpp to ./core-firmware/src/application.cpp
- Change the line in application.cpp 'include "sd-card-library/sd-card-library.h"' to include '"sd-card-library.h"'
The following files are added to the firmware library.
//header files
./core-firmware/inc/sd-card-library.h
./core-firmware/inc/sd-fat-util.h
./core-firmware/inc/sd-fat.h
./core-firmware/inc/sd-info.h
./core-firmware/inc/sd2-card-config.h
./core-firmware/inc/sd2-card.h
./core-firmware/inc/fat-structs.h
// source files
./core-firmware/src/File.cpp
./core-firmware/src/sd-card-library.cpp
./core-firmware/src/sd-file.cpp
./core-firmware/src/sd-volume.cpp
./core-firmware/src/sd2-card.cpp
./core-firmware/src/application.cpp
Run the SD example
Connect througt the USB-serialport with a serial monitor, 115200 baud. You can use the sparc-dev serial monitor. Send a character to trigger the response. The program should read the sd-card and report back the library list of the SD-card.
Wiring the EPD board:
Look at repapers pin description for the EPD-board
Vcc 3V Red 3.3V
(LED1) White - not connected
(UART_RX) Grey - not connected
(UART_TX) Purple - not connected
(SW2) Blue - not connected
Temperature Green A0
SPI_CLK Yellow A3
BUSY Orange D7
PWM Brown A7
RESET Black D6
PANEL_ON Red D2
DISCHARGE White D4
BORDER_CONTROL Grey D3
SPI_MISO Purple A4
SPI_MOSI Blue A5
(RST/SBWTDIO) Green - not connected
(TEST/SBWTCK) Yellow - not connected
FLASH_CS Orange D1
EPD_CS Brown D0
GND Black GND
SD Card file structure
Download the wyolum directory. Copy the IMAGES/ directory to the root folder of your SD card. Copy the file called “unifont.wff” to the root directory of your SD card.
[SD card root]/
IMAGES/
unifont.wff
Setup the ereader example:
Copy ereader.cpp and EPD.cpp from the spark-ereader library to the core-firmware/src and EPD.h, EReader.h, and picture.h to core-firmware/inc folder.
//header files
./core-firmware/inc/EPD.h
./core-firmware/inc/EReader.h
./core-firmware/inc/picture.h
//source files
./core-firmware/src/EPD.cpp
./core-firmware/src/EReader.cpp
Note If you don't want to use the cloud you can set the SYSTEM_MODE(MANUAL) in the application.cpp
Test the ereader program that loads image files from the sd-card
Start the serial monitor and submit a character to trigger the program to start. The program will first read an image stored in the flash memory. Then it draws figures and display images from the sd-card