当前位置:网站首页>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的基本实验
● 相关图表链接:
边栏推荐
猜你喜欢
![[Microservice~Nacos] Configuration Center of Nacos](/img/c3/9d8fb0fd49a0ebab43ed604f9bd1cc.png)
[Microservice~Nacos] Configuration Center of Nacos

基于燃压缩空气储能系统的零碳微能源互联网优化调度(Matlab代码实现)

nacos的共享配置和扩展配置

Typora transparent background image

LeetCode 2352. 相等行列对

Graphical LeetCode - 593. Valid Squares (Difficulty: Moderate)

经济衰退时期的对比:如今更像历史上的哪段时期?

液压滑环的应用介绍

泰克Tektronix示波器软件TDS520|TDS1001|TDS1002上位机软件NS-Scope

数据流图、数据字典
随机推荐
SSM整合案例
JS develops 3D modeling software
【微服务~Nacos】Nacos服务提供者和服务消费者
泰克Tektronix示波器软件TDS420|TDS430|TDS460上位机软件NS-Scope
【Vmware NSX-V基本架构及组件安装】
App测试需要测什么
How to set up hybrid login in SQL server in AWS
多AZ双活容灾部署的云端系统架构设计说明书框架
exness:美国GDP萎缩,日元反弹受捧
vscode 工作区配置插件 配置不同工作环境
初级测试人员如何快速成长
npm ERR! code ENOTSUP npm ERR! notsup Unsupported engine for [email protected]: wanted: {“n
[深入研究4G/5G/6G专题-45]: 5G Link Adaption链路自适应-1-总体架构
ROS2知识:编译系统ament_cmake
推荐系统:特征工程、常用特征
LABVIEW详细介绍:LABVIEW是什么软件?都可以干什么?
sqlserver 多行合并成一行
什么专业越老越吃香?
解决vscode的Network不显示问题
Fabric 编写案例 链码