SOLVED: HX711 & Tri-Color EPD FeatherWing on Feather ESP8266

Hardware:
Adafruit Feather HUZZAH with ESP8266
Adalogger FeatherWing (using RTC only)
2.9" Tri-Color ePaper Display FeatherWing
HX711 breakout board

Hello! I can't get the HX711 to work simultaneously with the Tri-Color ePaper Display FeatherWing. Each work perfectly independently. But when both are initialized, the HX711 returns a constant value (-2040g). I have tried using the HX711 on SPI pins 12, 13, and 14 in different combinations. But same problem.

The goal is to eventually read and upload weight to server every 30 minutes, but I need the last weight to be displayed permanently. Hence the ePaper Display.

/*
Hardware:
Adafruit Feather HUZZAH with ESP8266
Adalogger FeatherWing (using RTC only)
2.9" Tri-Color ePaper Display FeatherWing
HX711 breakout board
*/

#include <SPI.h>
#include <Wire.h>
#include "RTClib.h"
#include "HX711.h"
#include "Adafruit_ThinkInk.h"

RTC_PCF8523 rtc; // Adafruit RTC board

HX711 scale;
//Define HX711 load sensor interface pins
#define DOUT 12
#define CLK 14

float weight;
float calibration_factor = 271.49; //Use "calibrate_load_sensor" sketch to find

//Define 2.9" Tri-Color ePaper Display FeatherWing interface pins
#define EPD_DC 15 // can be any pin, but required!
#define EPD_CS 0 // can be any pin, but required!
#define EPD_BUSY -1 // can set to -1 to not use a pin (will wait a fixed delay)
#define SRAM_CS 16 // can set to -1 to not use a pin (uses a lot of RAM!)
#define EPD_RESET -1 // can set to -1 and share with chip Reset (can't deep sleep)

//Define 2.9" Tricolor EPD FeatherWing:
ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);

long previousMillis = 0; // will store last time Display was updated
long interval = 180000; // interval at which Display is updated

//=============================================================================================
// SETUP
//=============================================================================================
void setup() {

Serial.begin(115200);
delay(1000);

//----------------Initialize RTC--------------------------

// Initialize the library to run the RTC
Wire.begin();
Wire.setClock(400000L);

// Following line sets the RTC to the current date and time
//rtc.adjust(DateTime(DATE, TIME));

// Test if the RTC is working properly
if (! rtc.isrunning()) {
Serial.println(F(""));
Serial.println(F("RTC is NOT running!"));
}
else {
// Output the succesfull initialization message to the serial monitor
Serial.println(F(""));
Serial.println(F("RTC initialized."));
}

//----------Initialize scale---------------------------------
scale.begin(DOUT, CLK);
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);

//----------Initialize TRICOLOR E-PAPER DISPLAY---------------------------------

display.begin(THINKINK_TRICOLOR);
Serial.println("E-Paper Display begun");
delay(2000);

}

//=============================================================================================
// LOOP
//=============================================================================================

void loop() {

scale.set_scale(calibration_factor); //Adjust to this calibration factor

weight = scale.get_units();

Serial.print("Weight: ");
Serial.print(weight, 1); //number indicates # of decimal places
Serial.println(" g ");

//--------------- E-Paper Display --------------
unsigned long currentMillis = millis();

if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
display.clearBuffer();
display.setTextSize(5);
display.setCursor((display.width() - 150) / 2, (display.height() - 30) / 2);
display.setTextColor(EPD_BLACK);
display.print(weight, 0); //number indicates # of decimal places
display.print (" g");
display.display();
Serial.println("Display updated");
}

Hardware:
Adafruit Feather HUZZAH with ESP8266
Adalogger FeatherWing (using RTC only)
2.9" Tri-Color ePaper Display FeatherWing
HX711 breakout board

Hello! I can't get the HX711 to work simultaneously with the Tri-Color ePaper Display FeatherWing. Each work perfectly independently. But when both are initialized, the HX711 returns a constant value (-2040g). I have tried using the HX711 on SPI pins 12, 13, and 14 in different combinations. Anyone have suggestions?

The goal is to eventually read and upload weight to server every 30 minutes, but I need the last weight to be displayed permanently. Hence the ePaper Display.

/*
Hardware:
Adafruit Feather HUZZAH with ESP8266
Adalogger FeatherWing (using RTC only)
2.9" Tri-Color ePaper Display FeatherWing
HX711 breakout board
*/

#include <SPI.h>
#include <Wire.h>
#include "RTClib.h"
#include "HX711.h"
#include "Adafruit_ThinkInk.h"

RTC_PCF8523 rtc; // Adafruit RTC board

HX711 scale;
//Define HX711 load sensor interface pins
#define DOUT 12
#define CLK 14

float weight;
float calibration_factor = 271.49; //Use "calibrate_load_sensor" sketch to find

//Define 2.9" Tri-Color ePaper Display FeatherWing interface pins
#define EPD_DC 15 // can be any pin, but required!
#define EPD_CS 0 // can be any pin, but required!
#define EPD_BUSY -1 // can set to -1 to not use a pin (will wait a fixed delay)
#define SRAM_CS 16 // can set to -1 to not use a pin (uses a lot of RAM!)
#define EPD_RESET -1 // can set to -1 and share with chip Reset (can't deep sleep)

//Define 2.9" Tricolor EPD FeatherWing:
ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);

long previousMillis = 0; // will store last time Display was updated
long interval = 180000; // interval at which Display is updated

//=============================================================================================
// SETUP
//=============================================================================================
void setup() {

Serial.begin(115200);
delay(1000);

//----------------Initialize RTC--------------------------

// Initialize the library to run the RTC
Wire.begin();
Wire.setClock(400000L);

// Following line sets the RTC to the current date and time
//rtc.adjust(DateTime(DATE, TIME));

// Test if the RTC is working properly
if (! rtc.isrunning()) {
Serial.println(F(""));
Serial.println(F("RTC is NOT running!"));
}
else {
// Output the succesfull initialization message to the serial monitor
Serial.println(F(""));
Serial.println(F("RTC initialized."));
}

//----------Initialize scale---------------------------------
scale.begin(DOUT, CLK);
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);

//----------Initialize TRICOLOR E-PAPER DISPLAY---------------------------------

display.begin(THINKINK_TRICOLOR);
Serial.println("E-Paper Display begun");
delay(2000);

}

//=============================================================================================
// LOOP
//=============================================================================================

void loop() {

scale.set_scale(calibration_factor); //Adjust to this calibration factor

weight = scale.get_units();

Serial.print("Weight: ");
Serial.print(weight, 1); //number indicates # of decimal places
Serial.println(" g ");

//--------------- E-Paper Display --------------
unsigned long currentMillis = millis();

if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
display.clearBuffer();
display.setTextSize(5);
display.setCursor((display.width() - 150) / 2, (display.height() - 30) / 2);
display.setTextColor(EPD_BLACK);
display.print(weight, 0); //number indicates # of decimal places
display.print (" g");
display.display();
Serial.println("Display updated");
}

This is the what displays on serial monitor:

rll⸮⸮|⸮l⸮| ⸮ l⸮ b|⸮⸮⸮⸮r⸮b⸮ b⸮
RTC initialized.
Zero factor: 759958
E-Paper Display begun
Weight: 0.3 g

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (28):
epc1=0x40202101 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

stack>>>

ctx: cont
sp: 3ffffd50 end: 3fffffc0 offset: 0190
3ffffee0: 00000005 00000005 3fffff2a 40203328
3ffffef0: 00000005 3fffff10 3ffee378 402023e0
3fffff00: 3ffee378 00000005 3ffe867c 40202471
3fffff10: 2b2b0003 00000009 3ffee378 40202f20
3fffff20: 00000005 00000005 3fe9e6a2 3ffee5d0
3fffff30: 402066dc 3ffee378 3fffff50 40203521
3fffff40: 3ffee378 3ffee40c 3ffee378 3ffe8646
3fffff50: 3ffe8646 3ffee378 00000001 3ffee5d0
3fffff60: 3ffee378 00000000 3ffee378 40202888
3fffff70: 402066dc 3ffee378 3ffe8644 40203521
3fffff80: 3ffee378 3ffee40c 3ffee378 402022a1
3fffff90: 3fffdad0 3ffee40c 3ffee568 402011da
3fffffa0: 3fffdad0 00000000 3ffee590 40203d9c
3fffffb0: feefeffe feefeffe 3ffe84ec 40100eb1
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld

RTC initialized.
Zero factor: 759987
E-Paper Display begun
Weight: 0.0 g

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

SOLVED
I connected the HX711 to the I2C pins (4 and 5 on Feather), and it works perfectly now. I suppose the HX711 can't share any of the SPI pins with the ePaper Display sense each worked fine without initializing the other. I'm still not knowledgeable enough to know if this will prevent the RTC from properly communicating through the I2C pins.

Duplicate topics merged

Difficult thread to read thread, because you did not follow the forum posting rules.

Note that the HX711, to generate a stable excitation voltage (and resulting weight), needs a 5volt supply.
An ESP8266 however needs to see 3.3volt logic on it's pins.
AFAIK only a HX711 board from Sparkfun.com has the provisions to power the analogue part of the chip from 5volt and the digital part from 3.3volt.

The HX711 output is not analogue, nor I2C.
It's digital output can be connected to any suitable pin.
Note that the ESP8266 has restrictions on some pins.
Google can help there.

It (usually) does not make sense to use a RTC with the ESP8266.
You can get time from the internet, and the ESP will keep perfect time between hourly of even daily NTP updates.
Leo..

1 Like

Thanks, Wawa.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.