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-11-02 - SDB: First Trolley Automation Test

Category SDB

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

I brought my prototype board to Randall today and gave it a try with the desired trolley:

The SDB prototype detected the trolley properly. When placed this way against the end bumper, we can adequately measure the trolley distance between 10 mm and 400 mm (1 cm up to 40 cm). After that, we always get a value in the 400 range.

Note that in this test, I did not hook SDB to the main JMRI computer for actual control. The goal was to determine which sensor placement would fulfill the detection need. Whatever is on the picture above seems like it will work correctly, so I’ll go ahead and create some kind of sensor support -- probably out of foam/cardboard first and then later 3d-printed or stuck to a little building.

Here’s an overview of the track I want to control:

The engine selection is this orange trolley. The model is Atlantic City #6885 from Bowser streetcar and it is a very good facsimilé of the SF Muni Milan 1815, part of the San Francisco Heritage Streetcar Fleet. This is a DCC model. It has good sound and runs well.

#6885 is certainly a finicky DCC engine though -- folks who tried to run it on the layout keep reporting it tends to “not stop”. And that’s right: when running, it seems to ignore any “speed 0” stop command. However it is possible to easily stop it by switching the direction to the opposite, and then stopping it after a couple seconds. Go figure.

There is another realization I made with this test: I actually don’t need 2 sensors for this automation.

Having one sensor on each side of the track would allow me to precisely stop the engine on the other side. But in fact to get started, I’ll use a much simpler automation:

  • Trolley’s default position is at the “end point 1”.
  • It will travel “more or less” to end point 2 -- I measured it takes 50 seconds at speed 20 (on dcc 128 speeds).
  • Then we just reverse immediately and go back to “end point 1”.
  • We stop when the trolley is fairly close to the sensor using the trick mentioned above (reverse speed for a couple seconds then actually stop).

It’s worth pointing out that SDB already has support for dual ToF sensors. This was interesting to add, and I may use it later, but I don’t really need to, contrary to my initial design thoughts.

In Conductor/RTAC, we just then need to tie this cycle to the room occupation sensor to start it.

Another realization is that I don’t need to have both the ESP32 and the sensor next to the track end bumper. I only need the sensor there. I still think it would be easier to have both at the same place, maybe masquerading as a small building on the layout.


 Generated on 2024-11-20 by Rig4j 0.1-Exp-f2c0035