当前位置:网站首页>Sensor experiment - 485 air temperature and humidity
Sensor experiment - 485 air temperature and humidity
2022-07-24 22:02:00 【Salted fish shell】
Sensor experiment ——485 Air temperature and humidity
Uh huh ~
Materials and wiring
MR Development board

Single chip microcomputer TTL turn RS485 modular

Wiring instructions
| Development board | TTL turn RS485 modular |
|---|---|
| A3 | TXD |
| A2 | RXD |
| 5v | VCC |
| GND | GND |
485 Temperature and humidity sensor module
Industrial grade chips are used , High precision import SHT20 Temperature and humidity sensor . use RS485 Hardware interface , The protocol layer is compatible with standard industry Modbus-Rtu agreement .

Wiring instructions
| TTL turn RS485 modular | 485 Temperature and humidity sensor | Development board |
|---|---|---|
| A+ | TXD_A Yellow line | |
| B- | RXD_B The white line | |
| 5v | 5V Red thread | |
| GND | GND Black line |
PS: basic 485 The wiring is the same
The sample program
Get the temperature

main.py
# main.py -- put your code here!
from pyb import UART,delay
u2 = UART(2, baudrate=9600)
barray = bytearray([0x01,0x04,0x00,0x01,0x00,0x01,0x60,0x0a]) # Query frame
while True:
u2.write(barray)
delay(1000)
if(u2.any()):
u2by=u2.read() # What is returned is the content of the allowed frame
aa=u2by
wendux = int.from_bytes(aa[3:5],'big') # temperature
wendu=wendux/10
print(wendu," degree ")
Pay attention to this 485 Housing with sensor , It has an effect on the measured temperature , You can lose 2~3 degree , Is the actual temperature . Or open the shell .
Get humidity

# main.py -- put your code here!
from pyb import UART,delay
u2 = UART(2, baudrate=9600)
barray = bytearray([0x01,0x04,0x00,0x02,0x00,0x01,0x90,0x0a]) # Query frame
while True:
u2.write(barray)
delay(1000)
if(u2.any()):
u2by=u2.read() # What is returned is the content of the allowed frame
aa=u2by
shidux = int.from_bytes(aa[3:5],'big') # humidity
shidu=shidux/10
print(shidu,"%")

边栏推荐
- Description of differences between esp32c3 led PWM use and esp32
- LED digital display driver IC and anti-interference LED digital tube display driver ic-vk1s68c ssop24 are applicable to finger clip pulse oximeter, arm electronic sphygmomanometer, thermometer, fetal
- 2022 Tsinghua summer school notes L2_ 2 basic introduction of CNN and RNN
- Principle of an automatic nine point calibration tool (including part of the source code)
- 使用frp实现内网穿透
- Sqlserver BCP parameter interpretation, character format selection and fault handling summary
- 中信证券股票开户怎么样安全吗
- Mathpix formula extractor
- [postgraduate entrance examination English vocabulary training camp] day 11 - offer, form, maintain, critical
- How to realize three schemes of finclip wechat authorized login
猜你喜欢

模板的使用

Gradle学习集合整合

RISC0:Towards a Unified Compilation Framework for Zero Knowledge
![Leetcode: the shortest dice sequence impossible to get [thinking questions + grouping ideas]](/img/89/0789cd381302237a28f3f18b3bfa74.png)
Leetcode: the shortest dice sequence impossible to get [thinking questions + grouping ideas]

91. (leaflet chapter) leaflet situation plotting - offensive direction drawing
[email protected]"/>@typescript-eslint/ [email protected]
![[image processing] pyefd.elliptic_ fourier_ How descriptors are used](/img/72/d2c825ddd95f541b37b98b2d7f6539.png)
[image processing] pyefd.elliptic_ fourier_ How descriptors are used
![[combination of classes (define a class in a class)]](/img/ae/a8226e1795bb45171a11c65d35bcac.png)
[combination of classes (define a class in a class)]
![[e-commerce operation] teach you these tips to bid farewell to invalid preset replies](/img/5b/6682c613305deb3dc15401077d38a0.png)
[e-commerce operation] teach you these tips to bid farewell to invalid preset replies

吾爱第二课-去除网页弹窗
随机推荐
Ch single database data migration to read / write separation mode
Gradle学习集合整合
Metauniverse: technological evolution, industrial ecology and big country game
【类的组合(在一个类中定义一个类)】
Can bank financial products be redeemed and transferred out on the same day?
What technical knowledge is needed to build a personal blog independently besides ECS?
小程序地理位置接口申请
"Iruntime": undeclared identifier
巧妙使用sort(List<T>,Comparator<? super T>)比较器
C # review the entrustment and event
Mysql database commands
Everything about database, database and table is here
How to modify the IP address of kubernetes node?
731. My schedule II (segment tree or scoring array)
【二分好题】
With this PDF, I successfully got offers from ant, jd.com, Xiaomi, Tencent and other major manufacturers
What are the most problematic database accounts in DTS?
Discussion on solving the application ecological problems of domestic systems based on small programs
My love lesson 2 - remove webpage pop-up
Brand new: the latest ranking of programming languages in July