Hi,
Can you please try this edit of your code;
#include "max6675.h"
// start of settings for LCD2004 with I2C
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 20 chars and 4 line display
LiquidCrystal_I2C lcd(0x27, 20, 4);
// end of settings for LCD2004 with I2C
int soPin = 12;// SO=Serial Out
int csPin = 10;// CS = chip select CS pin
int sckPin = 13;// SCK = Serial Clock pin
float testVar0 = 100.0;
float testVar1 = 123.23;
float testVar2 = 12.23;
float testVar3 = 1.23;
MAX6675 thermocouple(sckPin, csPin, soPin);
void setup() {
lcd.init();// initialize the LCD2004
lcd.backlight();
Serial.begin(9600);// initialize serial monitor with 9600 baud
Serial.println("MAX6675");
delay(3);
}
void loop() {
// basic readout test, just print the current temp
/* Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());
lcd.clear();// clear previous values from screen
lcd.setCursor(6,0);
lcd.print(thermocouple.readCelsius());
lcd.setCursor(12,0);
lcd.print((char)223);
lcd.setCursor(13,0);
lcd.print("C");
lcd.setCursor(6,2);
lcd.print(thermocouple.readFahrenheit());
lcd.setCursor(12,2);
lcd.print((char)223);
lcd.setCursor(13,2);
lcd.print("F");
*/
Serial.println(testVar0);
lcd.setCursor(3, 0);
lcd.print(testVar0);
Serial.println(testVar1);
lcd.setCursor(3, 1);
lcd.print(testVar1);
Serial.println(testVar2);
lcd.setCursor(3, 2);
lcd.print(testVar2);
Serial.println(testVar3);
lcd.setCursor(3, 3);
lcd.print(testVar3);
delay(1000);
Serial.println("Clearing Screen");
lcd.clear();// clear previous values from screen
delay(500);
}
Thanks.. Tom..
dkskinn
February 15, 2021, 12:23am
22
TomGeorge:
Hi,
Can you please try this edit of your code
I will do this as soon as I get the chance. This may be a bit. But I'll get back to you when I do.
dkskinn
February 15, 2021, 5:12am
23
TomGeorge:
Hi,
Can you please try this edit of your code;
Ok, loaded the edited code. just getting
1.00
1.23
1.23
1.23 on the LCD
but...
100.00
123.23
12.23
1.23
Clearing Screen
in the serial monitor
Hi,
Thanks for the try.
Can you please try this one.
Can you confirm that is it printing on the LCD 3 spaces from the left hand side of the screen?
#include "max6675.h"
// start of settings for LCD2004 with I2C
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 20 chars and 4 line display
LiquidCrystal_I2C lcd(0x27, 20, 4);
// end of settings for LCD2004 with I2C
int soPin = 12;// SO=Serial Out
int csPin = 10;// CS = chip select CS pin
int sckPin = 13;// SCK = Serial Clock pin
float testVar0 = 100.0;
float testVar1 = 123.45;
float testVar2 = 12.345;
float testVar3 = 1.2345;
MAX6675 thermocouple(sckPin, csPin, soPin);
void setup() {
lcd.init();// initialize the LCD2004
lcd.backlight();
Serial.begin(9600);// initialize serial monitor with 9600 baud
Serial.println("MAX6675");
delay(3);
}
void loop() {
// basic readout test, just print the current temp
/* Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());
lcd.clear();// clear previous values from screen
lcd.setCursor(6,0);
lcd.print(thermocouple.readCelsius());
lcd.setCursor(12,0);
lcd.print((char)223);
lcd.setCursor(13,0);
lcd.print("C");
lcd.setCursor(6,2);
lcd.print(thermocouple.readFahrenheit());
lcd.setCursor(12,2);
lcd.print((char)223);
lcd.setCursor(13,2);
lcd.print("F");
*/
Serial.println(testVar0);
lcd.setCursor(3, 0);
lcd.print(testVar0);
Serial.println(testVar1);
lcd.setCursor(3, 1);
lcd.print(testVar1);
Serial.println(testVar2);
lcd.setCursor(3, 2);
lcd.print(testVar2);
Serial.println(testVar3);
lcd.setCursor(3, 3);
lcd.print(testVar3);
delay(1000);
Serial.println("Clearing Screen");
lcd.clear();// clear previous values from screen
delay(500);
}
Tom...
dkskinn
February 15, 2021, 9:23pm
25
TomGeorge:
Can you please try this one.
Can you confirm that is it printing on the LCD 3 spaces from the left hand side of the screen?
Same numbers just 3 spaces over... :-\
Koepel
February 15, 2021, 9:28pm
26
dkskinn, so far we have no clue what is going on. It should not happen. Could your display be damaged ? Did you try to display it to an other location on the display, or display a text instead of a float ?
Can you try with another display ?
See if the hd44780.h diagnostic sketch gives you any clue.
Hi,
Can you please post a picture of your project and a the front and back image of the LCD display?
Thanks.. Tom...
JCA34F
February 16, 2021, 4:15am
29
Looks like the lib returns floats, did you try LCD printing the returned numbers ONLY?
void loop() {
// basic readout test, just print the current temp
Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());
lcd.clear();// clear previous values from screen
lcd.setCursor(0,0);
lcd.print(thermocouple.readCelsius());
/*lcd.setCursor(12,0);
lcd.print((char)223);
lcd.setCursor(13,0);
lcd.print("C"); /*
lcd.setCursor(0,2);
lcd.print(thermocouple.readFahrenheit());
/*lcd.setCursor(12,2);
lcd.print((char)223);
lcd.setCursor(13,2);
lcd.print("F");*/
delay(500);
}
How many digits after decimal point?
dkskinn
February 16, 2021, 5:54pm
30
cattledog:
See if the hd44780.h diagnostic sketch gives you any clue.
Tried the diagnostic and I got no errors...
Can you please post the complete print out from the diagnostic sketch. Thanks. The mystery deepens if the hardware is ok
dkskinn
February 16, 2021, 8:27pm
32
Tom, JCA34F, Cattledog
I will when I get back to it. My week is pretty busy this week. I do HVAC and is in the negative temps here, so......
dkskinn:
Tom, JCA34F, Cattledog
I will when I get back to it. My week is pretty busy this week. I do HVAC and is in the negative temps here, so......
No worries mate, I assume you are in US, not good with big freeze.
Do you have another I2C LCD, even a smaller one that you can try with the library and your hardware say a 16x2?
Tom...
dkskinn
February 17, 2021, 4:13pm
34
Tom. Actually I already have. I've swapped out to a 1602 display with a different i2c module. I've used a different arduino uno. Only thing I don't have an extra of is the 6675 thermo couple module. But i assume since the serial monitor is giving correct values, it's fine.
Hi,
Can you please post a couple of pictures of your project so we can se your component layout?
Can you include a picture of the display showing its fault?
Thanks.. Tom...
dkskinn:
Tried the hd44780.h diagnostic sketch and I got no errors...
Does that sketch use the exact same libraries:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
?
hd44780.h uses Wire.h but replaces Liquid Crystal h.
That leaves LiquidCrystal_I2C.h as the only suspect.
Please check date and time of the files in C:\Program Files (x86)\Arduino\libraries\LiquidCrystal_I2C
Make a copy of those files in another folder
Install the latest version (or an older one, I don't care) and see what happens
PS.: I can't imagine how this would solve the probem, but it's the last and only thing we didn't check yet...
Tried the diagnostic and I got no errors...
Have you tried your temperature sketch with the hd44780.h library being used instead of LiquidCrytal_I2C?
dkskinn
February 26, 2021, 5:21pm
40
cattledog:
Have you tried your temperature sketch with the hd44780.h library being used instead of LiquidCrytal_I2C?
I can not seem to get the sketch to work with the HD44780 library.
Kept getting errors while compiling. The weird thing is I was able to run the diagnostic sketch perfectly fine...