compile error with Adafruit_EPD

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

compile error with Adafruit_EPD

Post by earthres »

I USED to have code that worked with the monochrome 2.13" e-ink display. But now I get these messages with the example file provided for this device:
In member function 'void Adafruit_EPD::csHigh()'
'class Adafruit_SPIDevice' has no member named 'endTransaction'
'class Adafruit_SPIDevice' has no member named 'beginTransaction'
I removed the Adafruit_EPD library and reinstalled it but I still get the same message.
Help?

User avatar
adafruit_support_carter
 
Posts: 29189
Joined: Tue Nov 29, 2016 2:45 pm

Re: compile error with Adafruit_EPD

Post by adafruit_support_carter »

Try updating your Adafruit_BusIO library to the latest release.

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: compile error with Adafruit_EPD

Post by earthres »

Yes, that let it compile! Now... what's wrong with this code? I THINK I got the pin assignments from some other e Ink example code. Do I need to define more pins? If I get this simple code to work, what pin reassignments would I need to allow use of another SPI device like an SD card on a data logger (UNO or Nano)? I know that, in general, some SPI pins are fixed, but others can be changed so that more than one SPI device can co-exist on the same board.

Code: Select all

// eInkTextTest.ino
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_EPD.h>
#include <SPI.h>
#define EPD_CS     10
#define EPD_DC      9
#define SRAM_CS     8
#define EPD_RESET   5 // can set to -1 and share with microcontroller Reset!
#define EPD_BUSY    3 // can set to -1 to not use a pin (will wait a fixed delay)
/* using 2.13" monochrome 250*122 EPD */
Adafruit_SSD1675 display(250, 122, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
long int refresh=60000L;
void setup(void) {
  Serial.begin(9600);
  display.begin();
  display.clearBuffer(); display.setCursor(5,5);
  display.fillScreen(EPD_WHITE);
  display.setTextColor(EPD_BLACK);
  display.setTextSize(2);
  Serial.println("Initialized");  
  display.println("Hello World!"); display.display();
}
void loop() {
}

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: compile error with Adafruit_EPD

Post by earthres »

Perhaps I should rephrase my question about using this device. Can you give me a complete list of pin connections on the 2.13" monochrome eInk module (I want just to display text and not graphics). I know about this link:
https://learn.adafruit.com/adafruit-2-1 ... ngs/wiring
but can you give a list without using the ICSP header?

This will be greatly appreciated!

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: compile error with Adafruit_EPD

Post by earthres »

OK. I now have code that works. Any comments will be appreciated!

Code: Select all

// eInkTextTest.ino
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_EPD.h>
#include <SPI.h>
// These pins are assumed (fixed?)
// CLK 13
// MISO 12
// MOSI 11 
#define EPD_CS 9
#define EPD_DC 10
#define SRAM_CS 6
#define EPD_RESET 8
#define EPD_BUSY 7
/* using 2.13" monochrome 250*122 EPD */
Adafruit_SSD1675 display(250, 122, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
void setup(void) {
  Serial.begin(9600);
  display.begin();
  display.clearBuffer(); display.setCursor(5,5);
  display.fillScreen(EPD_WHITE);
  display.setTextColor(EPD_BLACK);
  display.setTextSize(2);
  Serial.println("Initialized");  
  display.println("Hello World!"); display.display();
}
void loop() {
}

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: compile error with Adafruit_EPD

Post by earthres »

Please let me continue with questions about the eInk display. I have code that will display text, with these pin connections:
VIN 3V3
3.3V link to 3.3 V power from board
GND GND
SCK D13
MISO D12
MOSI D11
ECS D9
D/C D10
SRCS D6
SDCS no connection
RST D8
BUSY D7
ENA no connection

If I want to add a data logging shield to a project using this display, how do I do that? The SD card is also an SPI device, with hard-wired connections for CS, MOSI, MISO, and SCK, where the CS pin must be included in code -- 10 for UNO, etc. Will it work to reassign one or more of the eInk pins? If so, which one(s)??

Thanks for help!

User avatar
adafruit_support_carter
 
Posts: 29189
Joined: Tue Nov 29, 2016 2:45 pm

Re: compile error with Adafruit_EPD

Post by adafruit_support_carter »

The SPI pins MOSI, MISO, and SCK can be shared. But the CS pin must be unique for each device. So it won't work unless something is done to fix the pin 10 conflict. It can't be both D/C for the TFT and CS for the SD card.

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: compile error with Adafruit_EPD

Post by earthres »

Maybe one more question? Is there a (smaller!) subset of the GFX library that can be used just for displaying text, similar to the U8x8lib that's a subset of the U8g2 library?

User avatar
adafruit_support_carter
 
Posts: 29189
Joined: Tue Nov 29, 2016 2:45 pm

Re: compile error with Adafruit_EPD

Post by adafruit_support_carter »

There is only the GFX library. Are you running into a code size issue using the GFX library?

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: compile error with Adafruit_EPD

Post by earthres »

Yes. "Bare bones" code to display and log data from a BME280 sensor takes about 30,500 bytes -- right at the max of 30,720. By "bare bones" I mean, for example, removing the statements I would usually include to check the status of all the hardware. The code itself for an UNO or Nano isn't that big, so I assume the GFX library is the issue. Thoughts?

Code: Select all

// BME280_eInk_log.ino
// Displays and logs data from BME280  T/RH/P sensor.
// This code is very near the available UNO/Nano code size!
// Including code for checking hardware status on startup and
// assigning float variables for T, RH, and P pushes over the size limit.
const long int DELAY=60000L;
#include <Wire.h>
// setup for data logging
#include <RTClib.h>
RTC_DS1307 rtc;
#include <SD.h>
const int SDpin=10;
File logfile; char filename[]="BME_EINK.CSV";
// Sensor setup.
#include <Wire.h>
#include "Adafruit_BME280.h"
Adafruit_BME280 bme; 
// eInk setup.
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_EPD.h>
#include <SPI.h>
// These pins are hardwired for SD card devices.
// CLK 13, MISO 12, MOSI 11 
#define EPD_CS 9
#define EPD_DC 5 // Can't use pin 10 here.
#define SRAM_CS 6
#define EPD_RESET 8
#define EPD_BUSY 7
// using 2.13" monochrome 250*122 EPD.
Adafruit_SSD1675 display(250,122,EPD_DC,EPD_RESET,EPD_CS,SRAM_CS,EPD_BUSY);
int YR,MON,DAY,HR,MIN,SEC; 
void setup() {
  Serial.begin(9600); Wire.begin(); rtc.begin();
  SD.begin(SDpin); bme.begin();
  logfile = SD.open(filename, FILE_WRITE);     
  logfile.println("YYYY/MM/DD,HH:MM:SS,dayFrac,T,RH,P");
  logfile.flush();
  display.begin();display.setTextColor(EPD_BLACK);display.setTextSize(2); 
}
void loop() {
  DateTime now=rtc.now();
  YR=now.year(); MON=now.month(); DAY=now.day();
  HR=now.hour(); MIN=now.minute(); SEC=now.second();  
  display.clearBuffer(); display.fillScreen(EPD_WHITE);
  display.setCursor(5,5);
  display.print(YR);display.print('/');display.print(MON);
  display.print('/');display.print(DAY);display.print(' ');
  display.print(HR);display.print(':');display.print(MIN);
  display.print(':');display.print(SEC);
  display.setCursor(5,25);
  display.print("   T(C) = "); display.print(bme.readTemperature(),1);
  display.setCursor(5,45);
  display.print("  RH(%) = "); display.print(bme.readHumidity(),0);
  display.setCursor(5,65);
  display.print("P(mbar) = "); display.print(bme.readPressure()/100.,1);
  display.display();
  logfile.print(YR); logfile.print('/'); logfile.print(MON); logfile.print('/');
  logfile.print(DAY); logfile.print(','); logfile.print(HR); logfile.print(':');
  logfile.print(MIN); logfile.print(':'); logfile.print(SEC);logfile.print(','); 
  logfile.print(DAY+HR/24.+MIN/1440.+SEC/86400.,6);logfile.print(',');
  logfile.print(bme.readTemperature(),1);logfile.print(',');
  logfile.print(bme.readHumidity(),0);logfile.print(',');
  logfile.println(bme.readPressure()/100.,1);
  logfile.flush();
  delay(DELAY);
}

User avatar
adafruit_support_carter
 
Posts: 29189
Joined: Tue Nov 29, 2016 2:45 pm

Re: compile error with Adafruit_EPD

Post by adafruit_support_carter »

It could be other libraries as well - like SD, etc.. An UNO is pretty limited in terms of memory. So a sketch that uses GFX, EPD, SD, BME280, etc. may start running out of space. At that point, moving to a more powerful board than an UNO is the best option.

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: compile error with Adafruit_EPD

Post by earthres »

First of all, thanks for your support and help with my questions!

I understand about using boards with more memory, and I have used Feather boards for various projects. I still try to use UNOs and Nanos whenever possible, for no other reason than that they're inexpensive and work for the kinds of data collection projects that interest me the most. I DID get the eINK/BME280 system to work with a Nano. I then used an Adafruit TPL5110 on/off timer to record data at roughly 2-minute intervals. This is plenty of data for long-term monitoring of T/RH/P. (Bearing in mind that the BME280 is a very poor choice for outdoor weather stations, as the dielectric material in the RH sensor will "saturate" in high humidity and will thereafter not respond accurately to changing RH conditions.)

Right now I have this system running from a solar panel/LiPo controller (not an Adafruit one -- sorry). Since the entire Arduino system is powered for only a few seconds every couple of minutes, these systems will run for MONTHS from 6 C or D cells in series, with a high-efficiency step-up or step-up/down voltage regulator to drive the TPL5110 at 5 V. They should run essentially indefinitely with the solar/LiPo system (which has a regulated 5 V output port for a USB cable) unless they're in total darkness for extended periods of time. I'm using a 4400 mAh LiPo, which is probably overkill.

Of course the great benefit of the eInk display is that the latest data remain on the screen even while the system is off.

Here's my code, which is available to anyone who would be interested:

Code: Select all

// BME280_eInk_logT.ino, June 2023
// Displays and logs data from BME280 T/RH/P sensor.
// This code is very near the available UNO/Nano code size!
// Including code for checking hardware status on startup and
// assigning float variables for T, RH, and P pushes over the size limit.
//#define DELAY 60000L
#include <Wire.h>
// setup for data logging
#include <RTClib.h>
RTC_DS1307 rtc;
#include <SD.h>
#define SDpin 10
File logfile; char filename[]="BME_EINK.CSV";
// Sensor setup.
#include <Wire.h>
#include "Adafruit_BME280.h"
Adafruit_BME280 bme; 
// eInk setup.
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_EPD.h>
#include <SPI.h>
// These pins are hardwired for SD card devices.
// CLK 13, MISO 12, MOSI 11 
#define EPD_CS 9
#define EPD_DC 5 // Can't use pin 10 here.
#define SRAM_CS 6
#define EPD_RESET 8
#define EPD_BUSY 7
// using 2.13" monochrome 250*122 EPD.
Adafruit_SSD1675 display(250,122,EPD_DC,EPD_RESET,EPD_CS,SRAM_CS,EPD_BUSY);
int YR,MON,DAY,HR,MIN,SEC; 
void setup() {
  Serial.begin(9600); Wire.begin(); rtc.begin();
  SD.begin(SDpin); bme.begin();
  pinMode(2,OUTPUT); digitalWrite(2,LOW);
  logfile = SD.open(filename, FILE_WRITE); // Appends to end of existing file.    
//  logfile.println("YYYY/MM/DD,HH:MM:SS,dayFrac,T,RH,P");
//  logfile.flush();
  display.begin();display.setTextColor(EPD_BLACK);display.setTextSize(2); 
}
void loop() {
  delay(3000);
  DateTime now=rtc.now();
  YR=now.year(); MON=now.month(); DAY=now.day();
  HR=now.hour(); MIN=now.minute(); SEC=now.second();  
  display.clearBuffer(); display.fillScreen(EPD_WHITE);
  display.setCursor(5,5);
  display.print(YR);display.print('/');display.print(MON);
  display.print('/');display.print(DAY);display.print(' ');
  display.print(HR);display.print(':');display.print(MIN);
  display.print(':');display.print(SEC);
  display.setCursor(5,25);
  display.print("   T(C) = "); display.print(bme.readTemperature(),1);
  display.setCursor(5,45);
  display.print("  RH(%) = "); display.print(bme.readHumidity(),0);
  display.setCursor(5,65);
  display.print("P(mbar) = "); display.print(bme.readPressure()/100.,1);
  display.display();
  logfile.print(YR); logfile.print('/'); logfile.print(MON); logfile.print('/');
  logfile.print(DAY); logfile.print(','); logfile.print(HR); logfile.print(':');
  logfile.print(MIN); logfile.print(':'); logfile.print(SEC);logfile.print(','); 
  logfile.print(DAY+HR/24.+MIN/1440.+SEC/86400.,6);logfile.print(',');
  logfile.print(bme.readTemperature(),1);logfile.print(',');
  logfile.print(bme.readHumidity(),0);logfile.print(',');
  logfile.println(bme.readPressure()/100.,1);
  logfile.flush();
  //delay(DELAY);
  digitalWrite(2,HIGH);
}

User avatar
adafruit_support_carter
 
Posts: 29189
Joined: Tue Nov 29, 2016 2:45 pm

Re: compile error with Adafruit_EPD

Post by adafruit_support_carter »

Cool. Sounds like you got things generally working?

Totally agree with EPD usage in low power applications like this. It's a great use case for that type of display.

User avatar
earthres
 
Posts: 221
Joined: Fri May 28, 2021 10:48 am

Re: compile error with Adafruit_EPD

Post by earthres »

It would be nice if someone could build a smaller "text only" library for using this display. :-) But yes, it works for me now.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”