Introduction: ESP8266/ESP32 Weather Station With TFT LCD(s)
In this short instructable i would like present my second Esp8266 WS project. Since i posted my first ESP project i wanted to make myself a second one. So i had some free time to rework an old source code to fit my needs.
So if you don't mind i will present it.
Step 1: The Weather Station
The WS still uses the openweathermap API key to download the weather data and display it on the screen.
A little coding was needed because in that form it could not display the weather icons i wanted.
Step 2: Materials
Parts needed for WS:
- Nodemcu V3 ESP8266
- 1.8 inch TFT LCD with ST7735 driver IC
- F-F wires
- Source code
- Arduino IDE
- SPIFFS support
- Openweathermap API key
Step 3: Software
For this project i am providing the source code and the bitmap images needed, download it from my github page: https://github.com/Lacybad/ESP8266-ST7735-weather-...
The library i have used is the TFT_eSPI created by Bodmer.
All you have to do: Download the correct libraries, compile it and upload it to the board, upload the bitmap images with SPIFFS to ESP and connect with lcd.
I have used 24 bit 100 X100 bitmap images, but you can use any other icons. The ones i used have downloaded from https://www.flaticon.com
Step 4: LCD Pinout
The pinout is the following:
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
// Display LED to NodeMCU pin VIN (or 5V, see below)
// Display SCK to NodeMCU pin D5
// Display SDI/MOSI to NodeMCU pin D7
// Display DC (RS/AO)to NodeMCU pin D3
// Display RESET to NodeMCU pin D4 (or RST, see below)
// Display CS to NodeMCU pin D8 (or GND, see below)
// Display GND to NodeMCU pin GND (0V)
// Display VCC to NodeMCU 5V or 3.3V
For reduced backligh you can use a 10K potentiometer or use another GPIO pin. As for myself i usually connect backlight pin to TX pin. I know it is not a very good idea or very healthy for ESP, but it is working that way.
Step 5: WS in Action
After you have done everything correctly you can see that the weather station is connecting to the internet and downloading the weather data.
The different parameters are separated in different loops.
What you see is the actual weather description, temperature, humidity, wind speed, visibilty in meters, air pressure, wind angle , cloud coverage in percentage (%).
As for a bonus between 9 PM and 7 AM the display turns inverse to simbolise night time.
Step 6: Some Important Tips
As you all know the are a few variants of the 1.8" TFT on the internet. With the genuine Adafruit lcd-s there are usually no problems. But when using fake ones(usually from Aliexpress) you have to make some adjustments.
Bodmers TFT_eSPI library is very awsome and rich funcionality. And the best part is that he made it to handle the pixel offsets depending on wich kind of 1.8" TFT you are using.
In order to overcome this issue i am suggesting the following:
Go to library folder and edit User_Setup.h file. Uncomment #define ST7735_DRIVER and comment the others.
Then uncomment the tft height an width. And then in my case(REDTAB) uncomment for eg: #define ST7735_REDTAB. After this save it for the moment and compile sketch and upload to board. To be sure i have defined the parameters in the sketch too.This is a bit long procedure, cause you have to compile and upload the sketch every time to board untill the offset is gone, but it is worth the experimenting. For editing the h. files i strongly suggest Wordpad. Images included.
Step 7: Done
After doing everything correctly you can enjoy this little gadget. I have tried pairing the bitmap images with the weather codes as good as i could, but i am still testing it at the moment.
Basically i just made it for myself, but after a day i thought i will share it. Maybe someone will like it more than me.
Thank you for reading my instructable,hope you will find it useful and use it as you like.
Have a nice day!
Step 8: A Small Update
After a few days i thought i will remake this WS in a new form.
Changes : ESP32 Uno R3
Parallel ILI9340/41 TFT LCD
1 extra option
Pls edit User_setup.h file in TFT_eSPI library accordingly in sketch. Pls uncomment them and comment out other option or otherwise it will not work.
You have to connect GPIO 35 to 15 , GPIO 33 to 34, GPIO 32 to 36 because they are only input pins and then our display will not work( see picture).
Source code is available on github.