当前位置:网站首页>Using ESP32 construct a ZIGBEE network adapter
Using ESP32 construct a ZIGBEE network adapter
2022-07-30 01:46:00 【ZhuoQing】

简 介: 利用 ESP32The networking,构建了一个 WiFi UDP 转 Zigbee的串口模块.The module is to just UDPInstructions sent toZigbee的网络中,Then replace the original function.注意,ESP32的网络地址为: 192.168.0.114.How can you get ESP32的IP地址呢? 可以介入 192.168.0.1 WiFi网关,在DHCPCheck the list of customers to the server Espressif的IP地址.
关键词:ESP32,Zigbee
§01ZIGBEE网关
一、背景介绍
在 The third hand in laboratory:Slide rail parameters and control interface Given the slippery course of laboratory platform control parameters.These platforms are by connecting in “COM2” 上的 zigbee Communication module connected.Because now used by platform to the serial port Settings have a problem,Therefore plans to useESP32作为网桥,作为UDP转成COMOf the conversion bridge,This enables the original laboratory equipment can continue to use.
二、制作模块
1、ESP32模块
ESP32模块使用了基于ESP32The intelligent car race referee system ,This is from the high dragon company production for sale. 可以通过其中的TXD2,RXD2完成向ZIGBEE 发送信息.

▲ , ESP32The referee in the system serial port2、ZIGBEE模块
下图给出了ZIGBEE的接口,Through the quad flat cables andESP32The system module.

▲ 图1.2.2 ZIGBEE接口与ESP32之间的接口三、软件编程
1、测试串口
参考在 The 17th intelligent car race game system software to modify-The time delay was more Blog forESP32Referee system software to modify the code,Write a serial port test software.代码如下:
from machine import Pin,UART
import time
import machine
machine.freq(240000000)
uart1 = UART(2, baudrate=115200, rx=16, tx=17, timeout=10)
bz1 = Pin(21, Pin.OUT)
bz1.off
while True:
uart1.write(bytes([0x55]))
time.sleep_ms(10)
测试 TX2 Pin waveform for:

▲ 图1.3.1 发送0x55数据TX波形2、发送ZIGBEE命令
将ESP32连接到 ZIGBEE模块.

▲ 图1.3.2 连接ZIGBEE模块Through the following programs,每隔 500ms 发送一个relay click 指令,经过验证,动作正常.Demonstrating the wholeZIGBEESending process is normal.
from machine import Pin,UART
import time
import machine
machine.freq(240000000)
uart1 = UART(2, baudrate=115200, rx=16, tx=17, timeout=10)
bz1 = Pin(21, Pin.OUT)
bz1.off
while True:
uart1.write(b'solenoidrelay pulse 4 50\r')
time.sleep_ms(500)
print("SEND.")
3、连接WiFi接口
根据 ESP32模块的MicroPython的基本实验 对于ESP32Connected to the general experiment,将ESP32Access to the lab WiFi 热点,并建立UDP接口连接.
如下是完整的 ESP32程序.使用 Thonny IDE 将 The following program written toESP32内部FLASH,并启动.
from machine import Pin,UART
import machine,time, network, usocket
machine.freq(240000000)
uart1 = UART(2, baudrate=115200, rx=16, tx=17, timeout=10)
bz1 = Pin(21, Pin.OUT)
bz1.off()
wlan = network.WLAN(network.STA_IF)
wlan.active(False)
wlan.active(True)
time.sleep_ms(100)
wlan.connect('TENDA626A', 'gniqouhz')
bz1.on()
while not wlan.isconnected():
time.sleep_ms(100)
wlan.ifconfig()
bz1.off()
us = usocket.socket(usocket.AF_INET, usocket.SOCK_DGRAM)
sockaddr = usocket.getaddrinfo('0.0.0.0', 4567)[0][-1]
us.bind(sockaddr)
while True:
data,addr = us.recvfrom(1024)
if len(data) > 0:
bz1.on()
uart1.write(data)
bz1.off()
经过测试,Send a command,Can cause the labZIGBEEThe relay action.
solenoidrelay pulse 4 50
This also verified thisWiFi 转 ZigbeeThe module function of normal.
※ 总 结 ※
利用 ESP32The networking,构建了一个 WiFi UDP 转 Zigbee的串口模块.The module is to just UDPInstructions sent toZigbee的网络中,Then replace the original function.
注意,ESP32的网络地址为: 192.168.0.114.
How can you get ESP32的IP地址呢? 可以介入 192.168.0.1 WiFi网关,在DHCPCheck the list of customers to the server Espressif的IP地址.

▲ 图2.1 ESPressif IP地址■ 相关文献链接:
- The third hand in laboratory:Slide rail parameters and control interface
- 基于ESP32The intelligent car race referee system
- The 17th intelligent car race game system software to modify-The time delay was more
- ESP32模块的MicroPython的基本实验
● 相关图表链接:
边栏推荐
- ufw set firewall rules
- fluttter学习之ButtonStyle 、MaterialStateProperty
- ROS 2知识:通信协议 DDS/RTPS
- msyql set names 字符转换处理
- 裁员趋势下的大厂面试:“字节跳动”
- SSM integration case
- 基于SSM实现个性化健康饮食推荐系统
- MATLAB被禁下一个会是LABVIEW吗?国产测试软件ATECLOUD崛起发力
- 这是一道非常有争议的题,我的分析如下: TCP/IP在多个层引入了安全机制,其中TLS协议位于______。 A.数据链路层 B.网络层 C.传输层 D.应用层
- 自学HarmonyOS应用开发(47)- 自定义switch组件
猜你喜欢

把@Transactional事务注解用到如此炉火纯青,真的强!

typora 透明背景图片

Huawei's "genius boy" Zhihui Jun has made a new work, creating a "customized" smart keyboard from scratch

记笔记!电源自动测试系统测试电源纹波详细方法

Fabric Private Data Case

液压滑环的应用介绍

Recommendation systems: feature engineering, common features

LeetCode 2352. 相等行列对

【LeetCode每日一题】——404.左叶子之和

新型LaaS协议Elephant Swap给ePLATO提供可持续溢价空间
随机推荐
可惜了!规模这么大的上市公司说散就散了
初级测试人员如何快速成长
关于 SAP Fiori 应用的离线使用
自学HarmonyOS应用开发(47)- 自定义switch组件
About offline use of SAP Fiori apps
LeetCode 2352. Equal Row Column Pairs
go 双向流模式
泰克Tektronix示波器软件TDS520|TDS1001|TDS1002上位机软件NS-Scope
MPLS VPN跨域-optionC2
把@Transactional事务注解用到如此炉火纯青,真的强!
Sublime does background transparency and column editor
经济衰退时期的对比:如今更像历史上的哪段时期?
什么专业越老越吃香?
SSM integration case
推荐系统:特征工程、常用特征
How to set up hybrid login in SQL server in AWS
go jwt使用
js中原型链的理解,原型链解决的是什么问题?
【SemiDrive源码分析】【MailBox核间通信】43 - 基于Mailbox IPCC RPC 实现核间通信(代码实现篇)
What majors become more popular the older they get?