Auta 楼宇对讲门禁系统
背景
由于现在住的公寓大楼对讲门禁装在客厅门外,而我平时又经常放音乐或在更里面的卧室睡觉,很难听到门铃,因此经常错过邮递员。于是打算将其接入 Home Assistant,出门也不用带钥匙了。
拆开外壳后,从 PCB 上的贴纸可以看到型号是 “auta 700105”。
Hacking
根据厂家官网提供的技术手册,接线柱 CON1
连着的四根入户线从左到右依次是 GND(黑)、+24 VDC 电源(褐)、麦克风(蓝)、扬声器与数据通信(灰)。CON2
通过一个 RJ11 接口连接了听筒。
将 PCB 拆下后,开始逆向电路。
各个 IC:
U1
是一颗 “78L05A” 稳压器,给其他元件提供了 +5 V 电源-
U2
是一颗 “PIC16F870-I/SO” MCU,实现了主要的功能控制 -
U3
是一颗 “ULN2003A” 达林顿管驱动,让 MCU 驱动外围功能电路- 通道 1:输入为 MCU 的 PIN27
RB6
,输出为听筒扬声器功放 - 通道 2:输入为 MCU 的 PIN26
RB5
,输出为继电器RY1
- 通道 3-7:输入为 MCU 的 PIN25
RB4
,输出为 CON1 接线柱上的 “Auxiliary bell (24 Vdc output, in call)”
- 通道 1:输入为 MCU 的 PIN27
U4
是一颗 “LM393” 电压比较器- 比较器 1 未被使用
- 正相输入 2:+12 V
- 反相输入 2:CON1 接线柱上的入户线 “扬声器与数据通信”
- 输出 2:MCU PIN23
U5
是一颗 “PC357NJ0000F” 光耦,输入端是 CON1 接线柱上的 “Ding-Dong function (tension free button)”,短接时下拉 MCU 的 PIN22RB1
MCU 引脚功能
- 1
MCLR
:复位 - 2
RA0
:铃声切换按钮PB1
输入(低电平触发) - 3
RA1
:红色 LED 输出 - 4
RA2
:绿色 LED 输出 - 5
RA3
:解锁门禁按钮PB2
输入(低电平触发) - 6
RA4
:AUX1 按钮(低电平触发) - 7
RA5
:解锁信号输出? - 8
Vss
:GND - 9
OSC1
, 10OSC2
:时钟晶振X1
输入 - 11
RC0
- 14RC3
:拨码开关SW1
5-8 位输入(低电平触发) - 15
RC4
- 18RC7
:拨码开关SW1
1-4 位输入(低电平触发) - 19
Vss
:GND - 20
Vdd
:+5 V 电源输入 - 21
RB0
:主从机选择跳线J1
输入(高电平为主机) - 22
RB1
:“Ding-Dong function (tension free button)” 光耦集电极输入(低电平触发) - 23
RB2
:门铃信号输入? - 24
RB3
:解锁信号输出? - 25
RB4
:“Auxiliary bell” 输出,通过驱动 ICU3
通道 3-7(高电平触发) - 26
RB5
:继电器输出,通过驱动 ICU3
通道 2(低电平触发) - 27
RB6
:听筒扬声器铃声输出,通过驱动 ICU3
通道 1 - 28
RB7
:挂机插簧开关BT1
输入(低电平为挂机)
可见 PIN5 RA3
可以用于解锁门禁,和 PIN27 RB6
可以用于检测门铃在响。
硬件
电路如图所示,由于 PIC 使用 5 V TTL,而 ESP8266 使用 3.3 V,需要通过一个电平转换器来连接:
安装
如图所示,通过方便焊接的几个触点分别引出 +5 V(紫)、GND(绿)、MCU PIN5(白) 和 PIN27(蓝):
由于附近已有一个 ESPHome 设备(全屋电能监控),直接修改复用了它(4-pin 杜邦线用于连接 PZEM 电能监控器):
通过一根废旧 USB 线缆连接:
软件
ESPHome 配置示例:
esphome:
name: building-intercom
comment: 'Auta building intercom and entry system hack'
esp8266:
board: d1_mini
preferences:
flash_write_interval: 10min
logger:
level: WARN
baud_rate: 115200
wifi:
fast_connect: true
networks:
- ssid: !secret wifi_ssid
bssid: !secret wifi_bssid
password: !secret wifi_password
api:
ota:
password: !secret ota_password
binary_sensor:
# 门铃传感器
- platform: gpio
pin: 12
id: intercom_ringing
name: '楼门门铃'
filters:
- delayed_off: 30s # 调整至实际响铃时间
icon: mdi:bell-outline
on_press:
- homeassistant.service:
service: script.building_intercom_ringing_notification
output:
# 下拉触发解锁按钮
- platform: gpio
id: intercom_unlock_door_button_output
pin:
number: 14
inverted: true
button:
# 暴露解锁按钮至 HASS 前端
- platform: output
id: building_door_unlock_button
name: '解锁楼门'
output: intercom_unlock_door_button_output
duration: 3s
icon: mdi:door
刷入固件后添加至 HASS:
在 HASS 建立一个 script,用于在门铃响的时候推送通知至手机:
alias: Building Intercom Ringing Notification
mode: restart
icon: mdi:bell-outline
sequence:
- service: notify.mobile_app_phone # 目标手机
data:
message: '楼门门铃响了'
data:
push:
sound:
name: default
critical: 1
volume: 1
actions:
# 解锁按钮
- action: UNLOCK_BUILDING_DOOR
title: '解锁'
destructive: true # 显示为红色
再建立一个 automation,用于接收通知中的解锁按钮事件(以下 YAML 仅为展示配置,应通过图形界面创建):
alias: Unlock Building Door by Notification Callback
mode: restart
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: UNLOCK_BUILDING_DOOR
condition: []
action:
- device_id: f13cff1a6a2eb06cbd79e584e91f2e21
domain: button
entity_id: button.unlock_building_door
type: press
0 Comments