Professional LCD and Touch Manufacturer / Design Solution

esp32 and oled display: internet clock – dht22

This tutorial is a continuation of the journey to learn more about this great IoT device esp32.
In my last tutorial: the internet of things became simple: playing ESP32 on Arduino IDE, we explored: Now let\’s include an OLED that shows the data captured by the DHT sensor locally
Temperature and humidity)
And local time.
We will be programming our ESP32 using the Arduino IDE, as we do with the ESP8266 family.
Install drivers: it is important that you have installed the updated cp10. x USB to USB driver on your computer.
Enter: usb-in this link-to-uart-bridge-vcp-
Driver and install the correct driver for your OS.
Installation Library: The novelty here is that the Expressif itself is in GitHub and will provide us with the correct direction for the installation of the library: arduino-esp32.
Follow the instructions of the operating system.
After that, restart the Arduino IDE and it\’s done!
You have to see several boards on the Tools menu.
Choose the right one for you.
In general, the \”universal\” ESP32 development module works fine.
We will start with the hardware assembled in my last tutorial.
We\’ll be faster here, but visit if you want more details: IoT becomes simple: in short, play ESP32 on Arduino IDEIn: to test the LED, you can test the potentiometer using code esp32_blinkfor (Analog input)
, You can test the DHT using the code: Dialog _ input, first install the library as described in the next step.
First, you need to install the adaffrut library on the IDE.
Go to their GitHub to download an updated version of this library: DHT-sensor-
When I first used the library, I received a message: After some digging, I found that there was also a need to install the Adafruit unified sensor Library.
So, I am from Arduino IDE library manager (
See above).
After that, everything went well just like we did with Arduino and NodeMCU.
Let\’s do some testing with this sensor.
You can use the \”DHT tester \”.
The Ino \”sample sketch, which is included in the library, or made by itself.
I wrote a simple code to test the sensors that can be downloaded from my GitHub: esp32_dhtfor this tutorial, I will use the 128×32 I2C OLED display.
In principle, once the library is installed, the ESP32 will also work with the 128×64 OLED display.
Once this device is an I2C monitor, you need to connect 4 pins with ESP32: Now, install this library.
We will use the version of Daniel eihhoen here.
Open the library manager and search for \”OLED \”.
See above. I have the 3. 2.
7 versions are installed.
Open ssd13306simple demo on the example menu and replace the code with: GIF below: show a simple demo of some work.
Please note that this demo is designed for a 128×64 monitor, so you will realize that the graphics will shrink in case I use 128×32.
You can easily create and install new fonts on your display.
I created a new font that can give me about 2 lines and 20 characters on the 128X32 OLED display.
How to create it: go to the SSD1306 font converter, a great tool developed by Daniel eihhoen.
There you have to choose: Press Create and voilá!
Create the \”C font\” file in the appropriate window.
The foto above shows a new \”Hello World\” using this new font \”.
A clean code can be downloaded from my GitHub: esp32_ssd1306_testlet is now displayed on OLED showing the temperature and humidity captured by the DHT22 sensor. On our loop()
Function, we will have: function getDHT ()
It\’s the one I used before.
The new feature here is display data ()
, As shown in the following figure: the photo above shows the final result, you can download the complete file from my GitHub and also register the collection time.
Let\’s use NTPClient Library: change the line: enter with WiFi network credentials.
On the serial monitor you have to see the actual time.
In the basic version, European time will be displayed.
In the advanced version, you can change it.
Now, let\’s merge this timestamp code with the code we developed earlier.
The results are shown above.
The complete code can be downloaded from my GitHub: esp32_time_stam _ dht22_ssd136on the last step, we put all the code together, there is one how do we get each information to display one on the display at a time?
We need a \”page selection\” mechanism.
Several different mechanisms can be used.
There are usually multiple buttons to select the menu.
For fun, let\’s try something unusual here.
Potentiometer!
We will turn the potentiometer like we did with the radio dial, and depending on the value read, we will define a specific \”display\” that will be displayed on the OLED.
Let\’s define 4 possible displays: the analog input can read 4,095 different values.
We only need 5, so let\’s define the scope for this: let\’s define an int variable that will receive as content: 0, 1, 2, 3, 4, 5, according to the screen to be displayed: Now we need to create a function getDisplay ()
, Will read the value of the potentiometer, return the correct display number (
Display num will be a local variable in this function).
The function will look like this: Display Data ()
Function, the selected display will be displayed (or screen)
: Both of these functions will be included in our Loop ()
Function: the complete file can be downloaded from my GitHub: esp32_time_stam _ dht22_ssd306_multiple_display. Here is a selector with our display.
We will be back soon with a new tutorial!
Continue to learn the MJRoBot tutorial!
As always, I hope this project will help others find their way in the exciting world of electronics, robotics and the internet of things!
For more projects, please visit my blog: MJRoBot.
OrgSaludos from the south of the world!
See you on my next structure!

    Custom Message

    Related Posts

    25家显示产业链企业亮相CES2023:Mini/Micro LED、卷曲OLED、投影……

    2023年CES展会将于1月5日在拉斯维加斯拉开帷幕,参展商中的323家企业来自世界500强公司,全球科技巨头LGD、三星、友达、TCL华星、索尼、华硕、夏普、元太、技嘉、TCL、大众、宝马等将带来丰富的创新成果。本届CES展会涵盖的重要主题包括可持续性、数字健康、Web3与元宇宙以及人类安全等。 LGD:发布第三代OLED电视面板 LG电子展览馆入口处,连接260片OLED柔性标牌的超大型雕塑“OLED地平线”吸引了游客的目光。 LG Display在美国拉斯维加斯举行的世界最大家电、IT展示会CES 2023上公布了使用新技术“META Technology 1.0”的第三代OLED电视面板。 当地时间1月4日,LG-Display发布的新产品采用了革新技术“META Technology 1.0”,比现有亮度(屏幕亮度)提高了60%,视角扩大了30%。改善OLED亮度和视角局限性的“Meta Technology”将超微镜头和亮度增强算法相结合,将OLED的光释放最大化,能效提高约22%。 据LG Display透露,第三代OLED电视面板将现有的1300尼特(nit,1nit是一支蜡烛的亮度)水平的峰值亮度大幅提高到2100尼特(HDR标准),体现了OLED电视面板中最亮的画面。 另外,通过被称为“微透镜阵列”(MLA)的超微透镜,克服了无法提高亮度的局限性。此前,有机发光层产生的大量光因面板内部反射无法向外照射而无法提高亮度,但在肉眼看不见的大小凹凸不平的镜片图案上沉积了自己发光的有机物,最大限度地提高了光的释放。 第三代OLED电视面板每像素精密制作5117个(77英寸4K标准)、共424亿个微透镜,将内部反射的光线发射到外部,可以实现此前没有体验过的明亮画面。 同时,就像蜻蜓以数百万个凸起的复眼结构观看360度一样,通过数百亿个微透镜提供现有电视中最宽的视角。将屏幕正面亮度的角度扩大到160度,比之前改善30%,无论从哪个角度都能实现准确的影像。 LG Display表示,今年量产的4K 55、65、77英寸和8K 77、88英寸等高端OLED电视面板将优先采用“META Technology 1.0”,今后将扩大到全部阵容,计划以此加强高端电视市场内OLED的主导权。 LG Display大型事业部专务李贤宇表示:“超差距技术‘META

    2.4 tft lcd with i2c module(s)

    Hello!In this short note, I will show you how I am using the I2C bus on this tft LCD.Required parts :-Arduino Uno-2. 4 TFT LCD-For

    Shopping Cart