crane-emergency-stop
ESP32-based remote crane emergency stop (EMO) system
📌Overview
This is an open-source project that implements a remote emergency-stop system for bridge cranes that use the Danfoss R13 F receiver. It develops a TCP/IP ↔ CANopen gateway using two hardware platforms— a BL335 Linux gateway and an ESP32-S3/EdgeBox Lite(equipped with a WIZnet W5500 Ethernet module)— to remotely control crane operations and provide an emergency-stop function.
Purpose
The goal is to build an industrial safety system that provides remote emergency stop (E-STOP) and real-time status monitoring to protect crane operators in industrial environments, while also enabling hazard detection and event logging.
📌Features
- Multi-gateway support – Implements a dual-hardware strategy using a Linux-based BL335 gateway and the ESP32-S3 EdgeBox Lite to convert TCP client commands into CANopen messages.
- CANopen and CiA 402 implementation – Fully supports the CiA 301/402 protocol of the Danfoss R13 F receiver, aiming to implement control words, status words, PDO/SDO communication, and even NMT/EMCY objects.
- Emergency Stop (E-STOP) and safety functions – The
emergency_stopTCP command immediately sends a CANopen control word to stop the crane, and events are recorded as Safety-grade entries through the event logger. - Event logging system – The Python-based EventLogger provides 6 severity levels (DEBUG to SAFETY) and 7 categories, supporting file logs, JSON logs, real-time callbacks, and statistical collection.
- High-reliability testing and automation – Includes a CANopen simulator, a pytest-based test suite, and GitHub Actions workflows to automatically verify EDS/ESP32 progress.
- GUI / Web UI – A PyQt6 desktop GUI and a FastAPI-based web UI allow monitoring of system status, sending commands, and viewing logs.
- SD card logging & OTA updates – The ESP32 gateway supports SD-card logging and remote firmware updates (OTA).
📌System Architecture
| Component | Description |
|---|---|
| Transmitter/Receiver | Sends crane control signals using a transmitter compatible with the Danfoss K13 F receiver, which outputs commands onto the CANopen bus. |
| Gateway | Two versions: BL335 (ARM Linux) and ESP32-S3 EdgeBox Lite. A TCP server (ports 9999/5000) receives client commands and converts them into CANopen control words. The ESP32 version uses a FreeRTOS multitasking architecture. |
| Network | Wi-Fi / Ethernet. EdgeBox Lite provides wired Ethernet via the WIZnet W5500, while the BL335 uses a SocketCAN interface on Ubuntu IoT. |
| Control Software | k13_controller, written in Python, generates and sends CANopen messages on BL335 and RPi environments. |
| Monitoring | Real-time status, speed, and error information are displayed via a desktop GUI (PyQt6), web UI (FastAPI), and log viewer. |
| Data Layer | EventLogger and EventStorage store logs in memory, files, or SQLite and provide statistical analysis. |
📌Role and Application of the W5500
- Hardware Communication Interface – The EdgeBox Lite includes an ESP32-S3 paired with a WIZnet W5500 Ethernet controller, providing wired Ethernet connectivity suitable for industrial environments.
The W5500 is used to achieve more stable, lower-latency communication compared to Wi-Fi, and it interfaces with the ESP32 via SPI. - Ethernet Manager Implementation – In the ESP32 firmware,
ethernet_manager.h/.cppdefines a structure that supports both W5500 and LAN8720 modules. When W5500 is selected, the initialization routine configures SPI pins, sets DHCP or static IP, and handles network events. - EdgeBox Setup Script –
edgebox_setup.pyautomates W5500 driver installation, SPI interface activation, and network configuration, enabling rapid deployment of an industrial gateway. - Improved Network Reliability – By using wired Ethernet with a static IP, emergency-stop commands and status reports for crane operation are delivered without delay, enhancing overall safety.
📌Market & Application Value
- Industrial Safety Market – In cranes, heavy machinery, and logistics automation, remote emergency stop and status monitoring are essential for meeting legal requirements and safety regulations. This project can be applied to any industrial site using CANopen-based equipment and serves as a high-value solution capable of detecting hazardous conditions early and preventing accidents.
- Scalability – Using an ESP32 gateway allows low-cost expansion to many nodes, while the W5500 on the EdgeBox Lite enables easy integration into wired factory networks. The BL335 version is compatible with existing Linux systems, allowing rapid deployment across various industrial machines.
- Compliance with Technical Standards – Because it adheres to CiA 301/402 and CANopen protocols, it provides excellent interoperability with other CANopen devices, and standard EDS files can be used to automate configuration.
📌WIZnet Strategic Value
This project demonstrates the use of the WIZnet W5500 to introduce wired Ethernet into a CANopen-based crane control system. It showcases a new application by combining multiple platforms, including FreeRTOS and C++, Python, and FastAPI. The dual-hardware strategy using both the BL335 and the ESP32 provides an opportunity to directly compare and evaluate the performance of the EdgeBox Lite, which incorporates a WIZnet Ethernet chip.
📌Summary
The crane-emergency-stop project is an open-source solution that enables remote emergency stopping of cranes using the CANopen protocol. It implements a TCP/IP ↔ CANopen bridge using both the BL335 gateway and the ESP32-S3 EdgeBox Lite (W5500 Ethernet). The system includes industrial features such as event logging, a CAN simulator, and a web UI, with development automated through GitHub Actions. The W5500 plays a key role by providing stable wired communication, ensuring the reliability required for industrial safety systems. Given its strong potential in the industrial safety and automation domain, this project is well suited to be showcased as a WIZnet application example.
📌Overview
이 프로젝트는 Danfoss R13 F 수신기를 사용하는 브리지 크레인을 대상으로 원격 비상정지 시스템을 구현하는 오픈소스 프로젝트입니다.
BL335 Linux 게이트웨이와 ESP32-S3/EdgeBox Lite(WIZnet W5500 이더넷 모듈이 탑재된) 두 가지 하드웨어 플랫폼을 활용하여 TCP/IP ↔ CANopen 게이트웨이를 구축하고, 이를 통해 크레인 동작을 원격으로 제어하고 비상정지 기능을 제공합니다.
Purpose
이 프로젝트의 목적은 산업 환경에서 크레인 작업자의 안전을 보호하기 위해, 원격 비상정지(E-STOP), 실시간 상태 모니터링을 제공하는 산업용 안전 시스템을 구축하는 것입니다.
또한 위험 상황 감지와 이벤트 로깅 기능을 통해 안전성을 더욱 향상시키는 것을 목표로 합니다.
📌Features
- 멀티 게이트웨이 지원 – Linux 기반 BL335 게이트웨이와 ESP32-S3 EdgeBox Lite를 활용한 이중 하드웨어 전략을 구현하여, TCP 클라이언트 명령을 CANopen 메시지로 변환합니다.
- CANopen 및 CiA 402 구현 – Danfoss R13 F 수신기의 CiA 301/402 프로토콜을 완전 지원하며, Control Word, Status Word, PDO/SDO 통신, NMT/EMCY 객체까지 구현하는 것을 목표로 합니다.
- 비상 정지(E-STOP) 및 안전 기능 –
emergency_stopTCP 명령은 즉시 크레인을 정지시키는 CANopen Control Word를 전송하고, 이벤트 로거는 이를 Safety 등급으로 기록합니다. - 이벤트 로깅 시스템 – Python 기반 EventLogger는 6단계 심각도(DEBUG~SAFETY)와 7개 카테고리를 제공하며, 파일 로그, JSON 로그, 실시간 콜백, 통계 수집을 지원합니다.
- 고신뢰성 테스트 및 자동화 – CANopen 시뮬레이터, pytest 기반 테스트 스위트, GitHub Actions 워크플로우를 포함하여 EDS/ESP32 개발 진행 상황을 자동으로 검증합니다.
- GUI / Web UI – PyQt6 데스크톱 GUI와 FastAPI 기반 Web UI를 통해 시스템 상태 모니터링, 명령 전송, 로그 조회가 가능합니다.
- SD 카드 로그 & OTA 업데이트 – ESP32 게이트웨이는 SD 카드 로깅과 원격 펌웨어 업데이트(OTA)를 지원합니다.
📌System Architecture
| 컴포넌트 | 설명 |
|---|---|
| 송수신기 | Danfoss K13 F 수신기와 호환되는 송신기를 통해 크레인 제어 신호를 전달하며, 수신기는 CANopen 버스로 명령을 출력합니다. |
| 게이트웨이 | BL335(ARM Linux)와 ESP32‑S3 EdgeBox Lite 두 가지. TCP 서버(포트 9999/5000)가 클라이언트 명령을 수신해 CANopen 제어어로 변환하며, ESP32 버전은 FreeRTOS 멀티태스크 구조를 채택했습니다. |
| 네트워크 | Wi‑Fi/이더넷. EdgeBox Lite는 WIZnet W5500을 통해 유선 이더넷을 제공하고, BL335는 Ubuntu IoT에서 SocketCAN 인터페이스를 사용합니다. |
| 제어 소프트웨어 | k13_controller는 Python으로 작성되어 BL335 및 RPi 환경에서 CANopen 메시지 생성·전송을 담당합니다. |
| 모니터링 | 데스크톱 GUI(PyQt6), 웹 UI(FastAPI) 및 로그 뷰어를 통해 실시간 상태, 속도, 오류 등을 확인할 수 있습니다. |
| 데이터 레이어 | EventLogger와 EventStorage가 로그를 메모리/파일/SQLite에 저장하고 통계를 제공합니다. |
📌Role and Application of the W5500
- 하드웨어 통신 인터페이스 – EdgeBox Lite는 ESP32-S3와 WIZnet W5500 이더넷 컨트롤러가 결합된 구조로, 산업 환경에 적합한 유선 이더넷 연결을 제공합니다.
- Wi-Fi 대비 더 안정적이고 낮은 지연의 통신 제공 – W5500은 ESP32와 SPI로 연결되며, Wi-Fi보다 훨씬 안정적이고 지연이 적은 통신을 구현합니다.
- Ethernet Manager 구현 – ESP32 펌웨어의
ethernet_manager.h/.cpp는 W5500과 LAN8720 모듈을 모두 지원하는 구조를 정의합니다.
W5500이 선택되면 초기화 루틴은 SPI 핀 설정, DHCP/고정 IP 설정, 네트워크 이벤트 처리를 수행합니다. - EdgeBox 설정 스크립트 –
edgebox_setup.py는 W5500 드라이버 설치, SPI 인터페이스 활성화, 네트워크 구성을 자동화하여 산업용 게이트웨이를 신속하게 구축할 수 있도록 합니다. - 향상된 네트워크 신뢰성 – 고정 IP 기반의 유선 이더넷을 사용함으로써 비상정지 명령과 크레인 작동 상태 보고가 지연 없이 전달되어 전체 안전성이 향상됩니다.
📌Market & Application Value
- 산업 안전 시장 – 크레인, 중장비, 물류 자동화 분야에서는 원격 비상정지와 상태 모니터링이 법적 요구 사항과 안전 규정을 충족하는 데 필수적입니다.
이 프로젝트는 CANopen 기반 장비를 사용하는 모든 산업 현장에 적용될 수 있으며, 위험 상황을 조기에 감지하고 사고를 예방할 수 있는 높은 가치의 솔루션으로 활용될 수 있습니다. - 확장성(Scalability) – ESP32 게이트웨이를 사용하면 저비용으로 다수의 노드를 확장할 수 있으며, EdgeBox Lite의 W5500은 공장 유선 네트워크와의 손쉬운 통합을 지원합니다.
BL335 버전은 기존 Linux 시스템과 호환되어 다양한 산업 장비에 빠르게 배포할 수 있습니다. - 기술 표준 준수 – CiA 301/402 및 CANopen 프로토콜을 준수하기 때문에 다른 CANopen 장치와 뛰어난 상호 운용성을 제공하며, 표준 EDS 파일을 사용해 구성을 자동화할 수 있습니다.
📌WIZnet Strategic Value
이 프로젝트는 WIZnet W5500을 활용해 CANopen 기반 크레인 제어 시스템에 유선 Ethernet을 도입하는 사례를 보여줍니다.
FreeRTOS와 C++, Python, FastAPI 등 다양한 플랫폼을 결합하여 새로운 형태의 응용 사례를 제시하며,
BL335와 ESP32를 모두 사용하는 이중 하드웨어 전략은 WIZnet 이더넷 칩이 탑재된 EdgeBox Lite의 성능을 직접 비교·평가할 수 있는 기회를 제공합니다.
📌Summary
crane-emergency-stop 프로젝트는 CANopen 프로토콜을 사용하여 크레인을 원격으로 비상 정지할 수 있게 하는 오픈소스 솔루션입니다.
이 시스템은 BL335 게이트웨이와 ESP32-S3 EdgeBox Lite(W5500 이더넷)를 모두 활용하여 TCP/IP ↔ CANopen 브리지를 구현합니다.
또한 이벤트 로깅, CAN 시뮬레이터, 웹 UI 등 산업용 기능을 포함하고 있으며, GitHub Actions를 통한 자동화된 개발 환경도 갖추고 있습니다.
W5500은 안정적인 유선 통신을 제공함으로써 산업 안전 시스템에 요구되는 높은 신뢰성을 보장하는 핵심 역할을 합니다.
산업 안전 및 자동화 분야에서의 높은 확장 가능성과 실용성을 고려할 때, 이 프로젝트는 WIZnet의 활용 사례로 소개하기에 적합한 프로젝트입니다.
https://github.com/arturo393/crane-emergency-stop/blob/clean-main/jira/gateway_esp32_update_nov01.md

