Second Multi-functional Weather Station (3.5 Inch LCD)
by jandb86 in Circuits > Arduino
1923 Views, 10 Favorites, 0 Comments
Second Multi-functional Weather Station (3.5 Inch LCD)
As I mentioned in the previous Instructable, this device is the most frequently utilized DIY output among the many other Arduino project outcomes.
But the first version has several problems I'll describe details in the next step.
Therefore, I made this second version of the Multi-functional Weather Station having a bigger screen, simplified circuit, and more readable sketch program code.
The overall functionality of the second version is almost the same as the first one.
But information displaying method is changed to suit my daily usage pattern and unnecessary sensors are removed for simplifying the overall circuitry.
Let's look at more details of this second version.
Some Improvements From the First Version
The picture above shows the first version of the device in action at night hours.
Although it was a little bit useful for showing needed information all time, it has the following problems.
- Unnecessary sensors (noise, LDR) and redundant SD card breakout boards are emitting too many lights which can distress sound sleep
- 1.8 inch LCD screen is so small for immediately recognizing information displayed
- Displayed photo image quality is poor to be utilized as a digital album because of the small LCD size
-Looking at multiple screens is necessary for checking time and other relevant weather information
For improvement, the bigger 3.5 inch LCD is used for displaying high-resolution images and bigger time and weather information messages on the screen.
The black acrylic board of the front cover is added to block unnecessary lights from the internal system boards.
Then let's look more other details of the new device.
Schematics and Parts
When comparing the schematics with the first version, overall circuitry becomes more simplified.
Somewhat less useful sensors (LM393 base sound sensor and LDR) are removed from the second circuit version.
As the integrated SD card circuit to the 3.5 inch LCD module is used, overall circuitry becomes more compact.
The following parts are utilized.
- Arduino Mega2560 board
- 3.5 inch LCD module (SD reader is integrated)
- DS3231 real-time clock
- DHT 22 temperature and humidity sensor
- BMP280 atmospheric pressure sensor (including temperature sensor)
- Acrylic boards (Transparent and black acrylic boards)
- 12V external power supply
The most important part is the 3.5 inch LCD module in this project.
I bought three of these at Aliexpress at less than 10 dollars each.
It can support 480x320 resolution with ILI9486 video driver IC.
The LCD manufacture is providing their device driver and graphic library as well as several sample demo programs.
But I want to use Adafruit graphic library as it was frequently used in many previous projects and is familiar.
But I can't find any helpful technical resources to interface this LCD module with Adafruit graphic library.
Therefore, I slightly modified the demo program provided by the manufacture for making the digital album that displays photo images on LCD.
Wiring and Mounting Parts
Wiring and configuration details of sensors and other break-out boards are explained in the previous Instructable listed below.
https://www.instructables.com/Multi-functional-Weather-Station-Mega2560-Version/
As the first Multi-functional Weather Station circuit is utilizing similar electronic components, the overall wiring and configuration scheme is the same for the second version.
Installing DHT22, BMP 280, and DS3231 are already explained several times in the previous Instructables.
Therefore, I'll explain only the wiring and configuration method of 3.5 inch LCD module as this component is a new one included in the second version of the circuit.
The LCD module is called as 3.5 inch 8 bit TFT LCD module for Arduino Uno at Aliexpress.
Likewise, the LCD module can be plugged into the Uno board similar to other HAT boards.
As the wiring scheme is widely different among LCD manufacturers, the following method will be only relevant for the LCD module I bought.
The LCD module requires 8 data lines, 5 LCD control lines, and 4 SD card interfacing lines with Arduino as follows.
- 8 data lines (Arduino pin <-> LCD): 8->D0, 9->D1, 2->D2, 3->D3, 4->D4, 5->D5, 6->D6, 7->D7
- 5 LCD control: A0->RD, A1->WR, A2->RS, A3->CS, A4->RST
- 4 SD card control: 10->SS, 11->DI, 12->DO, 13->SLK
As the LCD module supports tight integration with Arduino Uno boards, one-to-one pin mapping is possible without any confusion.
Even though you use a Mega2560 board, the same pin mapping scheme can be utilized.
According to the above wiring method, LCD module initialization is performed by the sketch program as shown in the code below.
***
// Setting LCD
LCDWIKI_KBV my_lcd(ILI9486,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset
***
I'll show other details when the sketch program is explained in the later step.
Preparing BMP Image Files for Digital Album
As the digital album is a key functionality of this weather station version, preparing diverse bitmap images was very important.
Because the most recently created images are JPEG format, conversion to bitmap file is necessary for correctly displaying the image on the LCD.
When using the Windows paint program for file conversion, the 3.5 inches LCD compatible well-formatted bitmap file can be made.
In the resize menu of the paint program, you can strictly dictate the width as 480 and height as 320 pixels as well as ignore the original image's aspect ratio while converting the JPEG file.
If a file is converted manually by the above method, the original image is slightly distorted but the converted image will be well fitted to the 3.5 inch LCD screen which’s resolution is 480x320.
But above is manual conversion, it will take a long time and effort to convert many JPEG files.
As I planned to convert almost 1,000 JPEG images, a different method is required by utilizing Raspberry pi, python program, and ImageMagick utility.
A batch-style python program is written for converting all JPEG files to bitmap by executing the following commands.
***
cmd = 'convert '+source_jpg_file+' -scale 480x320! -gravity center -background black -extent 480x320 -rotate 90 '+converted_bmp_file
os.system(cmd)
***
With the above python code, I can convert almost 1,000 files automatically without any hassles.
But the problem is converted image by ImageMagick is not well-fitted on the used 3.5 inch LCD.
I'll explain the details at step later.
Sketch Program
Please refer to the attached sketch program file for more details.
As the ILI9486 3.5 inch LCD module is not compatible with other conventional device drivers and graphics modules, I had experienced several trial and error device integration attempts without success.
Instead of the manufacturer's driver and library (LCDWIKI_GUI, LCDWIKI_KBV), I tried to use the common MCUFRIEND device driver and Adafruit_GFX graphic library.
With MCUFRIEND and Adafruit_GFX, displaying simple graphics such as lines, circles, and rectangles on LCD is possible.
But for displaying photo images such as 24-bit bitmap, another Adafruit library such as the Adafruit_reader should be included.
But the Adafruit_reader object only interacts with the Adafruit device driver.
Although I found the Adafruit ILI9486 device driver, I can't make it interact with purchased LCD and Arduino Mega2560 boards.
After several LCD interfacing attempts with other common device drivers and graphic modules, finally I give up.
Therefore, I used the manufacturer's original device driver and graphic modules (LCDWIKI_GUI, LCDWIKI_KBV) for the final sketch program.
And the manufacturer's example program is optimized by remaining only bitmap displaying routines and discarding all other unnecessary codes.
Running the Weather Station
When looking at the video from the attached file below, you can find the performance of the manufacturer's graphic library is very poor.
That's why I want to use Adafruit graphic library as the bitmap image display on LCD is relatively quick.
Also, about 15% of the topside image is displayed at the bottom of the LCD.
When a bitmap file is manually converted by Windows paint as explained above, this problem can be corrected as the image is well-fitted on LCD.
But when JPEG is converted automatically by the python program, still the topside image is displayed at the bottom of the LCD regardless of any conversion options of the ImageMagick.
I'm still finding a way to correctly display bitmap images on this 3.5 inch LCD.
But the solution seems a little bit difficult by utilizing the manufacturer's device driver and graphic library as detailed technical documents are not available.
Downloads
Conclusion
I'm always wondered about the effectiveness of a humidifier.
Is it helpful to my chronic rhinitis?
Every morning I usually wake up with a sore throat and blocked nose when not using a humidifier.
But after using a humidifier, these symptoms of chronic rhinitis seem a little bit improved.
But is it just feeling or does any tell-tale evident exist?
When you look at the picture above, the effect of the humidifier is quite obvious.
I'm turning the humidifier right before to sleep (about 10:00 pm) and it running roughly until to 6:00 am in the morning.
After using the humidifier, room humidity rises to 60%, and an average of more than 50% is maintained during night hours.
Although this second weather station device can't correctly display a bitmap on LCD, it still can collect necessary weather conditions for a long time.
Anyway, this device is made to get the value data on a long-term basis.
That's all for the second version of the weather station-making project.
Thanks for reading.