So I am about done with this project, had some help on some stuff got the bulk of it my self but can’t solve this bit. I’m running 3 temp sensors and 2 humidity sensors thru a multiplexer and my MKR1010. All runs great, the issue I have is that the load cell is not. I know the cell is good as is the amp as I could do the calibration and run a simple load cell sample sketch. However back to my sketch i have no data running to my phone. I would greatly appreciate if someone could see if something jumps out at you.
Jim
#define BLYNK_PRINT Serial
#include <Wire.h>
#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>
//#include <BlynkSimpleWiFiShield101.h>
#include <Adafruit_MCP9808.h>
#include <Adafruit_Si7021.h>
#include <Q2HX711.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "zkq5H0y****************************";
// Set password to "" for open networks.
char ssid[] = "Skynet";
char pass[] = "*****************";
#define calibration_factor -3750.0
//#define scale DT (3)
//#define scale CL (2)
#define SCALE_DATA_PIN 3
#define SCALE_CLOCK_PIN 2
Q2HX711 scale(SCALE_DATA_PIN,SCALE_CLOCK_PIN);
#define TCAADDR 0x70
#define TCAADDR 0x70
#define TEMP1_ADDR 0x18
#define TEMP2_ADDR 0x18
#define TEMP3_ADDR 0x18
#define HUM1_ADDR 0x40
#define HUM2_ADDR 0x40
// Assign unique ID to each sensor
Adafruit_MCP9808 temp1 = Adafruit_MCP9808();
Adafruit_MCP9808 temp2 = Adafruit_MCP9808();
Adafruit_MCP9808 temp3 = Adafruit_MCP9808();
Adafruit_Si7021 hum1 = Adafruit_Si7021();
Adafruit_Si7021 hum2 = Adafruit_Si7021();
//HS711 scale1 = HS711(6)
float temperature1;
float temperature2;
float temperature3;
float humidity1;
float humidity2;
long int loadcell;
long int tare;
void tcaselect(uint8_t i) {
if (i > 7) return;
Wire.beginTransmission(TCAADDR);
Wire.write(1 << i);
Wire.endTransmission();
}
// standard Arduino setup()
void setup()
{
Wire.begin();
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
//these functions do not exist. you need to implement in firmware.
//scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
//scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0
/////
//setup temp sensors:
tcaselect(7);
if (!temp1.begin(0x18)) {
Serial.println("Couldn't find Temp1! Check your connections and verify the address is correct.");
while (1);
}
Serial.println("Found MCP9808, Sensor 1!");
temp1.setResolution(0); // sets the resolution mode of reading, the modes are defined in the table bellow:
// Mode Resolution SampleTime
// 0 0.5°C 30 ms
// 1 0.25°C 65 ms
// 2 0.125°C 130 ms
// 3 0.0625°C 250 ms
tcaselect(6);
if (!temp2.begin(0x18)) {
Serial.println("Couldn't find Temp2! Check your connections and verify the address is correct.");
while (1);
}
Serial.println("Found MCP9808, Sensor 2!");
temp2.setResolution(0);
tcaselect(5);
if (!temp3.begin(0x18)) {
Serial.println("Couldn't find Temp3! Check your connections and verify the address is correct.");
while (1);
}
Serial.println("Found MCP9808, Sensor 2!");
temp3.setResolution(0);
}
void loop(void)
{
tcaselect(7);
//temp1.getEvent(&event);
temperature1=temp1.readTempF();
//Display the results
Blynk.virtualWrite(V7,temperature1);
tcaselect(6);
//temp2.getEvent(&event);
temperature2=temp2.readTempF();
Blynk.virtualWrite(V6,temperature2);
tcaselect(5);
//temp3.getEvent(&event);
temperature3=temp3.readTempF();
Blynk.virtualWrite(V5,temperature3);
tcaselect(4);
//hum4.getEvent(&event);
humidity1=hum1.readHumidity();
Blynk.virtualWrite(V4,humidity1);
tcaselect(3);
//hum5.getEvent(&event);
humidity2=hum2.readHumidity();
Blynk.virtualWrite(V3,humidity2);
Blynk.virtualWrite(V2, 3);
Blynk.run();
}