This repo contains a couple of resources around a POC I did for block detection for DCC in a model railway. Its quite rough, but my plan is to expand it into a workable system for my railway.
It is cobbled together from a couple of different resources, however this repo (and associated website) is primarily where I drew a lot of the inspiration from.
- An ESP8266 is used to collect sensor data. Reason for using this board is primarily for the builtin wifi, and the small form factor. An Analog multiplexer will be used to expand the list of analog inputs from 1 to 16. The multiplexer channel is switched using 4 digital outputs.
- The inputs are sampled and for each input, occupancy is determined. Based on this, a message is sent via an MQTT Topic to a broker, which is connected to JMRI.
- Within JMRI, CATS is used for the signalling system. Currently CATS uses the JMRI turnout table for all of its devices, so the occupancy data is sent to a /trains/turnouts/CATS-ID topic.
- Only collects data from the A0 sensor on the board
- The occupancy logic is fairly simplistic - it doesn't use the dynamic detection method that is used in the source repo. Since my block is only 30cm, I expect larger blocks will require the improved approach where an object stores per-sensor sensitvities described here.
- ESP8266 Board
- Current Sensor
- Analog Multiplexer
- TheNScaler Blog that has a lot of useful info on block detection experiments using Arduino
- CATS101 A YouTube Playlist that is a collection of clinics getting started with CATS and JMRI
I will update this repo as I start implementing it on the layout, so hopefully the code will get a bit better over time as I get to grips with Arduino Programming.