In the third part of the barometer project, the AZ-Atmega328 microcontroller is replaced by an ESP-32 Dev Kit C V4 and another display is added that shows the condition of the sky depending on the air pressure with three images: rain, sun and clouds, the day of the week and the date, as well as the moon phase.
A large part of the code that in Part 2 the project was analyzed is still valid because the other three displays still display the same data. If you add another display and change the microcontroller, you have to add code with new variables and change the connection ports to the new microcontroller.
At the end of the project, the entire assembly is installed in a box made of wooden boards in a vintage look, in which the dial of the watch is located at the top, including the dial with the date, the third dial shows the data of the temperature and the air humidity in the area and the fourth and last digging leaf the air pressure. Let's start with the hardware for this part.
Used hardware
- 1 ESP-32 Dev Kit C V4
- 4 GC9A01 1.28 inch round LCD-TFT display
- 1 DHT22 AM2302 Temperature sensor and air humidity sensor compatible with circuit board and cable
- 1 GY-68 BMP180 barometric air pressure and temperature sensor
- 1 Real Time Clock RTC DS3231 I2C real -time clock
- 1 MB102 Breadboard Power supply Power Supply module 3.3V/5V
- 1 PCB Board Set Lochrasterplainen
- Jumper Wire Kabel 40 pc. 20 cm m2m male to times each
- Box strips - 40 pins
- Pin strips header
- Shrink hose range
- Ultra -lexified tinned silicone cable switching loads kit
- Wooden plates
Required software, libraries and sketch
- Arduino id
- Wire library (wire.h, this library is included in the Arduino IDE)
- Spi library (Spi.H, this library is included in the Arduino IDE)
- Adafruit GC9A01A library (about the board administrator, Arduino Adafruit_gc9a01a.h)
- BMP180 library (Download of the library from AZ-Delivery)
- Rtclib.h library (Adrafruit/rtclib.h)
- Dht.h library (Adafruit/DHT sensor-library)
- electronics_vintage_weather_station.ino
Circuit and description of the modules used

Drawing of the components



The electrical system is transferred from the breakboard to the hole grid boards and inserted into the housing.









Analysis of the sketch
If you have not yet used an ESP microcontroller with the Arduino IDE, you must install the ESP Core and possibly also drivers.
This Instructions can help you.
As soon as everything is installed, you can select an ESP-32 in the menu under “Board”.
No further libraries are integrated in this third part of the project. The in Part 2 used are sufficient.
The connections from the microcontroller pins to the TFT display pins are not the same, so that the numerical values in the variable definitions must be changed. Two code lines are added to a new variable for the additional display with #define tft_cs_calendar 27 and a variable for the connection to the RST pin of the displays #define tft_rst 26.
#define TFT_DC 16
#define tft_cs_pressure 33
#define tft_cs_clock 25
#define tft_cs_temperature 32
#define tft_cs_calendar 27
#define tft_rst 26
An object must be created for the new screen. The new code line is included at the end of the object for the screens Adafruit_gc9a01a tft_calendar (tft_cs_calendar, tft_dc) added.
Adafruit_gc9a01a tft_Pressure (tft_cs_pressure, tft_dc);
Adafruit_gc9a01a tft_clock (tft_cs_clock, tft_dc);
Adafruit_gc9a01a tft_tememperature (tft_cs_temperature, tft_dc);
Adafruit_gc9a01a tft_calendar (tft_cs_calendar, tft_dc);
We add another color to the four basic colors for the elements of the displays used in Part 2, namely gray. We add the line #define Gray 0x4a49 According to the lines that define the four colors already defined above. The value is specified in the Code RGB565. The value of each color can be under http://rinkydinkelectronics.com/calc_rgb565.php be viewed.
#define Black 0x0000
#define Blue 0x001f
#define Red 0xf800
#define White 0xffff
#define Gray 0x4a49
Nothing is changed in the two essential variables to calculate the coordinates of the values on the value scale and the position of the pointer to display the value.
#define DEG_TO_RAD 0.0174532925
float pi = 3.1415926535;
The definitions of all variables and the DHT22 sensor object are the same as in part 2, only the number of the pin of the ESP32 microcontroller to which the data PIN of the DHT22 module is connected must be changed. The change is in the line #define dht_pin 4 made. The new pin is No. 4. Everything else remains as usual.
#define dht_pin 4
#define DHT_TYPE DHT22
Dht dht (dht_pin, dht_type);
float Humi;
float Temp;
intimately Center_x_T temperature = 149;
intimately Center_y_Temperature = 150;
intimately Center_x_humidity = 89;
intimately Center_y_humidity = 150;
float pivot_x_t temperature, pivot_y_t temperature, pivot_x_temperature_old, pivot_temperature_y_old;
float P1_X_T temperature, P1_Y_T temperature, p2_x_t temperature, p2_y_t temperature, p3_x_t temperature, p3_y_temperature;
float p1_x_old_temperature, P1_Y_OLD_T Temperature, p2_x_old_temperature, p2_y_old_temperature, p3_x_old_temperature, p3_y_old_temperature;
float arc_x_temperature;
float arc_y_temperature;
float needleangle_temperature = 0;
float Temperature;
float needle_setter_temperature;
float pivot_x_humidity, pivot_y_humidity, pivot_x_humidity_old, pivot_humidity_y_old;
float p4_x_humidity, p4_y_humidity, P5_X_HUMITITY, p5_y_humidity, p6_x_humidity, p6_y_humidity;
float p4_x_old_humidity, p4_y_old_humidity, p5_x_old_humidity, p5_y_old_humidity, p6_x_old_humidity, P6_Y_OLD_HUMITITY;
float arc_x_humdity;
float arc_y_humdity;
float needleangle_humidity = 0;
float humidity;
float needle_setter_humatity;
intimately Radius_T temperature = 100;
The variable definitions for the barometer module BMP180 and the object implementation for the module are unchanged, the variable names and values are the same.
BMP180 BMP180;
float Pressu;
intimately Center_x_Pressure = 120;
intimately Center_y_Pressure = 120;
float pivot_x_pressure, pivot_y_pressure, pivot_x_old_pressure, pivot_y_old_pressure;
float P1_X_Pressure, P1_y_Pressure, P2_X_Pressure, P2_y_Pressure, P3_X_Pressure, P3_Y_Pressure;
float p1_x_old_Pressure, p1_y_old_Pressure, p2_x_old_pressure, p2_y_old_Pressure, p3_x_old_Pressure, p3_y_old_Pressure;
float arc_x_pressure;
float arc_y_pressure;
intimately Radius_Pressure = 65;
float needleangle_pressure = 0;
float Needle_setter_Pressure;
intimately pressure_scale;
intimately pressure_module_calibration = 140;
Since a new screen has been added, which shows the weekday, the date and the moon phase, a new array must be defined and the data of the array "weekly days" must be changed. Since the day of the week and the date on the screen are displayed in the same line, it is not possible due to the pixel spacing to display the names of the weekly days with all letters in the line. Therefore they are abbreviated and the new code line is char DaysoftheWeek [7] [9] = {"Sun.", "Mon.", "Tues.", "Wed.", "Thurs.", "Fri.", "Sat."}. With the line Int Daysinmonth [] = {0, 31, 28, 31, 31, 30, 31, 30, 30, 31, 31, 31, 31, 30, 31, 30, 31, 30, 31} A new array is also added, which contains the number of days that has every month of the year and is later used to represent the moon phase.
Rtc_ds3231 rtc;
char DaysoftheWeek [7] [9] = {"Sun.", "Mon.", "Do it.", "Wed.", "Thurs.", "Fri.", "Sat."}
intimately Daysinmonth [] = {0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31};
With the variables of the RTC DS3231 module, the three variables defined in part 2 remain unchanged for storing the hours and minutes, but new variables of the type intimately added to the day (Date_D), the month (Date_m) and the current year (Date_y) to save, as well as the past few days with Past_days and the past few days since January 1, 2024 with the variables Total_past_days. The last defined variables are also used when calculating the moon phase.
float time_h;
float time_m;
float time_m_old;
intimately date_d;
intimately date_m;
intimately Date_y;
intimately Past_days;
intimately Total_past_days;
The variables for displaying the watch on the dial are the same as in part 2, nothing changes.
intimately Center_x_clock = 120;
intimately Center_y_clock = 120;
float pivot_x_clock, pivot_y_clock, pivot_x_old_clock, pivot_y_old_clock;
float P1_x_clock, p1_y_clock, p2_x_clock, p2_y_clock, p3_x_clock, p3_y_clock;
float p1_x_old_clock, p1_y_old_clock, p2_x_old_clock, p2_y_old_clock, p3_x_old_clock, p3_y_old_clock;
float p4_x_clock, p4_y_clock, p5_x_clock, p5_y_clock, p6_x_clock, p6_y_clock;
float p4_x_old_clock, p4_y_old_clock, p5_x_old_clock, p5_y_old_clock, p6_x_old_clock, p6_y_old_clock;
float arc_x_clock;
float arc_y_clock;
intimately Radius_clock = 72;
float needleangle_hours_clock = 0;
float needleangle_minutes_clock = 0;
float Hours_dial;
float minutes_dial;
float needle_setter_hours_clock;
float needle_setter_minutes_clock;
Three new variables are added to the fourth screen for displaying the date. It is a matter of Arraysthat contain the signs that are to be displayed on the screen. The names of the Arrays are easy to assign.
char Actual_day [2];
char actual_month [2];
char Actual_year [4];
In the variable definition block, four variables are declared, which are used when calculating the moon phase to be displayed on the screen. The variable new_moon_period = 29.5 Saves the number of days between the newondens, whereby this number of days is always the same. The next variable, first_day_new_moon_2024 = 10, the number of days has been saved since January 1, 2024 for the first new moon of the year. In the variable next_day_new_moon the number of days is saved that pass from the last new moon to the next new moon and in the variables Past_day_new_moon the number of days that has passed since the last new moon is saved.
float new_moon_period = 29.5;
float first_day_new_moon_2024 = 10;
float next_day_new_moon;
float past_day_new_moon;
It continues with the method set up(). The first thing that is done in this method is the initialization of the serial interface for output on the serial monitor and sending the initialization message for screens and sensors.
Serial.Begin(115200);
Serial.print("Initialization of the Set of Sensors and Displays.");
This is followed by the configuration of the microcontroller pins, to which the display pins and the DHT22 module are connected. The pins to which the TFT display pins are connected must be configured as an output, while the PIN on which the DHT22 module is connected is configured as an input.
pin mode(TFT_DC, OUTPUT);
pin mode(tft_cs_pressure, OUTPUT);
pin mode(tft_cs_clock, OUTPUT);
pin mode(tft_cs_temperature, OUTPUT);
pin mode(tft_cs_calendar, OUTPUT);
pin mode(dht_pin, Input);
The first screen is used by the method Begin() Initialized the object created, which shows the temperature and humidity data. Nothing has changed in the initialization of the variables of this screen compared to part 2.
TFT_T temperature.Begin();
TFT_T temperature.setrotation(0);
TFT_T temperature.Fillscreen(White);
pivot_x_t temperature = center_x_temperature;
pivot_y_t temperature = center_y_temperature;
p1_x_old_temperature = center_x_temperature; P1_Y_OLD_T Temperature = center_y_temperature;
p2_x_old_temperature = center_x_temperature; p2_y_old_temperature = center_y_temperature;
p3_x_old_temperature = center_x_temperature; p3_y_old_temperature = center_y_temperature;
pivot_x_humidity = Center_x_humidity;
pivot_y_humidity = Center_y_humidity;
p4_x_old_humidity = Center_x_humidity; p4_y_old_humidity = Center_y_humidity;
p5_x_old_humidity = Center_x_humidity; p5_y_old_humidity = Center_y_humidity;
p6_x_old_humidity = Center_x_humidity; p6_y_old_humidity = Center_y_humidity;
CREATE_DIAL_T Temperature ();
draw_pivot_temperature ();
draw_pivot_humatity ();
The calls of the methods CREATE_DIAL_T Temperature () , draw_pivot_temperature () and draw_pivot_humidity () are for the representation of the scales of the temperature and humidity values, as well as the circles in which the hands move to mark the values of the DHT22 module. They have already been analyzed in part 2 and are exactly the same.
At this point, the screens for temperature and humidity are already initialized and the value scales for these two sizes are displayed. The next screens that need to be initialized are those for the air pressure value and the clock. As in part 2, this also remains unchanged.
The fourth screen will not be a scale, but only two pictures and a line with signs. First the method becomes Begin() of tft_calendar objects Called, the screen is not turned and the screen background is placed on black.
tft_calendar.Begin();
tft_calendar.setrotation (0);
tft_calendar.Fillscreen (Black);
After initialization of the four screens, the three sensor modules are initialized as in part 2.
dht.Begin();
BMP180.init();
Serial.print("BMP180 Init");
IF (!BMP180.hasvalidide()) {
Serial.print("Error - Please Check the BMP180 Board!");
}
RTC.Begin();
RTC.carnival(DateTime(F (__Date__), F (__Time__)));
// rtc.adjust (DateTime (2024, 9, 1, 0, 33, 0));
Now it continues with the loop()-Method that is continuously executed. The code of this method is exactly the same as in part 2 of the project.
DateTime snow =RTC.snow();
time_h = snow.house();
time_m = snow.minute();
time_h = time_h + (Time_m/60);
Serial.print(Time_H);
Serial.print(Time_m);
IF (Time_m != time_m_old) {
refresh_screens ();
} Else { }
If the method refresh_screens () If it reads the size values from the sensors, stores the value in the corresponding variables, copies the data values into the variables for the pointers and calls on the corresponding methods to change the positions of the pointers. The code for these three screens is the same as in part 2, just a call of the method draw_pivot Each screen has been inserted to update the representation of the circle of the rotary axis of the needles and to avoid the lack of colors in parts when the hands change their position.
The fourth screen shows the condition of the sky through an image according to the atmospheric pressure, the day of the week and the date with signs and the moon phase with an image.
First of all, the snow()-Method of the DS3231 module object called. This gives the information about the current time and the current date in order to then display it on the screen. To get the current day, the function becomes now.day() used and their value in the variable Date_ D saved, the function Now.month() is used to maintain the current month and in the variable Date_m saved. The function now.year() the current year returns that in the variable Date_y is saved.
DateTime snow =RTC.snow();
Date_D = snow.day();
Date_m = snow.Month();
Date_y = snow.year();
The background of this screen is black because both the pictures and the characters are shown in white. The background color of the screen is configured with the following line.
tft_calendar.Fillscreen(Black);
The next four lines configure the legend at the top of the screen. With the function SettextColor (White) the white color of the text is set with the function SettextSize (2) the text size is set to 2, the text is on the MIT setcursor (93, 4) Missioned coordinates displayed and the text to be displayed is with the function print ("Today") output.
tft_calendar.SettextColor (White);
tft_calendar.SettextSize (2);
tft_calendar.setcursor (93, 4);
To get the weekday, the function calls Println (DaysoftheWeek [now.dayoftheWeek()]) the weekday in the array, in which the abbreviations of the days of the week are stored. The module configured the days of the week as numbers, e.g. B. is the day 0 of the week on Sunday. If the call is made, the suitable number is returned as an index for the array and the text is displayed on the screen. The coordinates are again with the function setcursor (20, 112), the color of the text with the function SettextColor (White) and the size of the text with the function SettextSize (2) fixed.
tft_calendar.setcursor(20, 112);
tft_calendar.SettextColor(White);
tft_calendar.SettextSize(2);
tft_calendar.print(DaysoftheWeek [snow.DayoftheWeek()]);
A comma is used for the separation between the weekday and date, the functions for displaying on the screen are similar to the above.
tft_calendar.SettextColor (White);
tft_calendar.SettextSize (2);
tft_calendar.setcursor (97, 114);
tft_calendar.print (",");
The information of the first nine days of the month and the first nine months of the year that the RTC DS3231 module sends have only one digit, while the remaining days and months have two digits. If they were shown on the screen as they are read out, they would be at the first of two positions, with an empty space to the hyphen of the separation between days and months. The number is converted into text and it is converted into a string. A 0 is preceded by this string chain (chained). Thus the text then has two characters and the display on the screen is correct.
If the value of the variable is less than 10, the first thing is the numerical value with String(Date_D) converted into text and this text is in the variable Convert_Day saved, that of the text text String is. The sign will be on the previous variable 0 (Zero) attached to the stored text, this happens with the code line convert_day = '0' + Convert_Day, with which we already have a string of 2 characters. The content of the variables is in an array of the type of 3 elements and the name Actual_Day With the line Convert_Day.tokhar marray(Actual_Day, 3) saved. Now only the data must be displayed on the screen and the necessary functions have to be implemented in order to use the cursor setcursor(112, 112) to place on the right coordinates, the text color with SettextColor(White) to select the font size with tft_calendar.SettextSize(2) to put on 2 and finally the content of the sign array with print(actual_day) To display what the current day on the screen is depicted.
IF (Date_D < 10) {
String Convert_Day = String(Date_D);
Convert_Day = '0' + Convert_Day;
Convert_Day.tokhar marray(Actual_Day, 3);
tft_calendar.setcursor(112, 112);
tft_calendar.SettextColor(White);
tft_calendar.SettextSize(2);
tft_calendar.print(actual_day);
}
However, if the number is larger or equal to 10, the Else block executed. Here only the line was removed, in which a sign is attached to the variable that contains the value handed over to text.
This passage could still be simplified by only writing the chain with the ‘0’ in an IF statement.
Else {
String Convert_Day = String(Date_D);
Convert_Day.tokhar marray(Actual_Day, 3);
tft_calendar.setcursor(112, 112);
tft_calendar.SettextColor(White);
tft_calendar.SettextSize(2);
tft_calendar.print(actual_day);
}
For the separation between the days, months and the year, I chose two small lines as a hyphen so that they are better visible than a single line or the sign ’. In the arguments, the coordinates must be handed over for the beginning and the end of the line and the color of the line.
tft_calendar.drawline (139, 118, 144, 118, White);
tft_calendar.drawline (139, 119, 144, 119, White);
In order to display the current month on the screen, the functions are the same as for the display of the days, only the variable names have to be changed to refer to the months and the coordinates of the screen where the text is to be displayed. A hyphen is also displayed on the screen to separate the months of the year.
IF (Date_m < 10) {
String convert_month = String(Date_m);
convert_month = '0' + convert_month;
convert_month.tokhar marray(actual_month, 3);
tft_calendar.setcursor(150, 112);
tft_calendar.SettextColor(White);
tft_calendar.SettextSize(2);
tft_calendar.print(actual_month);
} Else {
String convert_month = String(Date_m);
convert_month.tokhar marray(actual_month, 3);
tft_calendar.setcursor(150, 112);
tft_calendar.SettextColor(White);
tft_calendar.SettextSize(2);
tft_calendar.print(actual_month);
}
tft_calendar.drawline (177, 118, 182, 118, White);
tft_calendar.drawline (177, 119, 182, 119, White);
To display the year on the screen, there is no problem with the number of characters because it will always be 4. The functions for the output are the same as those of those described above. Only the names of the variables, the array and the output coordinates are changed.
String convert_year = String(Date_y);
convert_year.tokhar marray(actual_year, 5);
tft_calendar.setcursor(188, 112);
tft_calendar.SettextColor(White);
tft_calendar.SettextSize(2);
tft_calendar.print(actual_year);
In order to display the image of the moon phase, we use a gray circle for the new moon, a white for the full moon and for the increasing and decreasing phase two mutants on top of each other, a white one first and a black one, so that the black circle "wipes out" the overlap with the white circle. In addition, four pictures of every increasing and decreasing phase are used. As you may remember, the time span between the Neumonden is 29.5 days, the first new moon of 2024 took place on January 10th, i.e. on the tenth day of the year and if we know the total number of days that have passed since the first new moon, we can calculate the status of the moon phase.
In order to calculate the days that have passed since January 1, 2024, the method was called up Days_From_2024 (Date_y, Date_M, Date_D) Created, which receives the current day, the month and the year as a parameter and returns the number of days that have passed in the variable Total_past_days of the type intimately be saved. The value of the variables is displayed by the serial monitor.
intimately total_past_days = Days_From_2024 (Date_y, Date_M, Date_D);
Serial.print("Days Beat January 1, 2024:");
Serial.println(total_past_days);

When calling the method intimately Days_From_2024 (intimately Date_y, intimately date_m, intimately date_d) The current year, the month and the day are received for the calculation of the overall days. Then the first condition is carried out if the year is the same or larger than 2024. If this is the case, the year 2024 is subtracted from the current year, the result in turn in the annual variables Date_y -= 2024 saved and displayed by the serial monitor.
intimately Days_From_2024 (intimately Date_y, intimately Date_m, intimately date_d) {
IF (Date_y >= 2024) {
Date_y -= 2024;
Serial.print("Past Years:");
Serial.print(Date_y);
}
The received days are in the variable Past_days = date_d Stored, your value is also displayed by the serial monitor.
Past_days = date_d;
Serial.print("Days Gone:");
Serial.print(Past_days);
In order to calculate the number of the past few days of the months, a loop is implemented that counts the number of days of each past month, whereby the counter as the maximum value has the month before the current C <date_m. The counted days of each month become variables Past_days added. The array Daysinmonth [C] contains the number of days that has every month, the counter Cthat is handed over, the index is in the array for the month. Position 0 has the value of 0 days. Since the first month of the year has number 1, the counter begins with position 1 of the array.
for (byte C = 1; C < date_m; C = C + 1) {
Past_days = Past_days + Daysinmonth [C];
Serial.print("Days Gone by Months:");
Serial.print(Past_days);
}
If the current year is a leap year, an additional day must be added for the month of February. This happens under the conditions that the current month is larger than the month 2 of the year, and the rest must also be 0 if you share the year by 4. Then a day becomes a variable Past_days added.
IF (Date_m > 2 && Date_y % 4 == 0) {
Past_days = Past_days + 1;
Serial.print("Days Passed by Leap Year:");
Serial.print(Past_days);
}
So far we have calculated the number of days that have passed in the current year, now we have to calculate the number of days that have passed since January 1, 2024. To do this, we add up to the number of days that have passed in the current year (Past_days), the number of days each year since 2024 (365 * date_y), we add another day for every leap year that has passed since 2024 ((Date_Y + 3) / 4) And with the -1 Let's pull the current day off. The total number of the days is in the variable Past_days saved.
return Past_days = Past_days + (365 * Date_y) + (Date_y + 3) / 4 - 1;
Serial.print("Total Days Spent:");
Serial.print(Past_days);
The number of the entire days is with return Past_days To the call from the line intimately total_past_days = Days_From_2024 (date_y, date_m, date_d) returned.
The full code of the method for calculating the number of recent days is:
intimately Days_From_2024 (intimately Date_y, intimately Date_m, intimately date_d) {
IF (Date_y >= 2024) {
Serial.print("Past Years:");
Serial.print(Date_y);
}
Serial.print("Days Gone:");
Serial.print(Past_days);
for (byte C = 1; C < date_m; C = C + 1) {
Past_days = Past_days + Daysinmonth [C];
Serial.print("Days Gone by Months:");
Serial.print(Past_days);
}
IF (Date_m > 2 && Date_y % 4 == 0) {
Past_days = Past_days + 1;
Serial.print("Days Passed by Leap Year:");
Serial.print(Past_days);
}
return Past_days = Past_days + (365 * Date_y) + (Date_y + 3) / 4 - 1;
Serial.print("Total Days Spent:");
Serial.print(Past_days);
}
With the number of days since January 1, 2024, the current moon phase is calculated by the first new dond day of 2024 in the variable next_day_new_moon is saved.
next_day_new_moon = first_day_new_moon_2024;
In order to know what period of 29.5 days you are, one While loop implemented. As long as the variable Total_past_days a greater value than the variable next_day_new_moon this means that you are not located in the period of 29.5 days of the current moon phase, the value of the variables new_moon_period is added to this last variable and the comparison is carried out again until its value is greater than the value of the variable Total_past_days.
while (Total_past_days > next_day_new_moon) {
next_day_new_moon += new_moon_period;
Serial.print("Next Day Moon:");
Serial.print(next_day_new_moon);
}
When the loop is abandoned because the value of the variables next_day_new_moon is larger, the value of the variables Total_past_days subtracted. The result of the subtraction is the number of days that have passed since the last new moon. The value is in the variable state_moon saved.
float state_moon = next_day_new_moon - Total_past_days;
To display a picture of the moon phase on the screen, conditions are on the variable state_moon linked. If the value of the variables lies between the specified values, the IF statement is executed. A white circle is also shown with a radius of 30 pixels on the coordinates X = 120 and y = 180.
IF (State_moon <= 15.5 && state_moon >= 14.5) {
Serial.print("Today is a full moon.");
tft_calendar.Fillcircle (120, 180, 30, White);
}
For the adding and decreasing moon phases, a white circle and then a black circle are first portrayed, the latter black circle taking its cut surface with the white circle, so that the white circle lacks this area with the black circle and the image of the moon state is displayed.
IF (State_moon <= 28.4 && state_moon > 25.2) {
Serial.print("Today is the crescent moon.");
tft_calendar.Fillcircle (120, 180, 30,White);
tft_calendar.Fillcircle (103, 180, 35, Black);
}
Now only the representation of the possible condition of the sky remains depending on the air pressure. To represent the symbols Four methods were defined for rain, cloud with sun and sun, which represent the symbols with lines.
If the pressure measured by the sensor lies between the values of one of these conditions, their IF statement is carried out and the (s) method (s) contained in it is called.
IF (Pressu < 1000) {
Cloud ();
rain ();
}
IF (Pressu >=1000 && pressu <= 1020) {
Cloud ();
Sun_in_cloud ();
}
IF (Pressu > 1020) {
Sun ();
}

So the code is the refresh_screens ()-The method ready and the barometer is fully functional. The data on the screen is updated every minute and you can see if you should take an umbrella or hat with you.
Since the project was created in 2024, you should adapt the year in the source code.
If the video is not displayed, please check the cookie settings of your web browser.
We hope that you like this barometer. You are welcome to adapt this project to your needs and we look forward to your comments.
Addendum
After publication of part 2, the user Martin has already made changes and added engines for two moving figures. The project can be found on Github.
2 comments
Achim
Hallo,
als Softwareentwickler der schon mit dem y2k-Bug zu kämpfen hatte ist mir aufgefallen, dass die Schaltjahresberechnung unvollständig ist.
Die gregorianische Schalttagsregelung besteht aus folgenden drei einzelnen Regeln:
1. Die durch 4 ganzzahlig teilbaren Jahre sind, abgesehen von den folgenden Ausnahmen, Schaltjahre.
2. Säkularjahre, also die Jahre, die ein Jahrhundert abschließen (z. B. 1800, 1900, 2100 und 2200), sind, abgesehen von der folgenden Ausnahme, keine Schaltjahre.
3. Die durch 400 ganzzahlig teilbaren Säkularjahre, zum Beispiel das Jahr 2000, sind jedoch Schaltjahre.
Viele Grüße
Achim
Ezio Cogoli
Bel progetto e non troppo complicato nell’esecuzione, complimenti.