esp01s改造老旧吸尘器连入天猫精灵语音控制(blinker + 阿里云)

news/2024/11/29 8:35:54/

esp01s改造老旧吸尘器连入天猫精灵语音控制

esp01s改造老旧吸尘器连入天猫精灵语音控制
利用esp01s加红外遥控二极管,实现天猫精灵语音控制扫地机(科沃斯CEN540)启动、回充

1、用到的元器件

  1. esp01s模块
  2. 红外led灯
  3. NPN三极管s8050,1个
  4. 限流电阻200——500Ω均可,2个

2、电路

s8050发射极接esp01s的GND,基极接限流电阻后接esp01s的3脚(RXD),集电极接限流电阻,再接led负极回到esp01s的VCC,esp01s模块从扫地机内esp_wroom模块取电。

3、代码

#define BLINKER_WIFI
#define BLINKER_ALIGENIE_OUTLET
#define BLINKER_WIFI_MULTI
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <Blinker.h>char auth[] = "xxx";
char ssid[] = "TP-LINK_46AB";
char pswd[] = "xxx..";char ssid1[] = "TP_LINK_820F";
char pswd1[] = "xxx";char ssid2[] = "sxbctvnet-ehh24";
char pswd2[] = "xxx";const uint16_t kIrLed = 3;  // RXD.IRsend irsend(kIrLed);  // Set the GPIO to be used to sending the message.//红外遥控指令
//上
uint16_t upData[67] = {9014, 4538,  634, 498,  554, 572,  554, 596,  534, 596,  534, 576,  552, 596,  534, 1708,  550, 596,  532, 1750,  508, 598,  530, 1726,  532, 598,  530, 1728,  542, 586,  542, 1738,  526, 602,  528, 576,  554, 1730,  532, 574,  556, 1728,  534, 594,  534, 1724,  534, 594,  534, 1724,  538, 1722,  532, 596,  532, 1752,  508, 596,  532, 1726,  532, 598,  530, 1750,  506, 598,  550};  // NEC 2AA55AA
//下
uint16_t downData[67] = {9010, 4526,  572, 556,  572, 578,  550, 578,  550, 558,  572, 558,  570, 558,  570, 1708,  550, 562,  568, 1736,  524, 606,  524, 1734,  522, 582,  548, 1734,  526, 580,  550, 1734,  498, 630,  500, 628,  502, 1758,  546, 1688,  574, 556,  574, 578,  550, 1708,  550, 1710,  550, 580,  550, 1692,  568, 562,  568, 580,  548, 1736,  524, 1736,  524, 606,  524, 606,  522, 1712,  524};  // NEC 2AA6699
//左
uint16_t leftData[67] = {9018, 4542,  556, 594,  534, 596,  534, 594,  534, 594,  534, 594,  534, 576,  554, 1726,  532, 596,  534, 1750,  506, 622,  508, 1728,  530, 620,  506, 1728,  530, 598,  546, 1714,  550, 576,  554, 600,  528, 576,  554, 1708,  554, 1704,  556, 574,  556, 572,  556, 1724,  534, 1704,  554, 1724,  534, 1750,  506, 622,  506, 622,  508, 1726,  532, 1728,  530, 598,  530, 622,  524};  // NEC 2AA33CC
//右
uint16_t rightData[67] = {9016, 4564,  532, 574,  554, 574,  554, 596,  532, 576,  552, 578,  552, 596,  534, 1726,  532, 596,  532, 1750,  506, 598,  530, 1752,  506, 622,  506, 1728,  524, 604,  524, 1756,  526, 578,  550, 578,  552, 1706,  556, 574,  554, 574,  556, 572,  558, 1702,  558, 596,  532, 572,  556, 1726,  530, 578,  552, 1726,  532, 1752,  506, 1726,  530, 600,  530, 1730,  528, 1748,  524};  // NEC 2AA44BB
//CLEAN
uint16_t clearData[67] = {8990, 4538,  558, 596,  534, 594,  534, 576,  554, 596,  534, 576,  554, 596,  534, 1726,  534, 596,  534, 1750,  508, 598,  530, 1752,  508, 598,  532, 1750,  500, 628,  520, 1738,  526, 578,  552, 600,  528, 576,  554, 1706,  554, 596,  534, 572,  558, 594,  534, 1724,  534, 596,  532, 1704,  554, 1706,  550, 596,  534, 1726,  530, 1750,  508, 1726,  530, 622,  508, 1750,  524};  // NEC 2AA22DD
//PLAN
//uint16_t rawData[99] = {9020, 4566,  532, 596,  534, 596,  534, 596,  534, 576,  552, 576,  556, 594,  534, 1726,  534, 580,  550, 596,  534, 1730,  530, 622,  508, 1728,  532, 622,  508, 1728,  546, 584,  546, 1736,  528, 578,  554, 600,  530, 600,  530, 600,  532, 574,  556, 574,  556, 572,  558, 570,  558, 1726,  534, 1728,  534, 1726,  534, 1726,  532, 1752,  508, 1730,  530, 1754,  506, 1726,  544, 1740,  526, 578,  552, 602,  528, 576,  552, 600,  530, 576,  554, 576,  554, 574,  556, 1704,  556, 1726,  534, 596,  534, 1706,  556, 576,  552, 1728,  532, 1752,  508, 1730,  530};  // UNKNOWN 9AF51A45
//延边
uint16_t roundData[67] = {8996, 4568,  534, 576,  552, 578,  554, 598,  530, 598,  530, 578,  552, 598,  532, 1728,  532, 598,  530, 1734,  528, 600,  530, 1756,  506, 602,  528, 1732,  526, 604,  526, 1734,  548, 606,  526, 582,  548, 1710,  554, 1708,  552, 1706,  554, 578,  552, 1710,  550, 1730,  530, 1732,  530, 1754,  504, 600,  532, 600,  528, 600,  528, 1730,  528, 600,  530, 602,  526, 604,  524};  // NEC 2AA7788
//回充
uint16_t gohomeData[67] = {9020, 4544,  554, 576,  554, 596,  532, 576,  554, 578,  552, 598,  532, 596,  532, 1728,  532, 598,  532, 1726,  532, 622,  506, 1728,  530, 624,  508, 1750,  500, 628,  500, 1734,  548, 582,  548, 1734,  532, 574,  554, 598,  530, 598,  532, 1728,  532, 596,  532, 596,  532, 598,  532, 596,  536, 1722,  532, 1726,  532, 1728,  530, 622,  506, 1732,  528, 1754,  506, 1732,  548};  // NEC 2AA8877
//定点
uint16_t rawData[67] = {9018, 4566,  530, 576,  554, 578,  552, 598,  532, 576,  554, 598,  532, 598,  532, 1710,  548, 598,  532, 1732,  526, 624,  506, 1754,  504, 626,  504, 1754,  504, 602,  524, 1756,  526, 602,  526, 1708,  550, 580,  552, 576,  554, 1706,  554, 1728,  532, 598,  532, 598,  532, 1706,  554, 596,  532, 1728,  532, 1730,  530, 600,  530, 602,  528, 1732,  528, 1754,  504, 626,  502};  // NEC 2AA9966BlinkerButton ButtonUp("btn-up");
BlinkerButton ButtonDown("btn-down");
BlinkerButton ButtonLeft("btn-left");
BlinkerButton ButtonRight("btn-right");
BlinkerButton ButtonClear("btn-clear");
BlinkerButton ButtonRound("btn-round");
BlinkerButton ButtonGohome("btn-gohome");
BlinkerButton ButtonRaw("btn-raw");
BlinkerNumber Number1("num-abc");int counter = 0;void buttonup_callback(const String & state)
{irsend.sendRaw(upData, 67, 38);BLINKER_LOG("up");
}
void buttondown_callback(const String & state)
{irsend.sendRaw(downData, 67, 38);BLINKER_LOG("down");
}
void buttonleft_callback(const String & state)
{irsend.sendRaw(leftData, 67, 38);BLINKER_LOG("left");
}
void buttonright_callback(const String & state)
{irsend.sendRaw(rightData, 67, 38);BLINKER_LOG("right");
}
void buttonclear_callback(const String & state)
{irsend.sendRaw(clearData, 67, 38);BLINKER_LOG("clear");
}
void buttonround_callback(const String & state)
{irsend.sendRaw(roundData, 67, 38);BLINKER_LOG("round");
}
void buttongohome_callback(const String & state)
{irsend.sendRaw(gohomeData, 67, 38);BLINKER_LOG("gohome");
}
void buttonraw_callback(const String & state)
{irsend.sendRaw(rawData, 67, 38);BLINKER_LOG("raw");
}void dataRead(const String & data)
{BLINKER_LOG("Blinker readString: ", data);counter++;Number1.print(counter);
}void aligeniePowerState(const String & state)
{BLINKER_LOG("need set power state: ", state);if (state == BLINKER_CMD_ON) {irsend.sendRaw(clearData, 67, 38);//发送启动指令BLINKER_LOG("on");BlinkerAliGenie.powerState("on");BlinkerAliGenie.print();delay(10000);irsend.sendRaw(downData, 67, 38);//开启强力模式BLINKER_LOG("max");}else if (state == BLINKER_CMD_OFF) {irsend.sendRaw(gohomeData, 67, 38);//发送回充指令BlinkerAliGenie.powerState("off");BlinkerAliGenie.print();BLINKER_LOG("off");}
}void heartbeat()
{BLINKER_LOG("heartbeat!");
}void setup(){Serial.begin(115200);BLINKER_DEBUG.stream(Serial);BLINKER_DEBUG.debugAll();irsend.begin(); digitalWrite(2,HIGH);//关闭板载LEDBlinker.addAP(ssid2, pswd2);Blinker.addAP(ssid1, pswd1);Blinker.begin(auth, ssid, pswd);Blinker.attachData(dataRead);ButtonUp.attach(buttonup_callback);ButtonDown.attach(buttondown_callback);ButtonLeft.attach(buttonleft_callback);ButtonRight.attach(buttonright_callback);ButtonClear.attach(buttonclear_callback);ButtonRound.attach(buttonround_callback);ButtonGohome.attach(buttongohome_callback);ButtonRaw.attach(buttonraw_callback);Blinker.attachHeartbeat(heartbeat);BlinkerAliGenie.attachPowerState(aligeniePowerState);
}void loop(){Blinker.run();
}

Blinker端

在这里插入图片描述


http://www.ppmy.cn/news/859780.html

相关文章

word转换为html代码,word转换为Html工具

word转换为Html工具是文本处理频道下深受用户喜爱的软件&#xff0c;太平洋下载中心提供word转换为Html工具官方下载。 word转换为Html工具官方版是一个功能强大的Word格式转换为HTML格式工具&#xff0c;word转换为Html工具官方版可以将MS Word文档存为HTML网页的工具软件.&am…

word转换html的软件,word转换为Html工具(Word Cleaner)

word转HTML转换器(Word Cleaner)将MS Word文档存为HTML网页的工具软件. 虽然 Microsfot Word 也能将 .DOC 文件另存为WEB页面格式, 但是它会增加许多“垃圾”代码&#xff0c;这个小工具能够为你自动去除这些“垃圾”代码。 最简单的方法来转换Word文件到干净漂亮的HTML 功能特…

word cleaner(word转html)5.2.1,Word Cleaner(word转html)

Word Cleaner 将 MS Word 文档存为 HTML 网页的工具软件. 虽然 Microsfot Word 也能将 .DOC 文件另存为WEB页面格式, 但是它会增加许多“垃圾”代码&#xff0c;这个小工具能够为你自动去除这些“垃圾”代码。 最简单的方法来转换Word文件到干净漂亮的HTML 单词清洁剂的完美工具…

word转换html 批量,Word批量转HTML工具

这是Word批量转HTML工具&#xff0c;可以搜索硬盘上的doc文件并批量转换成html的工具 。 软件介绍 word转HTML转换器(Word Cleaner)将MS Word文档存为HTML网页的工具软件. 虽然 Microsfot Word 也能将 .DOC 文件另存为WEB页面格式&#xff0c; 但是它会增加许多“垃圾”代码&am…

STM32单片机WIFI智能药盒缺药报警数目设定吃药检测

实践制作DIY- GC00157-WIFI智能药盒缺药报警 一、功能说明&#xff1a; 基于STM32单片机设计------WIFI智能药盒缺药报警 二、功能说明&#xff1a; STM32F103C系列最小系统板LCD1602显示器5路光敏电阻光强采集模块DS1302时钟模块5个按键ADXL345倾角模块蜂鸣器ESP8266-WIFI模…

Go 记录日志——log包

Golangs log模块主要提供了3类接口。分别是 “Print 、Panic 、Fatal ”&#xff0c;对每一类接口其提供了3中调用方式&#xff0c;分别是 "Xxxx 、 Xxxxln 、Xxxxf"&#xff0c;基本和fmt中的相关函数类似&#xff0c;下面是一个Print的示例&#xff1a; package m…

视频“高清”与“标清”技术标准区别

“高清”的定义&#xff0c;主要通过两个条件进行判断&#xff1a;一是原始画面比例需为16:9&#xff0c;传统4:3比例不能算“高清”&#xff1b;二是图像垂直方向的清晰度要达到720线以上&#xff0c;即只有720p、1080i和1080p的信号画面才能够称为“高清”&#xff0c;而像48…

UE4 如何做视屏清晰度(超清、高清、清晰、流畅)

创建Media Player&#xff0c;然后创建Media Texture 通过Media Texture创建Material 创建一个Render Target 再播放视屏的UI里面把视屏的Material画在Render Target内 最后将Render Target再生成其材质 将Render Target生成的材质放在UI内部 现在在Render Target内部就可以修…