Total Pageviews

Wednesday, May 20, 2015

Arduino thermostat on 7-segment LED display

   I designed a thermostat with few components using an Arduino board.
   I use LM35DZ for temperture sensor, KW4-563ASA display (4 digit 7-segment with common anode), RGB led, 3 button (push button) for select and change the value for desired temperature and for hysteresis.
   I designed this schematic:
who is used also for an thermostat with 2 thesholds (must change the sketch).
   If measured temperature is less than desired temperture, blue led is on:
and if is to much, red led is on:
   If I push the MENU buton, display is change in:
(in right side, is "c" instead "C"). 
   If I push "-" button, temperature value decrease with 0.1 degree Celsius for each push, if I push "+" button, temperature increase with 0,1 degree Celsius for each push.
   After that, if I push again MENU button, I will see:
and I can change the value with 0.1 degree, like at desired temperature.
   Values for desired temperature and hysteresis are write and stored in internal EEPROM memory of microcontroler (any Arduno board has an microcontroller on it.)
   For easy understund this, I made a movie named Arduino thermostat
   Skech for this thermostat is put on !!!

PS:  Fist time when upload the sketch, must write default value for desired temprature and hysteresis:
after that, must comment the 3 lines:
   Actual sketch work with Arduino Uno board and you can see:
but for work with Arduino Mega board you must comment first line and uncomment second line:
PS2: If you want to connect a relay for control a heater system, subroutine leduri() must be changed in:
void leduri() {
 digitalWrite(CALD, LOW);
 digitalWrite(RECE, LOW);

if ( t0*10 < tset ) 
{  digitalWrite(RECE, HIGH);
   digitalWrite(CALD, LOW);
   pornire = 1;
if ( t0*10 > tset + dt ) 
{  digitalWrite(CALD, HIGH);
   digitalWrite(RECE, LOW);
   pornire = 0;

if (( t0*10 <= tset+dt ) && ( t0*10 >= tset )) {
if (pornire == 1)
{  digitalWrite(CALD, LOW);
   digitalWrite(RECE, HIGH);
if (pornire == 0)
{  digitalWrite(CALD, LOW);
   digitalWrite(RECE, LOW);
and at begin of sketch must define int pornire; and in setup must put pornire = 0; !!
   You can download changed sketch from
   In movie namend Arduino thermostat (2) you can see the changed style, like usual thermostat for a heater:


  1. Really fascinated article. Thanks for spreading the knowledge.

    Heating and Cooling Mississauga

  2. This comment has been removed by a blog administrator.

  3. Hello very dear Nicu,

    I participate from France and thank you for all your beautiful share, you are a genius nothing to say, thank you very much for all this extraordinary sharing.

    As I make cheese at home, I need to control a refrigerator without a freezer to refine the cheese, I wanted to use Arduino system to control humidity and temperature of the fridge.

    My project is to use a Keypad Shield 1602 with 5 + reset buttons, an arduino uno or mega, a DHT22 and a relay module 2 outputs one for the temperature and one for the humidifier but as I am a beginner in the field Arduino I instruct me with you.

    Thank you with all my heart for your instructions, I respect you. Very good continuation.

  4. Hi,

    I'm very bussy now, but see project from
    In project it used LCD1602 and 3 buttons... sensist is AM2302 (DHT22)
    In article from it used DHT22 or DHT11 for humidity and DS18B20 for temperature measurements

  5. Good afternoon.

    In the sketch error. ???????

    Добрый день.
    Вроде тут ошибка ???


    if (meniu == 0) {
    int numara = 0;
    while (meniu == 0) {
    numara = numara + 1;
    if (numara == 1000)
    // float t = analogRead(LMPIN);
    // float t0 = t *500 / 1023;

    citire(); ??????????????????

    t0 = (t0 + t2) /2;
    // delay(5);
    numara = 0;
    Serial.print("t = ");
    // displayNumber(t0*10); // this is number to diplay
    te(t0*10); // this is number to diplay
    t2 = t0;
    if (digitalRead(BUT3) == LOW)
    { meniu = 1;
    //Serial.print("t = ");

    Good afternoon.
    In the sketch error. ???????

    Добрый день.
    Вроде тут ошибка ???

  6. when download sketck from not use translate because can be replace good character

  7. ПРИВЕТ.

  8. These tips are kinda useful.Heating and Cooling Toronto Some people tends to call technicians just before watching for themselves.


  9. Hello!

    I definitely think that this should be well thought out and done in a smart way, it is important to get out there and market your business.

    This is a great information and examples, thanks for sharing!

    PCAP Touch Screen

  10. Thank you so much for everything you do.
    Transport fans

  11. Hi
    Please insert this project with ds18b20 sensor

    1. you can try yourself... you must add DS18B20 temperature reading and remove for LM35 measurement

  12. This article covers a lot more updates from south Carolina. The temperatures there varies a lot.