Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to make a small Family Weather Station with python

Shulou Source: shulou.com Published: 2022-06-01 04:02:33 10月03日 Update

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.

Tags: Home meteorology weather station sensor air pressure content article can pass physical object method altitude temperature altitude excellence propriety strength minimum interest pressure lead Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Apple Huawei NVidia Shulou Information