当前位置:网站首页>ESP32 485 Illuminance
ESP32 485 Illuminance
2022-08-05 05:11:00 【Salted fish basket】
ESP32 485光照度
气象站基础呀
RS-485仅是一个电气标准,描述了接口的物理层,像协议、时序、串行或并行数据以及链路全部由设计者或更高层协议定义.
RS-485定义的是使用平衡(也称作差分)多点传输线的驱动器(driver)和接收器(receiver)的电气特性.
材料及接线
ESP32
单片机TTL转RS485模块
接线说明
| 开发板 | TTL转RS485模块 |
|---|---|
| 22 | TXD |
| 23 | RXD |
| 5v | VCC |
| GND | GND |
485光照度
采用工业级芯片,High-precision imported light sensor.采用RS485硬件接口,协议层兼容标准的工业Modbus-Rtu协议.


接线说明
| TTL转RS485模块 | 485温湿度传感器 | 开发板 |
|---|---|---|
| A+ | TXD_A 黑线 | |
| B- | RXD_B 黄线 | |
| 5v | 5V 红线 | |
| GND | GND 绿线 |
PS:基本485的接线都一样了
示例程序
Get illuminance
此485传感器范围0~200000Lux
勒克斯(lux,Statutory symbolslx)照度单位,1 Lux equals 1流(lumen,lm)The luminous flux is evenly distributed in 1㎡ Illuminance over the area.
1 lx大约等于1candlelight in1Illuminance at a distance of meters,The lowest illuminance we commonly see in camera parameter specifications(MINIMUM.ILLUMINATION),Indicates that the camera only needs to be on the markedLUX数值下,That is, a clear image can be obtained,此数值越小越好,说明CCDhigher sensitivity.同样条件下,Black and white cameras require far less illuminance than color cameras that still have to deal with color intensity10倍.
一般情况:Under the summer sun100,000 lx;Cloudy outside for10000 lx;Indoor fluorescent lamps are100 lx;距60W台灯60CM桌面为300lx;TV studio for1000 lx;Indoors at dusk10 lx;Street lights at night0.1 lx;烛光(20CM远处)10~15 lx.
PS:我买的485The light can be measured outside the range after all20Wlx And the summer sun is there10Wlx.So if the test is outdoor,When buying, ask about the size. Indoor is0~65535lx
from machine import UART
#ESP32可以映射引脚,初始化的时候设置就行,串口号一般设置成2(0和1尽量别用.)
import time
uart= UART(2, baudrate=9600, bits=8, parity=None, rx=22,tx=23, stop=1, timeout=100)
barray = bytearray([0x01,0x03,0x00,0x02,0x00, 0x02 ,0x65 ,0xcb]) #问询帧
while True:
uart.write(barray)
time.sleep(1)
if(uart.any()):
u2by=uart.read() # 返回的是答应帧的内容
aa=u2by
G10 = int.from_bytes(aa[3:5],'big') # 十位
G1= int.from_bytes(aa[5:7],'big') # 个位
GZ=G10*10+G1
print(GZ,"LUX")
Serial output light value,I tested it indoors
修改地址
In addition, we can also configure the address.
The following addresses are configured successfully,My current sensor address is00
>>> from machine import UART
>>> uart= UART(2, baudrate=9600, bits=8, parity=None, rx=22,tx=23, stop=1, timeout=100)
>>> barray = bytearray([0x00,0x06,0x00,0x20,0x00, 0x01 ,0x48 ,0x11])
>>> uart.write(barray)
8
>>> u2by=uart.read()
>>> print(u2by)
b'\x00\x06\x00 \xe1\xfd'
We can test it
from machine import UART
#ESP32可以映射引脚,初始化的时候设置就行,串口号一般设置成2(0和1尽量别用.)
import time
uart= UART(2, baudrate=9600, bits=8, parity=None, rx=22,tx=23, stop=1, timeout=100)
barray = bytearray([0x00,0x03,0x00,0x02,0x00, 0x02 ,0x64 ,0x1A]) #问询帧
while True:
uart.write(barray)
time.sleep(1)
if(uart.any()):
u2by=uart.read() # 返回的是答应帧的内容
aa=u2by
G10 = int.from_bytes(aa[3:5],'big') # 十位
G1= int.from_bytes(aa[5:7],'big') # 个位
GZ=G10*10+G1
print(GZ,"LUX")
Look no doubt,是好使的~
边栏推荐
- [Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)
- 算法---一和零(Kotlin)
- 大学物理---质点运动学
- After controlling the export file in MySQL, it becomes \N. Is there any solution?
- 【informix】解决启动报错大全,以及解决办法
- dedecms织梦tag标签不支持大写字母修复
- 类的底层机制
- 基于Web的商城后台管理系统的设计与实现
- jvm three heap and stack
- Flutter学习5-集成-打包-发布
猜你喜欢

Redis哨兵模式配置文件详解
![[Surveying] Quick Summary - Excerpt from Gaoshu Gang](/img/35/e5c5349b8d4ccf9203c432a9aaee7b.png)
[Surveying] Quick Summary - Excerpt from Gaoshu Gang
![[cesium] element highlighting](/img/99/504ca9802db83eb33bc6d91b34fa84.png)
[cesium] element highlighting
![[Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)](/img/86/9c9a2541f2b7089ae47e9832fffdb3.png)
[Student Graduation Project] Design and Implementation of the Website Based on the Web Student Information Management System (13 pages)

Flutter real machine running and simulator running

Dephi逆向工具Dede导出函数名MAP导入到IDA中

Flutter学习5-集成-打包-发布

span标签和p标签的区别

JeeSite New Report

Error creating bean with name ‘configDataContextRefresher‘ defined in class path resource
随机推荐
Judgment statement _switch and case
Please write the SparkSQL statement
App快速开发建设心得:小程序+自定义插件的重要性
1.3 mysql批量插入数据
【Transfer】What is etcd
The underlying mechanism of the class
Flutter learning - the beginning
重新审视分布式系统:永远不会有完美的一致性方案……
server disk array
结构光三维重建(二)线结构光三维重建
「PHP8入门指南」PHP简明介绍
软件管理rpm
Redis哨兵模式配置文件详解
human weakness
虚证、实证如何鉴别?
Day019 方法重写与相关类的介绍
jvm 三 之堆与栈
Flutter learning 5-integration-packaging-publish
Flutter Learning 4 - Basic UI Components
write the story about us