『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 50201|回复: 89

[教程系列] Node-RED+ESP8266(tasmota)+LCD1602打造低成本提醒显示器

  [复制链接]

6

主题

76

帖子

712

积分

论坛DIY达人

积分
712
金钱
631
HASS币
20
发表于 2019-9-4 11:35:15 | 显示全部楼层 |阅读模式
本帖最后由 渗透之王 于 2021-11-1 20:52 编辑

声音提醒虽然好,但有不适合的场景,比如,孩子在睡觉,突然播放音乐?播放开门提醒?自动背古诗?
也许你会和我一样,想要一个悄无声息的提醒器
1、准备材料:
硬件:nodemcu、LCD1602、IIC-1602转接板


nodemcu

nodemcu

LCD 1602

LCD 1602

转接板连接1602

转接板连接1602

nodemcu价格

nodemcu价格

1602价格

1602价格

转接板价格

转接板价格


OK,11.6+3.5+1.3,数学不好,不算了,当然还有USB线+5V充电器

软件:
node-red
nodemcu pyflasher
tasmota固件 sonoff-display .zip (346.43 KB, 下载次数: 65)
2、烧写固件:这个不是重点,泛泛的截个操作图,
不放心还是说两个重点吧,
a:上电前nodemcu GPIO0要置低(flash按下)
b:选擦除全部固件
如果你一点都不懂,那在论坛搜索“刷Tasmota固件”
如果英文还不错,那我直接放出官方的说明书:https://github.com/arendst/Sonoff-Tasmota/wiki
[size=1.25em]How to start
You will need some tools to prepare your device for flashing Tasmota and connect it to your Wi-Fi network and MQTT broker.

111.png



3、配置端口并连接硬件

配置

配置

连接1

连接1

连接2

连接2

此时重启后,是不是看见时间显示了?对,这默认相当于是DIY一个电子时钟了。
(说句不该说的,既然是时钟,那时间一定要准,时区不对,串口发命令backlog Timezone 8更改时区,OK)
eee.png
4、修改LCD显示模式
backlog  DisplayMode 0
大功告成!
此时可以通过DisplayText命令显示字母了 [z]是清除 [o]是关屏幕 [O]是开屏幕
DisplayText parameters
In the list below p stands for parameter and may be a number from 1 to n digits. On monochrome graphic displays things are drawn into a local frame buffer and sent to the display either via the dcommand or automatically at the end of the command.
Positioning
lp = sets a character line to print at (on LCD display p = {0…}, on TFT display p = {1…})
cp = sets a character column to print at (on LCD display p = {0…}, on TFT display p = {1…})
xp = sets the x position for consecutive prints
yp = sets the y position for consecutive prints
Text is printed at the last provided position, either l or y for the vertical position, and either x or x for the horizontal position. Neither x nor y are advanced/updated after printing text.
Line primitives
hp = draws a horizontal line with length p (x is advanced)
vp = draws a vertical line with length p (y is advanced)
Lp:p = draws a line top:p (x,y are advanced)
kp = draws a circle with radius p
Kp = draws a filled circle with radius p
rp:p = draws a rectangle with p with and p height
Rp:p = draws a filled rectangle with p with and p height
up:p:p = draws a rounded rectangle with p with, p height and p radius
Up:p:p = draws a filled rounded rectangle with p with, p height and p radius
Miscellaneous
z = clear the display
i = (re)init the display (in e-Paper mode with partial update)
I = (re)init the display (in e-Paper mode with full update)
d = update the display
Dp = switch display auto updates on(p=1)/off(p=0), when off display must be updated with d
o = switch display off
O = switch display on
ap = p (0..3) set rotation angle
t = display Tasmota time in HH:MM
tS = display Tasmota time in HH:MM:SS
T = display Tasmota date in DD.MM.YY
pp = pad text with spaces, positive values align left, negative values align right
sp = set text scaling for classic GFX font (scaling factor 1...N)
fp = set font (1=12, 2=24,(opt 3=8)) if font==0 the classic GFX font is used, if font==7 RA8876 internal font is used
Cp = set foreground color (0,1) for black or white and RGB decimal code for color
Bp = set background color (0,1) for black or white and RGB decimal code for color
Cip = set foreground index color (0..18) for color displays (see index color table below)
Bip = set background index color (0..18) for color displays (see index color table below)
wp = draws an analog watch with radius p (#define USE_AWATCH)
Pfilename: = display an rgb 16-bit color image when SD card file system is present


5、node-red流程

文字介绍流程,MQTT中转一下,将数据进行处理,并增加一连串操作。具体为:
a、当收到字符串时,点亮屏幕并显示,10S后背光熄灭,20S后文字清空,和断电状态一样
b、当字符串长度小于16时,在第1行居中显示,当长度大于16时,在第2行显示


666.png

放"字符串处理"代码:
var l=msg.payload.length;
var temp='                ';
if(l<=16)
{
    var kong_len=(16-l)/2;
    msg.payload = '[O][z][x0y0]' + temp.substring(0,kong_len)+msg.payload;
}
else
{
    msg.payload = '[O][z][x0y0]'+msg.payload.substring(0,16)+'[x0y1]'+msg.payload.substring(16,32)
}
return msg;    


node-red流程导出,只需要修改成你自己的MQTT Broker 即可
游客,如果您要查看本帖隐藏内容请回复
[/hide]
效果展示:
z.png x.png c.png
放在桌面,键盘前,不会显得太乱,在办公时,屏幕亮自然会关注一下!

1111.png 1112.png

sonoff-display20211101.json

5.37 KB, 下载次数: 16

评分

参与人数 2金钱 +30 HASS币 +20 收起 理由
showphi + 10 厉害了word楼主!
+ 20 + 20 厉害了word楼主!

查看全部评分

回复

使用道具 举报

2

主题

33

帖子

322

积分

中级会员

挖煤的猫

Rank: 3Rank: 3

积分
322
金钱
289
HASS币
0
发表于 2019-9-4 11:48:26 | 显示全部楼层
不错不错,,,,
回复

使用道具 举报

1

主题

237

帖子

962

积分

论坛积极会员

积分
962
金钱
725
HASS币
0
发表于 2019-9-4 11:52:35 | 显示全部楼层
这个实用。关键物料我都还有  , 落灰2年了
回复

使用道具 举报

23

主题

1328

帖子

6523

积分

超级版主

Rank: 8Rank: 8

积分
6523
金钱
5170
HASS币
100

教程狂人

发表于 2019-9-4 15:20:12 | 显示全部楼层
非常实用,点个32个赞
回复

使用道具 举报

0

主题

316

帖子

1732

积分

金牌会员

Rank: 6Rank: 6

积分
1732
金钱
1416
HASS币
0
发表于 2019-9-4 16:39:02 | 显示全部楼层
一斤猪肉六分之一的钱又可以快乐折腾了
回复

使用道具 举报

0

主题

204

帖子

1035

积分

金牌会员

Rank: 6Rank: 6

积分
1035
金钱
831
HASS币
0
发表于 2019-9-4 18:29:59 | 显示全部楼层
谢谢分享
回复

使用道具 举报

0

主题

128

帖子

1260

积分

金牌会员

Rank: 6Rank: 6

积分
1260
金钱
1132
HASS币
0
发表于 2019-9-4 22:47:12 | 显示全部楼层
谢谢分享
回复

使用道具 举报

12

主题

260

帖子

1004

积分

金牌会员

Rank: 6Rank: 6

积分
1004
金钱
744
HASS币
0
发表于 2019-9-5 10:37:54 | 显示全部楼层
用esp01 比较好,小巧
回复

使用道具 举报

6

主题

95

帖子

1199

积分

金牌会员

Rank: 6Rank: 6

积分
1199
金钱
1104
HASS币
0
发表于 2019-9-5 15:26:37 | 显示全部楼层
收藏学习
回复

使用道具 举报

6

主题

76

帖子

712

积分

论坛DIY达人

积分
712
金钱
631
HASS币
20
 楼主| 发表于 2019-9-5 19:21:32 | 显示全部楼层
tang5275 发表于 2019-9-5 10:37
用esp01 比较好,小巧

是的,esp01小巧,Nodemcu方便快捷
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-19 19:48 , Processed in 0.097534 second(s), 36 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表