logo elektroda
logo elektroda
X
logo elektroda

TERMOSTAT program structure for ESP8266 in C++ with multiple sensors

Grzesiek_nowy 1605 8
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 18990400
    Grzesiek_nowy
    Level 11  
    Hello, I am writing a TERMOSTAT program for ESP8266 in C++. The assumption is that it is to handle several temperature sensors. Each sensor is one thermostat. The thermostats are to be quite advanced, i.e. I am to be able to define for each day of the week (Monday, Tuesday, Wednesday, etc.) several time thresholds (e.g. 6:00, 10:00, 15:30, etc.) and in each threshold define a different temperature (e.g. 6:00 - 20 deg C, 10:00 - 22 deg C, 15:30 - 24 deg C). For now, these are preliminary assumptions and I am wondering about the structure of the program. Should I use an array, a structure or maybe a class and invoke objects e.g. thermostat1, thermostat2, thermostat3 etc. which will contain the above assumptions. I can't really think of a program skeleton. It seems to me that classes would be best for this. Please give me some suggestions.
  • ADVERTISEMENT
  • #2 18990471
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #3 18990494
    Grzesiek_nowy
    Level 11  
    ESP8266 but written in C++ so could also be on AVR arduino. I am already correcting the title
  • ADVERTISEMENT
  • #4 18990518
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #5 18991407
    Grzesiek_nowy
    Level 11  
    I use Arduino as much as possible. I currently use VS Code + Platformio as an IDE. Reading from several DS18B20s is not a problem but I am thinking about a code in which for each sensor there will be a base in which the days of the week will be defined and for each day a schedule divided into say 6 time intervals with different temperatures for each interval. In addition each DS should have its own schedule settings. I am wondering about the way to save this data in the program. An array of ? (quantitative), Structure? Objects ?
  • #6 18991961
    Anonymous
    Level 1  
  • #7 18992040
    Grzesiek_nowy
    Level 11  
    Ok thanks for the hint. I am just starting to play with structures and objects. I'm maybe a bit more than a beginner - I've already written a program on ESP which is the gateway between my alarm and domoticz. Every second or so I use the MODBUS TCP protocol to ask my alarm (ROPAM) about the status of the inputs and outputs, then if anything has changed I send the status (JSON) to domoticz. I can also control certain outputs of the control panel from domoticz. There's also a simple server on ESP for configuration - assigning the right IDX to a specific control panel input or output (for domoticz). It works well for me, but when writing the program I was only using functions and I see a lot of potential in the structures.
    Can you provide an example of your solution?
  • #8 18992080
    Anonymous
    Level 1  
  • #9 18992190
    Grzesiek_nowy
    Level 11  
    OK. Thank you. I'm trying to analyse it but I don't think I have enough knowledge yet.

Topic summary

The discussion revolves around developing a TERMOSTAT program for the ESP8266 using C++, designed to manage multiple temperature sensors (DS18B20). The user seeks advice on structuring the program to accommodate advanced thermostat functionalities, including daily schedules with multiple time thresholds and corresponding temperature settings. Suggestions include using classes to represent each sensor and a controller object to manage reading schedules and actuator controls. The importance of user-friendly data management is emphasized, with recommendations to utilize structures for time intervals and temperatures, and arrays for organizing schedules. Examples of existing projects and resources for ESP8266 thermostat implementations are also shared.
Summary generated by the language model.
ADVERTISEMENT