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

How to make a small Family Weather Station with python

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

In this article, the editor introduces in detail "how to make a small family weather station with python". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use python to make a small home weather station" can help you solve your doubts.

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. Radish education tpyboard. Com

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

Above is the physical diagram of BMP180 and TPYBoard v102. I will not introduce OLED. I will tell you how to connect hardware below:

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 (60 and 10) display.draw_text (1) 20 altitude str (size=1,space=1) display.draw_text (60) shows what you want to display display.display () pyb.delay (3000) read here This article "how to use python to make a small family weather station" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it. If you want to know more about the article, please 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