Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python, how to DIY a small family weather station

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of Python how to DIY small family weather station, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this Python how to DIY small family weather station article. Let's take a look at it.

BMP180 has always been a common air pressure sensor. BMP180 is a pressure sensor with high precision, small volume and ultra-low energy consumption, which can be used in mobile devices. It has excellent performance, the lowest accuracy can reach 0.03hPa, and the power consumption is only 3 μ A; BMP180 uses powerful 8-pin ceramic leadless chip carrier (LCC) ultra-thin package, which can be directly connected to a variety of microprocessors through the I2C bus.

We use TPYBoardv102 and BMP180 pressure sensors and OLED LCD screen to make a simple home weather station to detect the indoor air pressure, temperature and local altitude. Interested friends can access other sensors and display them on OLED.

BMP180 physical diagram

TPYBoardv102 physical diagram

Effect display diagram

After the connection is completed, import the library of font.py,ssd1306.py and bmp180, and you can read the temperature, air pressure and altitude respectively by the following methods.

From bmp180 import BMPbmp=BMP180 (1) tem=bmp.getTemp () press=bmp.getPress () altitude=bmp.getAltitude ()

Import the required class library, edit main.py, and run ok directly. Here is the program source code of main.py.

Import pybfrom ssd1306 import SSD1306from bmp180 import BMP180bmp=BMP180 (1) display = SSD1306 (pinout= {'dc':' Y9, 'res':' Y10'}, height=64 External_vcc=False) while 1: tem=bmp.getTemp () press=bmp.getPress () altitude=bmp.getAltitude () display.poweron () display.init_display () display.draw_text (1 display.draw_text (tem), size=1,space=1) display.draw_text (60 display.draw_text) (space=1) display.draw_text (60pcr (altitude), size=1,space=1) display.draw_text # shows what you want to display display.display () pyb.delay (3000) about "how to DIY a small family weather station in Python". Thank you for reading! I believe you all have a certain understanding of the knowledge of "Python how to DIY a small family weather station". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report