Give alarm when reach specified temperature using PTC sensor

Need help please i have PTC sensor want to Give me alarm buzzer tone when reach specified temperature

Welcome to the forum

Which Arduino do you have ?
What have you tried so far ?

thanks dear i have Arduino nano
and i'm trying to make soldering station but found that sensor of it PTC not NTC
i only need code that make buzzer tone when actual temperature reach temperature i set

and what have you tried so far?

have you managed to read the sensor?

can you drive the buzzer on its own - separately to any temperature measurement?

That just means the the temperature coefficient is positive instead of negative - the principle of how to measure it remains the same.

i managed to monitor temperature but it's take about 3 minutes to reach temperature i set so i need when reach this temp give me tone

void loop() {
    
 Value = analogRead(PTC);
temp = map(analogRead(PTC), 0, 1024, 0, 1024);
Serial.println(temp);
SetPointERR= temp-160;
if(SetPointERR <SetPoint ){
  correction= (SetPoint-SetPointERR)*40;
  
}
if(SetPointERR >SetPoint ){
  correction =0;
  correction--;
}
if(correction<=0){
  correction=0;
}
if(correction>=255){
  correction=255;
}

Please post your full sketch and not just part of it

1 Like

Again, can you drive the buzzer on its own - separately to any temperature measurement?

Once you have those pieces working separately, then think about how to bring them together ...

What's the point of this:

You set the correction to zero, then immediately decrement it by 1.

So why not just set it to -1 ?

But then the very next thing is:

So, if it was -1, that will immediately set it back to zero!!

1 Like

This does nothing useful:
temp = map(analogRead(PTC), 0, 1024, 0, 1024);

Please post a link to your temperature sensor, and a wiring diagram.

1 Like
#include <EEPROM.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int ADDR= 0;
int PTC= A0;
int Value;
int temp;
int tempERR;
int SetPointERR;
const int set_up=5;
const int set_down=4;
int SetPoint = 200;
int correction;
int PumpSW=6;
int Pump= 7;
int PWM_pin;
int melody=9;

uint8_t smile[8] = {0x00, 0x0A ,0x00, 0x00, 0x11, 0x0E, 0x00};




void setup() {
  lcd.begin();
  lcd.backlight();
  lcd.clear();
  Serial.begin(9600 );
SetPoint = EEPROM.read(0)*10;
 pinMode(PWM_pin,OUTPUT);
                                            
  pinMode(PTC, INPUT);
  pinMode (set_up, INPUT_PULLUP);
  pinMode (set_down, INPUT_PULLUP);
  pinMode(PumpSW,INPUT_PULLUP);
  pinMode(Pump,OUTPUT);

  digitalWrite (Pump,LOW);
 

lcd.setCursor(1,0);

lcd.print("Booting...!!");

tone(9,200);
 delay(100);
      tone(9,300);
 delay(100);
      tone(9,400);
 delay(100);
      tone(9,500);
delay(100);
      tone(9,600);
delay(100);
       tone(9,500);
delay(100);
    tone(9,400);
delay(100);
    tone(9,300);
delay(100);

 tone(9,250);
delay(300);
noTone(9);
delay(100);
tone(9,250);
delay(100);
noTone(9);
delay(100);
tone(9,400);
delay(500);

noTone(9);
   lcd.clear(); 

  
}

void loop() {
    
 Value = analogRead(PTC);
temp = map(analogRead(PTC), 0, 1024, 0, 1024);
Serial.println(temp);
SetPointERR= temp-160;
if(SetPointERR <SetPoint ){
  correction= (SetPoint-SetPointERR)*40;
  
}
if(SetPointERR >SetPoint ){
  correction =0;
  correction--;
}
if(correction<=0){
  correction=0;
}
if(correction>=255){
  correction=255;
}
 analogWrite(3,correction); 
 Serial.println(correction);

lcd.setCursor(0,0);
lcd.print("Set:");
lcd.setCursor(0,1);
lcd.print(SetPoint);

 

  lcd.setCursor(5,0);
  lcd.print("Temp:");
  lcd.setCursor(5,1);
  lcd.print(temp-160);
  lcd.print("C");

  lcd.setCursor(12,0);
 lcd.print("PUMP"); 

 
  
  
if (digitalRead(set_down)==LOW){
  if(SetPoint>0){
    SetPoint--;
    tone(9,350);
    EEPROM.write(0, SetPoint/10);
    delay(10);
    noTone(9);
  }
}

if (digitalRead(set_up)==LOW){
  if(SetPoint<400){
    SetPoint++;
     tone(9,400);
     EEPROM.write(0, SetPoint/10);
     delay(10);
    noTone(9);
  }
}

  if (digitalRead(PumpSW)==LOW){
    digitalWrite( Pump,HIGH);
 lcd.setCursor(12,1);
 lcd.print("ON");
 lcd.write(0);
  delay(80);
   
  }
  else {
    digitalWrite(Pump,LOW);
 lcd.setCursor(12,1);
 lcd.print("OFF");
  delay(80);
  }
}

full sketch

i'm noob in coding still learning

pdf not have a lot information about sensor but i checked it sensor that PTC not NTC

and still not draw schematic.

actually i'm not write this code my friend wrote it but for some reason i can't reach him now

Not surprising - they're not intending that you build your own controller!

You'll just have to measure it to find out what the resistance is at your points of interest.

not to hard to identify pins. i only need when temperature reached 250C. the buzzer make tone

So measure the resistance at 250C - that's the point you need to turn the buzzer on.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.