Thermoelectric module (cooling) using thermocouples and LCD

Any kind souls to help out with my project? It is to monitor batteries; temperature and preventing it from overheating. Use thermocouples to ensure that it would not overheat and when it does, the thermoelectric modeule would be activated. The problem is, the thermoelectric would not work. Only the thermocouple is displaying temperature on the LCD. When it is more than the safe temperature (32C) , the thermoelectric did not work. Any idea why? Here is the code and the schematic diagram:

#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>

#define ONE_WIRE_BUS 2
int led = 4;
int buzzer = 6;
int power = 0;
int peltier = 3;
int peltier_level = map(power, 0, 99, 0, 255);

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);
DeviceAddress addr;

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup(void)
{

lcd.begin(16, 2);
Serial.begin(9600);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
pinMode(peltier, OUTPUT);

sensors.begin();
}

void loop(void)
{
Serial.print(“Requesting temperatures…”);
sensors.requestTemperatures();
Serial.println(“DONE”);

for (uint8_t s=0; s < sensors.getDeviceCount(); s++) {

lcd.print(" TEMP #"); lcd.print(s);
lcd.setCursor(14, 0);
lcd.setCursor(12, 1);

lcd.println(sensors.getTempCByIndex(s));
delay(1000);
if (sensors.getTempCByIndex(s) > 32)
{
lcd.setCursor(0 , 1);
lcd.print(“Warning! “);
digitalWrite(led, HIGH);
delay(500);
tone(buzzer, 500);
delay(500);
digitalWrite(led, LOW);
delay(500);
noTone(buzzer);
delay(500);
digitalWrite(led, HIGH);
delay(500);
tone(buzzer, 500);
delay(500);
digitalWrite(led, LOW);
delay(500);
noTone(buzzer);
delay(500);
digitalWrite(led, HIGH);
delay(500);
tone(buzzer, 500);
delay(500);
digitalWrite(led, LOW);
delay(500);
noTone(buzzer);
delay(500);
digitalWrite(led, HIGH);
delay(500);
tone(buzzer, 500);
delay(500);
digitalWrite(led, LOW);
delay(500);
noTone(buzzer);
delay(500);
}
else if (sensors.getTempCByIndex(s) < 30)
{
lcd.setCursor(0 , 1);
lcd.print(” #”);
}
if(Serial.available() > 0)
{
if(sensors.getTempCByIndex(s) > 32)
power += 5;
else if(sensors.getTempCByIndex(s) <28)
power -= 5;
if(power > 99) power = 99;
if(power < 0) power = 0;

peltier_level = map(power, 0, 99, 0, 255);
}
Serial.print(“Power=”);
Serial.print(power);
Serial.print(“PLevel=”);
Serial.print(peltier_level);
analogWrite(peltier, peltier_level);
}
}

What is the purpose of this line?

if(Serial.available() > 0)

Do you truly only want to control power to the peltier if there is incoming Serial data?

If you post code that's longer than a few lines, please use the code tags as explained in the post at the top of each Forum. (That will get you less complaints from People that usually want to help you.)

Why in the world did you hard code that Alarm that way? That hurts my eyes to even read. If my first Semester students tried that, they'd flunk the course.

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Did you write this code in stages, getting each stage to work before doing the next? 1) code for thermocouple, using monitor to check reading. 2) code LCD for hello world, then temp variables. 3) code for tone buzzer (use function ) 4) then get alarm working?

Have you a code that just reads the thermocouple? What thermocouple are you using?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks Tom.. :)