之前有项目做串口自定数据转dmx协议控制灯光。
链接
奔驰灯光互动项目开发历险记,2019春节前10天 https://blog.csdn.net/qq_38288618/article/details/88559412

python 设备ArtNetToDMX512的协议测试 https://blog.csdn.net/qq_38288618/article/details/87564627

前一阵呢有同仁看了找我交流,看能不能改wifi无线控制灯光。

正好有esp8266模块,wifi通讯是没问题的,觉得有戏,看有没有前辈老师们造好的轮子。

列出Brief :

1、smartconfig配网,8266连接AP
2、开UDP端口,接收解析数据
3、开串口,接收解析数据 
4、将这些数据转换成DMX协议,发送给设备
5、按键控制配网任务
6、led显示运行状态 
7、串口和udp数据自定协议

网上搜索了不少相关资料:

https://www.instructables.com/ESP8266-Artnet-to-DMX/

https://github.com/mtongnz/ESP8266_ArtNetNode_v2

https://github.com/JonasArnold/EthernetDmxNode_esp8266

https://github.com/sparkfun/SparkFunDMX

https://github.com/forkineye/E131

https://github.com/forkineye/ESPAsyncE131

https://github.com/rstephan/ArtnetWifi

https://github.com/FastLED/FastLED

https://arduinojson.org/v6/api/jsondocument/

https://github.com/mtongnz/espDMX

使用 espDMX库做个实践活动:
引用原文部分说明

esp8266DMX v2
Initial version by Matthew Tong, June 2016. This library is derived from the HardwareSerial library.

This library has been updated to support new functionality but is compatible with the previous library.

This library will transmit up to 2 DMX universes from an ESP8266 module. It utilizes the hardware UARTs and is entirely interupt driven meaning the DMX output has very precise timing.

The DMX will refresh at a minimum rate of 44Hz. The library will detect how many channels have been set, outputting less than 512 if possible to increase the refresh rate. This increases the responsiveness of fixtures. It will still output a full 512 channels at least once per second.

View my Instructable for an ESP8266 Artnet to DMX device: http://www.instructables.com/id/ESP8266-Artnet-to-DMX/

If this library is helpful and you're feeling generous, why not shout me a beer: https://www.paypal.me/mtongnz

主要大意简译:
8266开了两路dmx;
刷新频率至少44Hz,
作者DIY的链接
觉得有意义,可以请作者喝两杯啤酒,还是折现吧https://www.paypal.me/mtongnz(应该搞个微信、支付宝收款码效果会更好)

good,我觉得有意义。thanks,不过没办法请你喝两杯了,帮着宣传宣传吧,赠人玫瑰手留余香也好。

使用前文简易的diy多任务框架,造车主文件代码 : 

前文任务框架在这里

/*dmxChaser - a simple example for espDMX libraryCopyright (c) 2016, Matthew Tonghttps://github.com/mtongnz/espDMXThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General PublicLicense as published by the Free Software Foundation, either version 3 of the License, or (at your option) anylater version.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the impliedwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with this program.If not, see http://www.gnu.org/licenses/
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>#include <WiFiUdp.h>
WiFiUDP Udp;
char packetBuffer[UDP_TX_PACKET_MAX_SIZE + 1]; //buffer to hold incoming packet,
char ReplyBuffer[] = "acknowledged\r\n";       // a string to send back#include <espDMX.h>unsigned char dd[512];
void dmxWrite(int id , unsigned char v) {dd[id] = v;}
#include "sys_rw.h"
#include "rw_KEY.h"
#include "rw_ledblink.h"
#include "rw_smartconfig.h"
#include "FramePkg.h"
FramePkg pkg = FramePkg(520);
//-------------
//ff
//[1~2]frame length
//[3~4] startID
//[5~n] data
//crc
//fe
//-------------
//n=5~516
//frame length=7~519   pkg[1]+pkg[2]<<8
//arr={3-n};
//len=frame length-5;
static void on_pkg_data_ok(unsigned char arr[], int len) {if (len >= 2) {//on_FramePkg_ok(arr, len);uint16_t startID = arr[0] + (arr[1] << 8);for (uint16_t i = 2; i < len; i++) {dmxWrite(startID + i - 2, arr[i]);//Serial.print(arr[i], 16);//Serial.print(" ");}dmxB.setChans(dd);} else {Serial.print("pkg err");}//  Serial.println("ok");
}// 10 steps with 10 channels in each
//byte dmxChase[][10] = { { 255, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
//  { 0, 255, 0, 0, 0, 0, 0, 0, 0, 0 },
//  { 0, 0, 255, 0, 0, 0, 0, 0, 0, 0 },
//  { 0, 0, 0, 255, 0, 0, 0, 0, 0, 0 },
//  { 0, 0, 0, 0, 255, 0, 0, 0, 0, 0 },
//  { 0, 0, 0, 0, 0, 255, 0, 0, 0, 0 },
//  { 0, 0, 0, 0, 0, 0, 255, 0, 0, 0 },
//  { 0, 0, 0, 0, 0, 0, 0, 255, 0, 0 },
//  { 0, 0, 0, 0, 0, 0, 0, 0, 255, 0 },
//  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 255},
//  { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
//  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
//};//===================================================
typedef unsigned long clock_t;
clock_t nowt ;
clock_t oldt;
unsigned char waitWIFI=0;
void setup() {pkg.dispatch_event = &on_pkg_data_ok;Serial.begin(256000);// Start dmxA, status LED on pin 12 with full intensity//dmxA.begin(12);//dmxA.begin();// Start dmxB, status LED on pin 13 with 75/255 intensity//dmxB.begin(13, 75);dmxB.begin();////nowt   =   millis();rw_KEY_setup(0);rw_ledblink_setup(2);if (start_on_key_down == 1) {rw_smartconfig_setup(1);} else {WiFi.mode(WIFI_STA);delay(1000);//WiFi.begin("robotnet", "robotnetpass");//WiFi.setAutoConnect(true);//WiFi.setAutoReconnect(true);while (WiFi.status() != WL_CONNECTED) {delay(1000);waitWIFI++;if(waitWIFI>10){Serial.printf("wifi wait time out.");break;}Serial.printf("wifi wait %d\n.",waitWIFI);}unsigned int localPort = 6454;      // local port to listen onSerial.printf("UDP server on port %d\n", localPort);Udp.begin(localPort);}oldt = nowt;
}unsigned char sbuf[16];
void loop() {nowt   =   millis();clock_t dis ;if (nowt >= oldt) {dis = nowt - oldt;} else {dis = (~oldt - 1) + nowt;}rw_run((int)dis);int packetSize = Udp.parsePacket();//Serial.println("packetSize");//Serial.println(packetSize);if (packetSize) {//    Serial.printf("Received packet of size %d from %s:%d\n    (to %s:%d, free heap = %d B)\n",//                  packetSize,//                  Udp.remoteIP().toString().c_str(), Udp.remotePort(),//                  Udp.destinationIP().toString().c_str(), Udp.localPort(),//                  ESP.getFreeHeap());int n = Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE);packetBuffer[n] = 0;//    Serial.print("lenth=");//    Serial.println(n);//    Serial.println("Contents:");//    for (int i = 0; i < n; i++) {//      Serial.write(packetBuffer[i]);//    }pkg.writeArrayToBuf((unsigned char *)packetBuffer, n);}while (Serial.available()) {int numdata = Serial.readBytes(sbuf, 1);//Serial.write( sbuf[0]);pkg.writeArrayToBuf(sbuf, numdata);//Serial.write( pkg.getDatLen() );}//  for (int i = 0; i < 10; i++) {////    // Output channels 1 - 10 on dmxA//    dmxA.setChans(dmxChase[i], 10, 1);////    // Map values 1-5 to dmx channels 101 - 105 on dmxB//    dmxB.setChans(dmxChase[i], 5, 101);////    // 1 second between each step//    delay(1000);//  }//////  for (int i = 0; i < 170; i++) {////    int id = i * 3 ;//    dmxWrite(id, 0xff);//    dmxWrite(id + 1, 0x00);//    dmxWrite(id + 2, 0x00);////  }//  dmxB.setChans(dd);//  delay(1000);//  for (int i = 0; i < 170; i++) {////    int id = i * 3 ;//    dmxWrite(id, 0x00);//    dmxWrite(id + 1, 0x00);//    dmxWrite(id + 2, 0xff);////  }//  dmxB.setChans(dd);//  delay(1000);//  for (int i = 0; i < 170; i++) {////    int id = i * 3 ;//    dmxWrite(id, 0x00);//    dmxWrite(id + 1, 0xff);//    dmxWrite(id + 2, 0x00);////  }//  dmxB.setChans(dd);//  delay(1000);////  for (int i = 0; i < 170; i++) {////    int id = i * 3 ;//    dmxWrite(id, 0xff);//    dmxWrite(id + 1, 0xff);//    dmxWrite(id + 2, 0xff);////  }//  dmxB.setChans(dd);//  delay(1000);//  for (int i = 0; i < 170; i++) {////    int id = i * 3 ;//    dmxWrite(id, 0x00);//    dmxWrite(id + 1, 0x00);//    dmxWrite(id + 2, 0x00);////  }//  dmxB.setChans(dd);//  delay(1000);////  for (int i = 0; i < 170; i++) {////    int id = i * 3 ;//    dmxWrite(id, 0xff);//    dmxWrite(id + 1, 0xff);//    dmxWrite(id + 2, 0xff);//    dmxB.setChans(dd);//    Serial.println(i);//    if (i > 30 && i < 50)//      delay(500);//////  }//  dmxB.setChans(dd);//  delay(1000);////oldt = nowt;
}

If this is helpful and you're feeling generous, why not shout me a beer。呵呵,maotai也是极好的。

Arduino ESP8266 通过WiFi、串口与DMX灯光通讯相关推荐

  1. USB转ESP8266 01 WIFI串口模块 电脑无线通信单片机转接板烧录固件 AirKiss SmartConfig 智能配网

    ESP8266 01/01S USB串口转接板,用于跟WIFI调试软件工具通信,还可以烧录固件. 转接板图: 直接使用CH340G串口驱动,可以使用官方esp8266 调试工具发送指令进行设置. 烧写 ...

  2. Arduino ESP8266 清空WIFI配置信息

    #include <Arduino.h> #include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #incl ...

  3. Arduino结合ESP8266 Serial WIFI模块访问远程服务器

    参考资料:Control LED from web app using ESP8266 Serial WIFI module 强力推荐,单片机/Arduino 实现物联的启蒙教程,下文基本是对这篇教程 ...

  4. 《Arduino实验》实验:ESP8266连接WiFi并连接贝壳物联平台

    文章目录 实验内容 实验器件 实验连线 实验步骤 实验代码 实验结果 实验内容 使用 ESP8266 连接 WIFI 或者热点,并连接贝壳物联平台 实验器件 arduino UNO X 1 ESP82 ...

  5. 用Arduino和esp8266检测WIFI信号强度

    用Arduino和esp8266检测WIFI信号强度 用Arduino和esp8266检测WIFI信号强度 本文章是记录我个人在做 ESP8266和arduino之间的通信的过程和心得,我将其分享给大 ...

  6. arduino UNO通过AT指令控制esp8266连接WiFi及onenet云平台

    写下这篇文章是为了记录我学习使用esp8266的过程.在本文中我们会使用AT指令通过MQTT协议连接onenet云平台 开篇必看 1)关于onenet MQTT设备创建 在设备连接onenet平台中, ...

  7. #硬件 #ESP8266 #固件 #WiFi Killer #Arduino #网络安全 #开源 使用ESP8266开发板制作WiFi Killer(WiFi PWN)

    注意:WiFi Killer 仅能用于自己学习研究,不能用于非法活动!切记! 目录 1.所需材料.文件列表 2.ESP8266模块简介 3.下载固件 4.安装串口驱动 4.1 下载 4.2 安装 5. ...

  8. arduino+ESP8266模块使用AT指令设置wifi

    原文链接:https://dsx2016.com/?p=1510 公众号:大师兄2016 前言 本文使用ESP8266模块结合arduino设置wifi通信 设备 ESP8066-01模块 ESP82 ...

  9. 【沧海拾昧】WiFi串口通信ESP8266模块基本介绍(附野火WiFi透传实例)

    #C0104 沧海茫茫千钟粟,且拾吾昧一微尘 --<沧海拾昧集>@CuPhoenix [阅前敬告] 沧海拾昧集仅做个人学习笔记之用,所述内容不专业不严谨不成体系 [如有问题必是本集记录有谬 ...

  10. 【常用模块】ESP8266 WIFI串口通信模块使用详解(实例:附STM32详细代码)

    物联网,万物互联.这里涉及到的最基本的东西就是如何将所有的物联网设备连接在一起.最简单.最广泛使用的就是互联网. ESP8266 WIFI串口通信模块应该是使用最广泛的一种WIFI模块之一了.为什么呢 ...

最新文章

  1. mass Framework在后端的核心模块
  2. 什么是latex科技排版系统,有对比word有何不同?
  3. 突发:Maze 勒索团伙公开 LG 和 Xerox 的内部数据,达数十GB
  4. 变量存储list python_Python变量类型(八)
  5. 通过Javascript Facebook API获取Facebook用户信息,以及当前用户的好
  6. ArcGIS.Server.9.2.DotNet实现EditorTask功能扩展(自带例子 十、三)
  7. FastAPI 对用户文件的管理(上传、下载、删除)
  8. 微机原理、计算机组成原理与计算机体系结构之间的关系
  9. 给网页加一个全屏转场动画 HTML JS
  10. 数码管显示 0-9999计数器
  11. 父子盒子边距塌陷之为什么设置margin-top父子盒子会一起移动
  12. matlab gram schmidt,如何在 MATLAB 中用 行代码实现 Gram-Schmidt 正交化
  13. c语言帮助记忆单词的小程序,帮助记忆单词的书课堂活动微信小程序软件_速记背单词...
  14. zabbix 内存溢出 解决
  15. 【删库跑路】使用Binlog日志恢复误删的MySQL数据
  16. refers to an unmapped class
  17. 利用军刀打造成自己的后门-转
  18. 会声会影X7安装中的问题
  19. 关于如何用大数据做“用户画像”调查报告(持续更新)
  20. linux ssl证书卸载,Linux的ssl证书安装教程

热门文章

  1. 手机数字雨_cmd命令数字雨教程
  2. 吴恩达机器学习笔记——线性代数知识回顾、梯度下降、多项式线性回归、正则方程
  3. 一个超厉害的在线画图工具
  4. iis启动服务时提示在本地计算机 无法启动iis admin服务,iis 依存服务和组没法启动...
  5. (转)电脑内外接口全程图解
  6. 遥感、GIS、计算机视频教程
  7. c语言文学研究助手报告,文学研究助手数据结构报告
  8. STM32神舟III号 驱动直流电机学习(一)
  9. 【工具】 Wget网页图片下载利器
  10. Java 运行环境的安装、配置与运行