A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By Kyle1987
#92592 Brief

It is known that the cooling machine is widely used in industry. In this paper, I will show you how to use stone HMI LCD as the display to combine the temperature sensor with esp8266 and use it in cooler application; the communication between temperature sensor and esp8266 is realized by single line communication, and the communication mode between esp8266 and stone intelligent display is serial communication.

This time, the function of the cooler is divided into automatic mode and manual mode. In the automatic mode, the temperature threshold can be set on the stone TFT LCD screen. We can obtain the current ambient temperature through the DS18B20 sensor, and then compare with the set temperature threshold. When it is higher than the current ambient temperature range, esp8266 starts the stepper motor as a cooling function, and we can also stop the cooling through the stop button; in the manual mode, we can use the stone TFT The LCD directly sets the rotation speed and rotation times of the cooling motor. After the setting is completed, click the start button. Similarly, you can click the stop button to stop in advance.

Device list

1. DS18B20*1;
2. ESP8266 module * 1;
3. LED lamp * 3;
4. Stepper motor * 1;
5. Stone TFT LCD screen * 1.

GUI design

STONE-LCD-Arduino-ESP8266-Cooler (2).jpg


Connection

STONE-LCD-Arduino-ESP8266-Cooler (3).jpg


Code

Code: Select allif(dataflag == true)
  {
    if(datalen == 13)
    {
        memset(RecievedTemp, 0 , 13);
        for(cout_i = 0; cout_i < 13; cout_i ++)
        {
          RecievedTemp[cout_i] = Serial.read();
        }
        Serial.write(RecievedTemp, 13);
        memset(RecievedTemp, 0 , 13);
        dataflag = false;
    }       
  }
  else if(datalen == 9)
  {
    memset(RecievedTemp, 0 , 9);
    for(cout_i = 0; cout_i < 9; cout_i ++)
    {
      RecievedTemp[cout_i] = Serial.read();
    }
      Serial.write(RecievedTemp, 9);
    switch(RecievedTemp[5])
    {
    case 0x39://temp
      if(HeadStepper.isRunning() == true)
      {

        HeadStepper.stop();   
      }
    StepperStart = false;
//    TempStartStop = true;
    Temperatue = RecievedTemp[8];
      break;
    case 0x2B://temp start
      TempStartStop = true;
      StepperStart = false;
//        HeadStepper_Setting_Run(speed_str[0], 5);
    break;
    case 0x2A://temp stop
      if(HeadStepper.isRunning() == true)
      {
        HeadStepper.stop(); 
      }
      TempStartStop = false;
      StepperStart = false;
//      terstop = true;
    break;
    case 0x2E://mode gear
        if(HeadStepper.isRunning() == true)
      {
        HeadStepper.stop(); 
      }
        settingbuf[0] = speed_str[RecievedTemp[8]];
        if(RecievedTemp[8] == 3)
      {
      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)
      digitalWrite(ledPin_2, HIGH);   // turn the LED on (HIGH is the voltage level)
      digitalWrite(ledPin_3, HIGH);   // turn the LED on (HIGH is the voltage level)
      }
      else if(RecievedTemp[8] == 2)
      {
      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)
      digitalWrite(ledPin_2, LOW);   // turn the LED on (HIGH is the voltage level)
      digitalWrite(ledPin_3, HIGH);   // turn the LED on (HIGH is the voltage level)
      }
      else
      {
      digitalWrite(ledPin_1, LOW);   // turn the LED on (HIGH is the voltage level)
      digitalWrite(ledPin_2, LOW);   // turn the LED on (HIGH is the voltage level)
      digitalWrite(ledPin_3, LOW);   // turn the LED on (HIGH is the voltage level)
      }
      break;
    case 0x34://mode timing
      if(HeadStepper.isRunning() == true)
      {
        HeadStepper.stop(); 
      }
     
        settingbuf[1] = RecievedTemp[8];
        break;
    case 0x2C://mode start
      if(settingbuf[1] == 0)
      {
        settingbuf[1] = 5;
      }
      TempStartStop = false;
      StepperStart = true;
      HeadStepper_Setting_Run(settingbuf[0], settingbuf[1]);
        break;
    case 0x2D://mode stop
      if(HeadStepper.isRunning() == true)
      {
        TempStartStop = false;
        StepperStart = false;
        HeadStepper.stop();   
      }
        break;
    default:
        break;
    }
   }


Result effect

STONE-LCD-Arduino-ESP8266-Cooler (31).jpg
You do not have the required permissions to view the files attached to this post.