LCD not functioning properly

Hi,

I have a 2 x 16 parallel LCD. It is attached to a protoshield attached to a UNO. It works fine on "Hello world" but when I have it hooked up to a thermocouple, it gives the Int temp as -127 and states T/C Problem. Then it goes bonkers with all 32 characters rapidly changing with various symbols like #,@,&, sigma and omega, etc.. Then it shuts down and then repeats.

However, the serial monitor sketch works fine and shows the proper temperature.

The LCD thermocouple sketch is from LadyAda who sells the TC and break out board/amplifier so I assume the sketch is not the problem.

This was a very inexpensive LCD - as a total noob, I am wondering if that could be the problem?

Any suggestions or recommendations would be greatly appreciated.

TIA

Any suggestions or recommendations would be greatly appreciated.

Since the LCD works with 'Hello World' that implies that the connections between the LCD and the Arduino are correct. That leaves us suspecting a problem with your implementation of the sketch from LadyAda. Don't you think that you might get more help if you provided us with a copy of your version of the sketch and a photograph of your protoshield hookup?

Don

Thanks, Don

here is the sketch from LadyAda - only change was the sequence of the pin #s

#include "Adafruit_MAX31855.h"
#include <LiquidCrystal.h>

int thermoCLK = 3;
int thermoCS = 4;
int thermoDO = 5;

// Initialize the Thermocouple
Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

  
void setup() {
  Serial.begin(9600);
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  
  lcd.print("MAX31855 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
   lcd.setCursor(0, 0);
   lcd.print("Int. Temp = ");
   lcd.println(thermocouple.readInternal());
   lcd.print("  "); 
     
   double c = thermocouple.readCelsius();
   lcd.setCursor(0, 1);
   if (isnan(c)) 
   {
     lcd.print("T/C Problem");
   } 
   else 
   {
     lcd.print("C = "); 
     lcd.print(c);
     lcd.print("  "); 
   }
 
   delay(1000);
}

Here are some photos but as you said, it must be hooked up to the UNO properly for “Hello World!” to work

Pin one is top right in the next shot

The pinout for the LCD is 11-RS to UNO pin 11, 9-EN to UNO pin 12, 4-D4 to UNO pin 7, 3-D5 to UNO pin 8, 2-D6 to UNO pin 9 and 1-DB7 to UNO pin 10

Hope this gives you the information you need

lcd.println(thermocouple.readInternal());

Well for starters this is really going to mess up the LCD display. There's a good reason that there is no mention of println in the LCD documentation.

Don

Don, what is this absolute noob supposed to do at this point - delete that line of code?

May have accidentally discovered something - in reconnecting the Maxim TC board to the UNO, I misplaced the pins and got the same message on the serial monitor as I was getting on the LCD. This leads me to believe there is an error in the LCD sketch - but I don't know enough to know how to debug it =(

The MAX31855 has DO to UNO pin 3, CS to UNO pin 4 and CLK to UNO pin 5.

Don, what is this absolute noob supposed to do at this point - delete that line of code?

No, you have to use print instead of println and then deal with going to a new line in a separate step by using cursor positioning.

Don

well, I am in way over my head - managed to get rid of the "ln" (which did not help) but have no idea how to do the rest

Can you recommend a resource where I might be able to learn some of this stuff?

Getting pretty frustrating to have spent almost two full days trying to get an LCD to work

Compared the lcd sketch with the serial and cannot find any discrepancies but probably would not recognize one!

Will try lcd.setCursor(1,0) just to see what happens. Did not help - LCD just went blank

try using pins 7,8,9, and some pins other than 10,11,12 for lcd. Your temperature sensor is using pins 11-13, possibly 10 too.

I'm having the same problem and have no idea what the solution was here. Using the example code it just produces Int. Temp = T/C Problem

With the second line flashing.

I worked the hello world code and the lcd works. I worked the serialthermocouple code and that works when watching the serial monitor of the temperature.

But when I use the lcdthermocouple code like the original poster I get the same error.

It's been more than 7 years since I wrote reply #1 but the content is still relevant.

Don

floresta: It's been more than 7 years since I wrote reply #1 but the content is still relevant.

Don

If you mean implementation of the ladyada code then I think not. I'm in the same situation as the original poster in that all I did was open it and upload it.

It uploaded correctly...but just flashes the T/C Problem.

I removed the ln after the prints as you suggested to that person but it didn't help either. The only thing that seemed to do is change how the serial monitor showed lines. But did not solve the error.

Any one else have any idea on whats wrong with the Ladyada code example?

Try reading all of reply #1.

Don

floresta:
Try reading all of reply #1.

Don

I did. Have you had a chance to read reply #9 or reply #11?

I agree with your reply number one that the lcd and thermocouple must be working. I also agree the code must be an issue. Here is a copy of the example code that you can download from the ladyada example:

/*************************************************** 
  This is an example for the Adafruit Thermocouple Sensor w/MAX31855K

  Designed specifically to work with the Adafruit Thermocouple Sensor
  ----> https://www.adafruit.com/products/269

  These displays use SPI to communicate, 3 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/
#include <SPI.h>
#include <Wire.h>
#include "Adafruit_MAX31855.h"
#include <LiquidCrystal.h>

// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXDO   3
#define MAXCS   4
#define MAXCLK  5

// Initialize the Thermocouple
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
   #define Serial SerialUSB
#endif
  
void setup() {
  #ifndef ESP8266
    while (!Serial);     // will pause Zero, Leonardo, etc until serial console opens
  #endif
  Serial.begin(9600);
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  
  lcd.clear();
  lcd.print("MAX31855 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.print("Int. Temp = ");
   lcd.println(thermocouple.readInternal());
   Serial.print("Int. Temp = ");
   Serial.println(thermocouple.readInternal());
     
   double c = thermocouple.readCelsius();
   lcd.setCursor(0, 1);
   if (isnan(c)) 
   {
     lcd.print("T/C Problem");
   } 
   else 
   {
     lcd.print("C = "); 
     lcd.print(c);
     lcd.print("  "); 
     Serial.print("Thermocouple Temp = *");
     Serial.println(c);
   }
 
   delay(1000);
}