本帖最后由 ciasdmxhxjjpd@c 于 2022-8-11 23:23 编辑
RT,
买的林内,比较早,不带wifi,今天拆洗,发现 控制面版与主控之间 有 4根线,第一反应应该是 uart。
面板采用的芯片采用的是mb95f564kn,https://max.book118.com/html/2021/0614/8012012111003110.shtm
TOP-20 封装。
接口从左到右,分别是 gnd - vcc(5v) - tx - rx
各引脚对应关系。
rx - 16pin
tx - 15pin
程序每秒发一个 查询状态命令,当查询到状态时,数码管亮,否则,不亮。
比较操蛋,上电,不恢复上一次的结果。
用esp32 调试了下 。发现下面的命令 。
# 开关 toggle
0x02,0x55,0x20,0x03,0x37,0x38,0x0D
# 温度 -
0x02,0x55,0x31,0x03,0x38,0x39,0x0D
# 温度 +
0x02,0x55,0x30,0x03,0x38,0x38,0x0D
# echo toggle
0x02,0x55,0x29,0x03,0x38,0x31,0x0D
# 查询状态命令
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x03,0x32,0x38,0x0D
# 返回的数据。
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x30,0x30,0x46,0x30,0x35,0x03,0x36,0x33,0x0D 41 摄氏度
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x30,0x30,0x46,0x30,0x34,0x03,0x36,0x32,0x0D 40 摄氏度
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x30,0x30,0x46,0x30,0x33,0x03,0x36,0x31,0x0D 39 摄氏度
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x30,0x30,0x46,0x30,0x32,0x03,0x36,0x30,0x0D 38 摄氏度
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x30,0x30,0x46,0x30,0x31,0x03,0x35,0x46,0x0D 37 摄氏度
# 带 echo的
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x32,0x30,0x46,0x30,0x34,0x03,0x36,0x34,0x0D echo -> 40 摄氏度
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x32,0x30,0x46,0x30,0x33,0x03,0x36,0x33,0x0D echo -> 39 摄氏度
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x32,0x30,0x46,0x30,0x32,0x03,0x36,0x32,0x0D echo -> 38 摄氏度
# 关闭后,返回的数据
0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x30,0x30,0x31,0x31,0x31,0x31,0x03,0x34,0x43,0x0D off
esphome
uart:
- id: from_master
baud_rate: 9600
tx_pin: GPIO16
# rx_pin: GPIO17
# debug:
# direction: BOTH
# dummy_receiver: true
switch:
# off
- platform: template
name: gas off/on
id: gas_off
optimistic: true
lambda: "return id(gas_off).state;"
turn_on_action:
- uart.write: [0x02,0x55,0x20,0x03,0x37,0x38,0x0D]
turn_off_action:
- uart.write: [0x02,0x55,0x20,0x03,0x37,0x38,0x0D]
- platform: template
name: echo
id: echo
optimistic: true
lambda: "return id(echo).state;"
turn_on_action:
- uart.write: [0x02,0x55,0x29,0x03,0x38,0x31,0x0D]
- delay: 1s
- switch.turn_off: echo
- platform: template
name: gas +
id: gas
optimistic: true
lambda: "return id(gas).state;"
turn_on_action:
- uart.write: [0x02,0x55,0x30,0x03,0x38,0x38,0x0D]
- delay: 1s
- switch.turn_off: gas
- platform: template
name: gas -
id: gas7
optimistic: true
lambda: "return id(gas7).state;"
turn_on_action:
- uart.write: [0x02,0x55,0x31,0x03,0x38,0x39,0x0D]
- delay: 1s
- switch.turn_off: gas7
# 循环发查询命令,保证获取最新的状态。
interval:
- interval: 900ms
then:
- uart.write: [0x02,0xF6,0x30,0x34,0x38,0x30,0x30,0x33,0x03,0x32,0x38,0x0D]
binary_sensor:
- platform: gpio
pin: GPIO25
name: gas heater on/off
# 物理按键延时抖动消除
filters:
- delayed_on: 100ms
- delayed_off: 100ms
- delayed_on_off: 100ms
on_state:
- delay: 100ms
- uart.write: [0x02,0x55,0x20,0x03,0x37,0x38,0x0D]
- platform: gpio
pin: GPIO26
name: gas heater temp +
filters:
- delayed_on: 100ms
- delayed_off: 100ms
- delayed_on_off: 100ms
on_state:
- delay: 100ms
- uart.write: [0x02,0x55,0x30,0x03,0x38,0x38,0x0D]
- platform: gpio
pin: GPIO27
name: gas heater temp -
filters:
- delayed_on: 100ms
- delayed_off: 100ms
- delayed_on_off: 100ms
on_state:
- delay: 100ms
- uart.write: [0x02,0x55,0x31,0x03,0x38,0x39,0x0D]
# not realize
- platform: gpio
pin: GPIO21
name: gas heater eco
filters:
- delayed_on: 100ms
- delayed_off: 100ms
- delayed_on_off: 100ms
on_state:
- delay: 100ms
- uart.write: [0x02,0x55,0x29,0x03,0x38,0x31,0x0D]
硬件上 要 把 面板上 的 tx 去掉。背面,jp11 的0欧姆电阻拿掉。因为uart只能 1对1 通信。不能同时有2个tx,但可以有2个rx。
现在有个问题,不能使用面版上的按键了。因为 tx 被拿掉了。可能需要找到面版上4个按键对应的io口,然后通过飞线接入esp32
分析按键引脚和 控制芯片之间的关系。
up/down - 12pin adc 根据电压值区分
运行/echo - 14pin adc 根据电压值区分
只需要接2根飞线给esp32 的 adc 口。
请大佬帮忙分析返回码的格式,谢谢。准备写一个外部的组建来读取查询的返回值。
========================================================================================gengxinxinan-======================================
4个按键,每2个,通过 adc 接入控制芯片,分别按下 开机/ eco ,用万用表量了下 输入给控制芯片的电压都差不多,1.045v左右,不知道小日本是通过什么方式判断是不同的按键输入。
猜测可能是通过瞬间峰值电压判断的。因为每个按键都通过一个共阳或共阴二极管接到5v,每个按键处,量的电压相差 0.2v左右。
如果能通过esphome模拟按键输入,就可以不用这么麻烦了。
物理按键接入esp32, 要4根线,需要改电路。原电路是2个按键一起,接入adc,接入esp32,要把他们分开。
按键处理还是有问题,直接接入后,测定电压只有1v左右,不够判定高电平的标准。
完美解决办法,就是重新打板,电路其实非常简单。可能要在esphome里处理下2 位数码管显示问题。
|