So this is the code i've been running to display sensor data in node red. My issue now is getting the sensor reading to show correctly on a 16,2 lcd. I have my lcd print come up but it wont show my sensor readings. This is the code im running
#include <Adafruit_MAX31855.h>
#include <SPI.h>
// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 8
#define TEMPERATURE_PRECISION 9
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// arrays to hold device addresses
//DeviceAddress outdoor, ahu_s, ahu_r, waterheater, boiler_s, boiler_r, heatpump_s, heatpump_l;
// Assign address manually. The addresses below will beed to be changed
// to valid device addresses on your bus. Device address can be retrieved
// by using either oneWire.search(deviceAddress) or individually via
// sensors.getAddress(deviceAddress, index);
DeviceAddress waterheater = { 0x28, 0x7C, 0x00, 0x43, 0x98, 0x22, 0x00, 0xCE };
DeviceAddress boiler_r = { 0x28, 0x92, 0x1C, 0x43, 0x98, 0x24, 0x00, 0x03 };
DeviceAddress boiler_s = { 0x28, 0xCD, 0x13, 0x43, 0x98, 0x25, 0x00, 0xA2 };
DeviceAddress heatpump_l = { 0x28, 0x2B, 0x25, 0x43, 0x98, 0x18, 0x00, 0x85 };
DeviceAddress heatpump_s = { 0x28, 0xC6, 0x1F, 0x43, 0x98, 0x08, 0x00, 0x33 };
DeviceAddress outdoor = { 0x28, 0x5D, 0x22, 0x43, 0x98, 0x24, 0x00, 0x9E };
DeviceAddress ahu_s = { 0x28, 0x3B, 0x0B, 0x43, 0x98, 0xFF, 0x00, 0x9F };
DeviceAddress ahu_r = { 0x28, 0x27, 0x02, 0x43, 0x98, 0x25, 0x00, 0xF5 };
int thermoDO = 5;
int thermoCS = 4;
int thermoCLK = 3;
Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
void setup(void)
{
// start serial port
Serial.begin(9600);
delay(500);
//Serial.println(" ");
// Start up the library
sensors.begin();
if (!sensors.getAddress(waterheater, 0));
if (!sensors.getAddress(boiler_r, 1));
if (!sensors.getAddress(boiler_s, 2));
if (!sensors.getAddress(heatpump_l, 3));
if (!sensors.getAddress(heatpump_s, 4));
if (!sensors.getAddress(outdoor, 5));
if (!sensors.getAddress(ahu_s, 6));
if (!sensors.getAddress(ahu_r, 7));
sensors.setResolution(outdoor, TEMPERATURE_PRECISION);
sensors.setResolution(ahu_s, TEMPERATURE_PRECISION);
sensors.setResolution(ahu_r, TEMPERATURE_PRECISION);
sensors.setResolution(waterheater, TEMPERATURE_PRECISION);
sensors.setResolution(boiler_s, TEMPERATURE_PRECISION);
sensors.setResolution(boiler_r, TEMPERATURE_PRECISION);
sensors.setResolution(heatpump_s, TEMPERATURE_PRECISION);
sensors.setResolution(heatpump_l, TEMPERATURE_PRECISION);
}
// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
Serial.print(DallasTemperature::toFahrenheit(tempC));
}
void printResolution(DeviceAddress deviceAddress)
{
Serial.print(sensors.getResolution(deviceAddress));
}
// main function to print information about a device
void printData(DeviceAddress deviceAddress)
{
printTemperature(deviceAddress);
Serial.println();
}
void loop(void)
{
sensors.requestTemperatures();
// print the device information
Serial.print("outdoor ");
printData(outdoor);
delay(500);
Serial.print("ahu_s ");
printData(ahu_s);
delay(500);
Serial.print("ahu_r ");
printData(ahu_r);
delay(500);
Serial.print("waterheater ");
printData(waterheater);
delay(500);
Serial.print("boiler_s ");
printData(boiler_s);
delay(500);
Serial.print("boiler_r ");
printData(boiler_r);
delay(500);
Serial.print("heatpump_s ");
printData(heatpump_s);
delay(500);
Serial.print("heatpump_l ");
printData(heatpump_l);
delay(500);
float sensorVoltage = analogRead(0); // read the sensor voltage
int psi = ((sensorVoltage-95)/204)*50;
Serial.print("PSI ");
Serial.println (psi);
delay (500);
double f = thermocouple.readFarenheit();
Serial.print("FLUE ");
Serial.println(thermocouple.readFarenheit());
delay(60000);
Serial.println();
}