---
title: "SecuritySensor4ToMQTT"
url: "https://maker.wiznet.io/Lihan__/projects/securitysensor4tomqtt/"
markdown_url: "https://maker.wiznet.io/Lihan__/projects/securitysensor4tomqtt/md"
type: "UCC: User Created Content"
author: "SuperHouse"
author_url: "https://github.com/SuperHouse/SecuritySensor4ToMQTT"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "SuperHouse"
original_url: "https://github.com/SuperHouse/SecuritySensor4ToMQTT"
published: "2026-07-08"
language: "en"
likes: 0
views: 204
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# SecuritySensor4ToMQTT

> Arduino sketch to read the status of up to 4 security sensors using End Of Line resistors and push events to MQTT

Original author: SuperHouse (source: https://github.com/SuperHouse/SecuritySensor4ToMQTT)

## Article

## SecuritySensor4ToMQTT — Turning a Wired Alarm Loop into an MQTT Event Stream

`#HomeSecurity` `#MQTT` `#EOLResistor` `#AlarmPanel` `#Arduino` `#WIZnet` `#W5100` `#TOE` `#TCP` `#HomeAutomation`

> 📚 Context: Hobby / home-automation building block, published by **SuperHouse Automation Pty Ltd** (Jonathan Oxer) in 2015. A compact, single-sketch Arduino firmware. Implementation status: Code-complete and field-oriented — network bring-up, MAC-from-ROM, 6-state sensor supervision, and live MQTT publishing are all present in the sketch. The repository is code-only (no captured logs/screenshots), so behaviour is verified from the source, not from bundled test artifacts.

---

### 01 — What is this project?

Traditional wired intrusion alarms are wonderfully reliable but stubbornly closed. A classic panel sits in a cupboard, reads its End-of-Line (EOL) resistor loops, and — if you're lucky — dials a monitoring centre. Getting those same sensor states into a modern smart-home stack (Home Assistant, Node-RED, a phone dashboard) usually means either ripping the panel out or bolting on an expensive proprietary bridge.

**SecuritySensor4ToMQTT** takes the opposite approach: it *is* the panel, but it speaks MQTT natively. The firmware reads up to **four security sensors** wired with **End-of-Line resistors** into analog inputs, classifies each loop into one of six electrically-distinct states, and publishes every state change to an MQTT broker as a plain, easy-to-consume message.

Because it uses EOL resistors rather than simple dry contacts, it doesn't just know "open vs closed" — it can tell **Normal, Tamper, Alarm, Alarm+Tamper, Shorted, and Cut** apart by measuring where the analog reading lands. That is genuine alarm-grade supervision: a snipped wire or a shorted loop is reported as an event, not silently ignored.

The end result is a small, always-on box that turns a professional wired sensor topology into a stream of MQTT events any home-automation platform can subscribe to — with an optional on-device colour OLED for local status.

### 02 — Why MQTT + EOL supervision?

#### 🔷 EOL resistors = tamper-aware sensing, not just on/off

A dry-contact sensor gives you one bit. An EOL-resistor loop gives you a *value*. By placing a known resistor at the far end of the loop, the panel can distinguish a healthy "Normal" loop from an "Alarm" (contact opened), a "Tamper" (enclosure interfered with), a "Cut" wire, or a "Shorted" loop. The project encodes this directly as ADC threshold bands (0–162 Short, 163–409 Normal, 410–551 Tamper, 552–641 Alarm, 642–848 Alarm+Tamper, 849–1023 Cut). This is the difference between a hobby reed switch and a supervised security zone.

#### 🔷 MQTT = drop-in integration with the modern smart home

Rather than inventing a protocol, the firmware publishes to standard MQTT topics (`sensors` for state changes, `events` on startup). That means it works out-of-the-box with Mosquitto, Home Assistant, Node-RED, or any dashboard that speaks MQTT — no custom server, no polling, just lightweight pub/sub over a persistent TCP connection.

#### 🔷 Always-on, low-overhead, and cheap to duplicate

Each panel carries a `panelId`, so you can scatter several boxes around a building and let them all report to one broker with unambiguous message prefixes. The design is deliberately minimal — one sketch, a couple of libraries — which keeps it approachable and easy to reproduce.

### 03 — System architecture

![](https://maker.wiznet.io/upload/ckeditor5/410140266%5F1783932913%2Epng)

### 04 — Why WIZnet W5100? ⭐

#### 🔷 The technical core: a hardwired TCP/IP stack next to a small MCU

The panel runs on an ATmega2560-class Arduino board (the sketch uses digital pins up to 53 and an I2C MAC ROM, the hallmark of a Freetronics EtherMega-style board). That MCU has generous flash but only a few kilobytes of SRAM — and it is already busy continuously sampling four analog loops, running a state machine, driving an OLED, and maintaining an MQTT session. Handing the entire TCP/IP job to software would be the wrong trade.

The **WIZnet W5100** solves exactly this. It integrates a **hardwired TCP/IP core** (TCP, UDP, ICMP, IPv4, ARP) plus the 10/100 Ethernet MAC & PHY, exposes **4 independent hardware sockets** backed by a 16 KB internal TX/RX buffer, and connects to the MCU over **SPI**. The three-way handshake, retransmissions, checksums and ACKs all happen *inside the W5100 silicon* — the ATmega only reads and writes socket payloads.

#### 🔷 Socket mode used: **TOE TCP** (`Sn_MR_TCP`)

This project lives entirely in the W5100's **TCP Offload Engine (TOE) TCP mode**. The MQTT client (`PubSubClient`) opens a persistent TCP connection to the broker on port 1883 (`client.connect(...)`) and publishes over it (`client.publish("sensors", ...)`). No UDP, no MACRAW — just a rock-solid offloaded TCP session, which is exactly what a long-lived MQTT link to an always-on alarm panel wants.

#### 🔷 Advantage over the alternatives

Compared with a MAC+PHY-only chip like the **ENC28J60**, which forces a *software* TCP/IP stack (e.g. UIPEthernet) that consumes precious SRAM and CPU, the W5100 gives this panel a reliable network link at near-zero MCU cost. On a device that must never drop its alarm-reporting connection while simultaneously supervising four zones, that offload is the difference between "works on the bench" and "runs for months in a cupboard." It also drops straight into the standard Arduino `Ethernet` library, so the whole network layer is a handful of lines (`Ethernet.begin(mac)` and away it goes).

#### 🔷 Verified evidence ✅

- **Network bring-up in code**: `Ethernet.begin(mac)` (DHCP) and `Ethernet.begin(mac, ip)` (static) — both paths present. The source even comments the intent: *"setup the Ethernet library to talk to the Wiznet board."*

- **Live MQTT over TCP**: `PubSubClient client(server, 1883, callback)`, `client.connect(...)`, `client.publish("sensors", ...)` and a startup `client.publish("events", "Starting up")`.

- **Production-style identity**: unique MAC pulled from an I2C ROM (Microchip 24AA125E48) with a static fallback.

- **Genuine supervision**: six ADC threshold bands encode Short / Normal / Tamper / Alarm / Alarm+Tamper / Cut.

### 05 — Key components

#### 🌐 WIZnet W5100 — TOE TCP socket mode

The networking heart of the panel. Hardwired TCP/IP core with integrated MAC & PHY, 4 hardware sockets, 16 KB buffer, SPI host interface. Here it carries a single persistent **TOE TCP** connection to the MQTT broker.

#### 🧠 ATmega2560-class Arduino (Freetronics EtherMega-style)

Samples the four analog loops, runs the 6-state classifier, and hosts the MQTT client. Uses pins up to 53 → a Mega-class MCU rather than an Uno.

#### 📟 Microchip 24AA125E48 MAC ROM (I2C)

Provides a globally-unique, burned-in MAC address so multiple panels never collide on the network — read over I2C at boot.

#### 📚 PubSubClient (MQTT)

Lightweight Arduino MQTT client handling the publish/subscribe session to the broker.

#### 🖥️ Freetronics OLED128 (optional, FTOLED)

128×128 colour OLED for on-device status and event display when a headless box isn't desired.

#### 🔌 EOL-resistor sensor loops ×4

End-of-Line resistors turn each sensor into a supervised analog loop, enabling tamper/cut/short discrimination rather than plain open/closed.

### 06 — Application scenarios

**01. Retrofitting a legacy wired alarm into a smart home** Reuse existing EOL-resistor sensor wiring, but publish every zone change to MQTT so Home Assistant or Node-RED can automate lights, notifications, or sirens.

**02. Multi-zone home / small-office intrusion monitoring** Four supervised zones per box, with tamper and wire-cut detection — meaningful security coverage that a phone dashboard can watch in real time.

**03. Perimeter supervision that survives sabotage** Because the loop is supervised, a cut or shorted wire is itself an event. An intruder disabling a sensor triggers an alarm instead of a silent blind spot.

**04. Distributed panels across a building** Deploy several units, each with a distinct `panelId`, all publishing to one broker — a cheap way to cover a whole site while keeping messages unambiguous.

### Conclusion

> **A wired burglar-alarm loop is about as far from "networking gear" as home hardware gets — yet here a WIZnet W5100 quietly carries every alarm event onto the network, turning a closed panel into an open MQTT stream.**

- ✅ Four **supervised** EOL-resistor zones with six discriminated states (Normal / Tamper / Alarm / Alarm+Tamper / Short / Cut)

- ✅ Reliable, always-on network link via **WIZnet W5100** in **TOE TCP** mode — offloaded TCP at near-zero MCU cost

- ✅ Native **MQTT** pub/sub (`PubSubClient`) → drops straight into Home Assistant / Node-RED / any MQTT dashboard

- ✅ Production-style **unique MAC from I2C ROM** with DHCP-or-static flexibility

- ✅ Optional on-device colour OLED status without any extra host

- ✅ **Multi-panel scalable** via per-box `panelId`

- ✅ **Reach**: from FPGA firewalls to end-of-line alarm resistors, WIZnet silicon keeps turning up wherever something has to reliably talk IP — including inside a domestic security panel.

### 07 — Similar Projects on WIZnet Makers

The WIZnet Makers platform already hosts a small cluster of wired-security and sensor-to-broker projects. Placing SecuritySensor4ToMQTT among them shows a clear spectrum — from bare sensor demos to full supervised-and-published panels.

- **Intrusion detection system using W5100 + Arduino** — a W5100 + Arduino intrusion-detection build; the closest sibling in silicon and MCU family. (`maker.wiznet.io/WIZnet/projects/intrusion-detection-system-using-w5100-arduino/`)

- **A simple burglar Alarm: motion sensor, noise sensor and ethernet shield** — reads motion and noise sensors over an Ethernet shield; multi-sensor alarm, different sensing style. (`maker.wiznet.io/Alan/projects/a-simple-burglar-alarm...`)

- **Proof of Concept Door Alarm** — an Ethernet-shield door-alarm example, monitored via the Arduino platform. (`maker.wiznet.io/WIZnet/projects/proof-of-concept-door-alarm/`)

- **Arduino MEGA + Ethernet Shield + PIR** — a Mega-class board reading a PIR sensor and surfacing data to phone/desktop. (`maker.wiznet.io/WIZnet/projects/arduino-mega-ethernet-shield-pir/`)

- **Send data from DHT11 sensor using MQTT with Pi Pico and W5500** — the modern MQTT counterpart: a Pico + W5500 pushing sensor data over MQTT. (`maker.wiznet.io/wiz_chandana/projects/send-data-from-dht11-sensor-using-mqtt-with-pi-pico-and-w5500/`)

| Project | MCU | WIZnet chip | Sensing approach | Reporting method | Distinctive angle |
| --- | --- | --- | --- | --- | --- |
| **SecuritySensor4ToMQTT** (this) | ATmega2560 (Mega) | **W5100** | 4× EOL-resistor loops, 6 states | **MQTT** over TOE TCP | Supervised (tamper/cut) **and** MQTT-published |
| Intrusion detection (W5100 + Arduino) | Arduino | W5100 | Intrusion sensor(s) | Ethernet-connected | Same chip/MCU family; intrusion focus |
| Simple burglar Alarm (Alan) | Arduino | Ethernet shield (WIZnet) | Motion + noise sensors | Ethernet shield | Multi-sensor, non-supervised loops |
| Proof of Concept Door Alarm | Arduino | Ethernet shield (WIZnet) | Door sensor | Monitored via Arduino platform | Minimal PoC demo |
| Arduino MEGA + Ethernet + PIR | ATmega2560 (Mega) | Ethernet shield (WIZnet) | PIR motion | Phone / desktop view | Same board class; single PIR |
| DHT11 → MQTT (Pico + W5500) | RP2040 (Pico) | W5500 | DHT11 environmental | MQTT | Modern chip; telemetry, not security |

**Insight:** This ecosystem spans two axes — *sensing sophistication* (dry-contact/PIR demos vs. supervised EOL loops) and *reporting maturity* (view-on-a-web-page vs. MQTT pub/sub). Most of the security-domain entries sit at the demo end of one axis or the other. **SecuritySensor4ToMQTT is distinctive because it lands high on both at once**: genuine alarm-grade EOL supervision *and* clean MQTT integration. The DHT11+Pico+W5500 project shows where the platform's newer hardware takes the same sensor-to-broker pattern — but toward environmental telemetry rather than security. In short, this project is the "grown-up alarm panel" of the cluster.

### Q&A

**Q. Which WIZnet socket mode does this use, and why not UDP?** A. It uses **TOE TCP** (`Sn_MR_TCP`). MQTT rides on a persistent TCP connection, and for an always-on alarm reporter you want TCP's guaranteed, ordered delivery and connection awareness — a dropped/re-established session is itself information. UDP would trade that reliability away for latency the application doesn't need.

**Q. Does the W5100 do the TCP work, or the ATmega?** A. The **W5100** does it. Its hardwired TCP/IP core handles the handshake, retransmission, checksums and ACKs in silicon; the ATmega only reads/writes socket payloads over SPI. That offload is precisely why an 8 KB-SRAM MCU can comfortably supervise four zones *and* hold an MQTT link.

**Q. What makes the sensing "supervised" rather than a simple switch?** A. The End-of-Line resistors. By measuring the analog value of each loop (not just open/closed), the firmware distinguishes Normal, Tamper, Alarm, Short and Cut — so tampering or a severed wire is reported as an event instead of being silently missed.

**Q. Could this be moved to a newer WIZnet part?** A. Conceptually yes — the same TOE TCP / MQTT pattern maps cleanly onto W5100S or W5500 (as the Pico + W5500 sibling project demonstrates), which is a natural modernization path for anyone rebuilding this today.

---

---

## SecuritySensor4ToMQTT — 유선 알람 루프를 MQTT 이벤트 스트림으로

`#홈보안` `#MQTT` `#EOL저항` `#알람패널` `#Arduino` `#WIZnet` `#W5100` `#TOE` `#TCP` `#홈오토메이션`

> 📚 컨텍스트: **SuperHouse Automation Pty Ltd**(Jonathan Oxer)가 2015년에 공개한 홈 오토메이션용 빌딩 블록. 단일 스케치로 이뤄진 컴팩트한 Arduino 펌웨어. 구현 상태: 코드 완결 + 현장 지향형 — 네트워크 초기화, ROM에서 MAC 읽기, 6-상태 센서 감시, 실시간 MQTT 발행이 모두 스케치 안에 들어 있음. 저장소는 코드 전용(로그/스크린샷 없음)이라, 동작은 번들 테스트 산출물이 아니라 소스 코드로 검증했다.

---

### 01 — 이 프로젝트는 무엇인가?

전통적인 유선 침입 알람은 지독하게 신뢰성 높지만, 그만큼 지독하게 폐쇄적이다. 고전적인 패널은 벽장 안에 박혀 End-of-Line(EOL) 저항 루프를 읽고, 운이 좋으면 관제센터로 전화를 건다. 이 센서 상태들을 요즘 스마트홈 스택(Home Assistant, Node-RED, 폰 대시보드)으로 끌어오려면 대개 패널을 통째로 뜯어내거나, 비싼 독점 브리지를 덧붙여야 한다.

**SecuritySensor4ToMQTT**는 정반대로 접근한다. 이건 그 자체로 *패널이면서*, MQTT를 네이티브로 말한다. 펌웨어는 **EOL 저항**으로 배선된 최대 **4개의 보안 센서**를 아날로그 입력으로 읽어, 각 루프를 전기적으로 구분되는 6가지 상태 중 하나로 분류하고, 상태가 바뀔 때마다 MQTT 브로커로 소비하기 쉬운 평문 메시지를 발행한다.

단순 드라이 접점이 아니라 EOL 저항을 쓰기 때문에, "열림 vs 닫힘"만 아는 게 아니다. 아날로그 측정값이 어느 구간에 떨어지는지를 보고 **Normal(정상), Tamper(변조), Alarm(경보), Alarm+Tamper, Shorted(단락), Cut(절단)**을 구분한다. 이것이 진짜 알람 등급 감시다 — 잘린 배선이나 단락된 루프가 조용히 무시되지 않고 이벤트로 보고된다.

최종 결과물은 작고 항상 켜져 있는 박스 하나로, 전문가급 유선 센서 토폴로지를 어떤 홈 오토메이션 플랫폼이든 구독할 수 있는 MQTT 이벤트 스트림으로 바꿔준다. 원한다면 기기 자체 컬러 OLED로 로컬 상태 표시도 가능하다.

### 02 — 왜 MQTT + EOL 감시인가?

#### 🔷 EOL 저항 = 단순 on/off가 아니라 변조 감지가 되는 센싱

드라이 접점 센서는 1비트를 준다. EOL 저항 루프는 *값*을 준다. 루프 끝에 정해진 저항을 두면, 패널은 건강한 "Normal" 루프와 "Alarm"(접점 열림), "Tamper"(하우징 조작), "Cut"(배선 절단), "Shorted"(단락)을 구분할 수 있다. 이 프로젝트는 이걸 ADC 임계 구간으로 직접 인코딩한다(0–162 Short, 163–409 Normal, 410–551 Tamper, 552–641 Alarm, 642–848 Alarm+Tamper, 849–1023 Cut). 취미용 리드 스위치와 감시되는 보안 존(zone)의 차이가 바로 이것이다.

#### 🔷 MQTT = 요즘 스마트홈에 그대로 꽂히는 통합

프로토콜을 새로 발명하는 대신, 펌웨어는 표준 MQTT 토픽으로 발행한다(상태 변화는 `sensors`, 부팅 시엔 `events`). 덕분에 Mosquitto, Home Assistant, Node-RED, 또는 MQTT를 말하는 어떤 대시보드와도 별도 설정 없이 바로 동작한다 — 커스텀 서버도, 폴링도 없이, 지속적 TCP 연결 위에서 가벼운 pub/sub만 오간다.

#### 🔷 항상 켜져 있고, 오버헤드가 낮고, 복제가 싸다

각 패널은 `panelId`를 갖기 때문에, 여러 박스를 건물 곳곳에 뿌려 하나의 브로커로 명확한 메시지 접두사와 함께 보고하게 할 수 있다. 설계는 의도적으로 최소화돼 있다 — 스케치 하나, 라이브러리 몇 개 — 그래서 접근하기 쉽고 재현하기 쉽다.

### 03 — 시스템 아키텍처

![](https://maker.wiznet.io/upload/ckeditor5/410140266%5F1783932987%2Epng)

### 04 — 왜 WIZnet W5100인가? ⭐

#### 🔷 기술적 핵심: 작은 MCU 옆에 붙은 하드와이어드 TCP/IP 스택

패널은 ATmega2560급 Arduino 보드에서 돌아간다(스케치가 디지털 핀을 53번까지 쓰고 I2C MAC ROM을 사용 — Freetronics EtherMega 계열 보드의 특징). 이 MCU는 플래시는 넉넉하지만 SRAM은 몇 KB뿐이고, 이미 4개 아날로그 루프를 끊임없이 샘플링하고, 상태 머신을 돌리고, OLED를 구동하고, MQTT 세션을 유지하느라 바쁘다. TCP/IP 작업 전체를 소프트웨어에 떠넘기는 건 잘못된 선택이다.

**WIZnet W5100**이 바로 이 문제를 푼다. 하드와이어드 TCP/IP 코어(TCP, UDP, ICMP, IPv4, ARP)와 10/100 이더넷 MAC & PHY를 통합하고, 16 KB 내부 TX/RX 버퍼로 뒷받침되는 **4개 독립 하드웨어 소켓**을 제공하며, **SPI**로 MCU와 연결된다. 3-way 핸드셰이크, 재전송, 체크섬, ACK가 전부 *W5100 실리콘 내부*에서 처리되고, ATmega는 소켓 페이로드만 읽고 쓴다.

#### 🔷 사용 소켓 모드: **TOE TCP** (`Sn_MR_TCP`)

이 프로젝트는 전적으로 W5100의 **TCP Offload Engine(TOE) TCP 모드** 위에서 산다. MQTT 클라이언트(`PubSubClient`)가 브로커의 1883 포트로 지속적 TCP 연결을 열고(`client.connect(...)`), 그 위에서 발행한다(`client.publish("sensors", ...)`). UDP도, MACRAW도 아니다 — 오프로드된 견고한 TCP 세션 하나뿐이고, 이것이 항상 켜진 알람 패널의 장수(long-lived) MQTT 링크가 정확히 원하는 것이다.

#### 🔷 대체 솔루션 대비 우위

MAC+PHY만 있는 **ENC28J60** 같은 칩은 *소프트웨어* TCP/IP 스택(예: UIPEthernet)을 강제하고, 이는 귀한 SRAM과 CPU를 잡아먹는다. 반면 W5100은 이 패널에 거의 제로에 가까운 MCU 비용으로 신뢰성 있는 네트워크 링크를 준다. 4개 존을 감시하면서 알람 보고 연결을 절대 끊어선 안 되는 기기에서, 이 오프로드는 "실험실에서 됨"과 "벽장에서 몇 달을 돈다"의 차이다. 또한 표준 Arduino `Ethernet` 라이브러리에 그대로 꽂혀서, 네트워크 계층 전체가 몇 줄로 끝난다(`Ethernet.begin(mac)` 한 줄로 출발).

#### 🔷 검증된 증거 ✅

- **코드 내 네트워크 초기화**: `Ethernet.begin(mac)`(DHCP)와 `Ethernet.begin(mac, ip)`(고정) — 두 경로 모두 존재. 소스가 의도까지 주석으로 남김: *"setup the Ethernet library to talk to the Wiznet board."*

- **실시간 MQTT over TCP**: `PubSubClient client(server, 1883, callback)`, `client.connect(...)`, `client.publish("sensors", ...)`, 그리고 부팅 시 `client.publish("events", "Starting up")`.

- **양산형 아이덴티티**: I2C ROM(Microchip 24AA125E48)에서 읽어온 고유 MAC + 고정 MAC 폴백.

- **진짜 감시**: 6개 ADC 임계 구간이 Short / Normal / Tamper / Alarm / Alarm+Tamper / Cut를 인코딩.

### 05 — 핵심 구성요소

#### 🌐 WIZnet W5100 — TOE TCP 소켓 모드

패널의 네트워킹 심장. 하드와이어드 TCP/IP 코어에 MAC & PHY 통합, 4개 하드웨어 소켓, 16 KB 버퍼, SPI 호스트 인터페이스. 여기선 MQTT 브로커로 가는 지속적 **TOE TCP** 연결 하나를 담당한다.

#### 🧠 ATmega2560급 Arduino (Freetronics EtherMega 계열)

4개 아날로그 루프를 샘플링하고, 6-상태 분류기를 돌리고, MQTT 클라이언트를 호스팅. 핀을 53번까지 쓰므로 Uno가 아니라 Mega급 MCU.

#### 📟 Microchip 24AA125E48 MAC ROM (I2C)

전 세계적으로 고유한 소성(burned-in) MAC 주소를 제공해 여러 패널이 네트워크에서 충돌하지 않도록 함 — 부팅 시 I2C로 읽는다.

#### 📚 PubSubClient (MQTT)

브로커와의 pub/sub 세션을 처리하는 경량 Arduino MQTT 클라이언트.

#### 🖥️ Freetronics OLED128 (옵션, FTOLED)

헤드리스 박스를 원치 않을 때 기기 자체에서 상태·이벤트를 보여주는 128×128 컬러 OLED.

#### 🔌 EOL 저항 센서 루프 ×4

End-of-Line 저항이 각 센서를 감시되는 아날로그 루프로 바꿔, 단순 열림/닫힘이 아니라 변조/절단/단락 구분을 가능케 한다.

### 06 — 응용 시나리오

**01. 레거시 유선 알람을 스마트홈으로 리트로핏** 기존 EOL 저항 센서 배선을 그대로 재사용하되, 모든 존 변화를 MQTT로 발행해 Home Assistant나 Node-RED가 조명·알림·사이렌을 자동화하게 한다.

**02. 다중 존 가정 / 소규모 사무실 침입 감시** 박스당 4개 감시 존에 변조·배선 절단 감지까지 — 폰 대시보드가 실시간으로 지켜볼 수 있는 의미 있는 보안 커버리지.

**03. 사보타주에도 견디는 경계선 감시** 루프가 감시되므로, 절단이나 단락 자체가 이벤트다. 침입자가 센서를 무력화하면 조용한 사각지대가 아니라 경보가 울린다.

**04. 건물 전역의 분산 패널** 각기 다른 `panelId`를 가진 여러 유닛을 배치해 모두 하나의 브로커로 발행 — 메시지를 명확히 유지하면서 현장 전체를 싸게 커버하는 방법.

### Conclusion (결론)

> **유선 도난 알람 루프는 가정용 하드웨어 중에서도 "네트워킹 장비"와 가장 멀리 떨어진 물건이다 — 그런데 여기서도 WIZnet W5100이 조용히 모든 알람 이벤트를 네트워크로 실어 나르며, 폐쇄된 패널을 열린 MQTT 스트림으로 바꿔놓는다.**

- ✅ 6가지 상태(Normal / Tamper / Alarm / Alarm+Tamper / Short / Cut)를 구분하는 **감시형** EOL 저항 존 4개

- ✅ **TOE TCP** 모드의 **WIZnet W5100**으로 신뢰성 있는 상시 네트워크 링크 — 거의 제로 MCU 비용의 오프로드 TCP

- ✅ 네이티브 **MQTT** pub/sub(`PubSubClient`) → Home Assistant / Node-RED / 어떤 MQTT 대시보드든 그대로 연결

- ✅ **I2C ROM에서 읽는 고유 MAC** + DHCP/고정 유연성의 양산형 설계

- ✅ 별도 호스트 없이 기기 자체 컬러 OLED 상태 표시(옵션)

- ✅ 박스별 `panelId`로 **다중 패널 확장** 가능

- ✅ **Reach**: FPGA 방화벽부터 End-of-Line 알람 저항까지, WIZnet 실리콘은 뭔가 IP로 안정적으로 통신해야 하는 곳이라면 어디든 — 가정용 보안 패널 안에까지 — 계속 등장한다.

### 07 — WIZnet Makers 내 유사 프로젝트

WIZnet Makers 플랫폼에는 이미 유선 보안·센서→브로커 계열 프로젝트가 소규모로 모여 있다. SecuritySensor4ToMQTT를 그 사이에 놓으면 명확한 스펙트럼이 보인다 — 맨몸 센서 데모부터 완전한 "감시 + 발행" 패널까지.

- **Intrusion detection system using W5100 + Arduino** — W5100 + Arduino 침입 탐지 빌드. 실리콘과 MCU 계열이 가장 가까운 형제. (`maker.wiznet.io/WIZnet/projects/intrusion-detection-system-using-w5100-arduino/`)

- **A simple burglar Alarm: motion sensor, noise sensor and ethernet shield** — 이더넷 실드 위에서 모션·소음 센서를 읽는 다중 센서 알람. 센싱 방식이 다름. (`maker.wiznet.io/Alan/projects/a-simple-burglar-alarm...`)

- **Proof of Concept Door Alarm** — 이더넷 실드 도어 알람 예제. Arduino 플랫폼으로 모니터링. (`maker.wiznet.io/WIZnet/projects/proof-of-concept-door-alarm/`)

- **Arduino MEGA + Ethernet Shield + PIR** — Mega급 보드로 PIR 센서를 읽어 폰/데스크톱으로 데이터 노출. (`maker.wiznet.io/WIZnet/projects/arduino-mega-ethernet-shield-pir/`)

- **Send data from DHT11 sensor using MQTT with Pi Pico and W5500** — 현대판 MQTT 대응군: Pico + W5500이 센서 데이터를 MQTT로 푸시. (`maker.wiznet.io/wiz_chandana/projects/send-data-from-dht11-sensor-using-mqtt-with-pi-pico-and-w5500/`)

| 프로젝트 | MCU | WIZnet 칩 | 센싱 방식 | 보고 방식 | 차별 포인트 |
| --- | --- | --- | --- | --- | --- |
| **SecuritySensor4ToMQTT** (본건) | ATmega2560 (Mega) | **W5100** | EOL 저항 루프 4개, 6상태 | TOE TCP 위 **MQTT** | 감시형(변조/절단) **이면서** MQTT 발행 |
| Intrusion detection (W5100 + Arduino) | Arduino | W5100 | 침입 센서 | 이더넷 연결 | 동일 칩/MCU 계열; 침입 초점 |
| Simple burglar Alarm (Alan) | Arduino | 이더넷 실드(WIZnet) | 모션 + 소음 | 이더넷 실드 | 다중 센서, 비감시 루프 |
| Proof of Concept Door Alarm | Arduino | 이더넷 실드(WIZnet) | 도어 센서 | Arduino 플랫폼 모니터링 | 최소 PoC 데모 |
| Arduino MEGA + Ethernet + PIR | ATmega2560 (Mega) | 이더넷 실드(WIZnet) | PIR 모션 | 폰/데스크톱 조회 | 동일 보드급; 단일 PIR |
| DHT11 → MQTT (Pico + W5500) | RP2040 (Pico) | W5500 | DHT11 환경 | MQTT | 현대 칩; 보안 아닌 텔레메트리 |

**인사이트:** 이 생태계는 두 축으로 펼쳐진다 — *센싱의 정교함*(드라이 접점/PIR 데모 vs. 감시형 EOL 루프)과 *보고의 성숙도*(웹페이지 조회 vs. MQTT pub/sub). 보안 도메인 항목 대부분은 두 축 중 한쪽의 데모 끝단에 머문다. **SecuritySensor4ToMQTT가 차별적인 이유는 두 축 모두에서 동시에 높은 곳에 있다는 점이다** — 진짜 알람 등급 EOL 감시 *그리고* 깔끔한 MQTT 통합. DHT11+Pico+W5500 프로젝트는 같은 "센서→브로커" 패턴이 플랫폼의 신형 하드웨어로 어디까지 가는지 보여주지만, 방향은 보안이 아니라 환경 텔레메트리다. 요컨대 이 프로젝트는 이 묶음의 "다 큰 어른 알람 패널"이다.

### Q&A

**Q. 어떤 WIZnet 소켓 모드를 쓰며, 왜 UDP가 아닌가?** A. **TOE TCP**(`Sn_MR_TCP`)를 쓴다. MQTT는 지속적 TCP 연결 위에 올라가며, 항상 켜진 알람 보고기라면 TCP의 보장된 순서 전달과 연결 인지가 필요하다 — 세션이 끊기고 재수립되는 것 자체가 정보다. UDP는 이 애플리케이션이 필요로 하지 않는 지연 이득을 위해 그 신뢰성을 내다 버리는 셈이 된다.

**Q. TCP 작업은 W5100이 하나, ATmega가 하나?** A. **W5100**이 한다. 하드와이어드 TCP/IP 코어가 핸드셰이크·재전송·체크섬·ACK를 실리콘에서 처리하고, ATmega는 SPI로 소켓 페이로드만 읽고 쓴다. 이 오프로드 덕분에 8 KB SRAM MCU가 4개 존 감시 *와* MQTT 링크 유지를 여유롭게 해낸다.

**Q. 무엇이 이 센싱을 단순 스위치가 아니라 "감시형"으로 만드나?** A. End-of-Line 저항이다. 각 루프의 아날로그 값을(단순 열림/닫힘이 아니라) 측정함으로써, 펌웨어는 Normal, Tamper, Alarm, Short, Cut을 구분한다 — 변조나 배선 절단이 조용히 누락되지 않고 이벤트로 보고된다.

**Q. 더 최신 WIZnet 부품으로 옮길 수 있나?** A. 개념적으로 가능하다 — 동일한 TOE TCP / MQTT 패턴이 W5100S나 W5500에 깔끔히 매핑된다(Pico + W5500 형제 프로젝트가 이를 보여준다). 오늘 이걸 다시 만든다면 자연스러운 현대화 경로다.

---

Source: https://maker.wiznet.io/Lihan__/projects/securitysensor4tomqtt/
