Sometimes we want to use colorful graphics to create more eye-attractive projects. Unfortunately, the beautiful graphics require a big amount of resources such as controller memory for graphical library routines and external storage like a SD-card memory to store images and so on. The Arduino controller, on the other side, has limited amount of resources and is not fully suitable for the rich graphical projects. To reduce the resource requirements we can use the nextion display. In this case we do not need external storage for images and we can significantly reduce the memory requirements.
In point of view of the controller the nextion display is just a serial device, not more resource expensive than a usual black and white lcd display first place. So is it possible to build the weather station on Arduino UNO and nextion screen?
The answer is not exactly. You can build one, but it would have very limited functionality because of lack of controller memory. You cannot include some history graph or so. To build build rich-functionality weather station you need more advanced micro controller.
In this article I am going to show how to build the featured weather station with attractive graphics and data logging that receives the weather data from many wireless weather sensors. This weather station is based on nextion dislay and arduino mega 2560.
Let's assume we already have the external weather sensors, like this one or manufactured by famous manufacturer, OREGON, THGN123N. We are going to create our own central unit, that receives the weather data from these external sensors, displays the temperature, humidity and the atmosphere pressure, periodically saves the data to the SD-card and draws the graphs of the historical data. Also the central unit make some kind of the weather forecast based on pressure changes.
The main feature of this weather station unit is that, it uses the background picture to show the weather forecast, not just the small icon like other weather station usually do.
The big disadvantage of the nextion display is that the transparent images are not supported by the display firmware. So we cannot create the round elements. You have to use 'cropped' background inside your text widgets to show the text data over custom image. In my case it means that when the display background changed, all the text widgets backgrounds should be changed accordingly. So we need to create several complete screens for each weather forecast.
On the other hand, using pressure changes, we can make three different types of weather forecast: clear, cloudy or rain (snow). Also. there are two main day periods: day and night. So we need to create just 8 different screens:
- sunny (clear sky, day)
- moony (clear sky, night)
- cloudy day
- cloudy night
- rain day
- rain night
- snow day
- snow night
All these screens have to be created inside the nextion display using nextion editor. All these screens share the same widgets names for text fields (temperature, humidity, pressure) for our sensor data. When the controller updates the screen, it first selects the corresponding screen with desired background, then it updates the sensor data inside display widgets.
The main screen splits into the three main areas. In the upper line of the display you can find internal sensor data: home temperature and humidity, atmosphere pressure, current time and date. It assumed that we all are living in houses with usual windows so the atmosphere pressure are the same inside the house and outside of it. So the controller has just one pressure sensor inside main module to accurately measure the atmosphere pressure.
On the left half of the screen you can find the main sensor data: temperature and humidity. It is convenient to see main external sensor data in the screen all the time. The ID of the main sensor can be defined in the setup screen. You can select the required ID from the list of the available sensor IDs. So, please be patient and wait till all the external sensors would send the signals to the controller. Usually it takes about two minutes.
On the right side of the screen you can find the data from all external and internal sensors: sensor ID, temperature and humidity. The information changes periodically allowing to monitor the data from all sensors. The controller supports up to 4 external sensors. If you have only one external sensor, the internal sensor data would be displayed on the right side of the main screen also.
The controller has built-in accurate real time clock module, ds3231 allowing to obtain actual time and date. This clock data is used for logging the sensor data together with time stamp to the SD-card, build the day and night forecast and control the display brightness.
There are several extra screens inside the nextion display:
- The screen displaying the time of sunrise and sunset and moon age;
- The screen for controller setup;
- The screen to adjust real time clock;
- The screen to display history data from the sensors
To get to the 'sunrise' screen, tap the main screen on the current date. To setup the controller and adjust the clock, tap on the current time. To display history data, tap on temperature or pressure.
There are two modes for history data screen: 1 day period and 8 days period. To change current mode, tap on graph area.
There are two icon toolbox menus on the left side and top of the history screen. On the left toolbar menu you can select desired sensor ID (choose from available ones). The internal sensor has ID equal to 0. On the upper toolbar you can change the data type to be displayed: pressure, temperature or humidity.
On the setup screen you can:
- customize the main external sensor ID (wait till the controller received the signals from all the sensors);
- Setup the morning and evening times (when the controller changes the display brightness);
- Configure the display brightness.
To increase the controller stability and prevent the controller hang-up, the external watch-dog circuit was implemented in the schematics. This circuit can be implemented in the other projects also, so here you can see the separate picture for this timer below.
The timer would reset the Arduino controller in about 2-3 minutes if it would not received the signal through the Arduino A2 pin.
The weather has rich-graphics display, very eye-attractive, station works very stable about half of the year.