Model Train-related Notes Blog -- these are personal notes and musings on the subject of model train control, automation, electronics, or whatever I find interesting. I also have more posts in a blog dedicated to the maintenance of the Randall Museum Model Railroad.

2023-01-29 - SDB: Software Defined Blocks

Category SDB

Software Defined Blocks” is a new project I’ve started this year.

TL;DR: The Software Defined Blocks project uses an ESP32 with sensors to emulate block activations for a train model railroad.

The “Software Defined Blocks” project can be described as:

  • An embedded processor (ESP32) and sensors (Time-of-Flight sensor, camera).
  • An ability to define blocks, and programmable conditions to trigger block occupancy based on the state of these sensors.
  • Report of the block occupancy to either a JMRI or MQTT server.
  • Configuration and state displayed in some way (OLED display, web server).

The project is going to be split in two phases, each with their own MVP.

Phase 1: ESP32 + ToF sensor + Wifi + JmriJSON.

  • This phase is known to be entirely doable. I expect most of phase 1 will be dedicated to the overall structure I want to achieve for the program.
  • There are some unknowns (f.ex. how is configuration achieved, how is state reported) but that’s because there are multiple choices, not due to lack of knowledge.

Phase 2: ESP32-CAM + image analysis (OpenCV or something else).

  • This phase is known to be purely experimental.
  • The camera analysis part has some obvious challenges -- should I be using OpenCV or duplicate algorithms, can they even achieve what I want, what do I even want, etc. There’s an interesting open research area here, yet overall it should be achievable, and once achieved the stability of the solution remains to be measured.

To be clear, phase 2 is the “interesting” and novel part. It is based on my “Grade Crossing Camera” project from a couple years ago, which I toyed with but never fully finished. So it’s time to reuse what I did last time and finish it.

However there’s nothing wrong with phase 1 since the goal of that one is to provide a stable and easily reusable foundation.

The MVP for phase 1 is the Stockton’s Trolley Automation as described in 2018.

The main repository page is https://bitbucket.org/model-railroad/sdb.


 Generated on 2024-12-21 by Rig4j 0.1-Exp-f2c0035