I am enjoying this brain teaser.
Continuing with dunnyrail's idea of micro switches to detect trains, today I experimented with a micro switch to see if my lightest wagon would operate it. This is the switch.
View attachment 230219
Problem #1 - it's too high to just sit on the 'baseboard' – I needed to raise the track by 4mm to get the arm level with top of rail.
Problem #2. When 'snugged up against' the rail foot, the actuating arm is 6 mm away from the rail head, no where near the flange – pic
View attachment 230220
So I had to glue a piece of 0.5mm styrene to the metal arm. (This may help to stop water ingress.)
View attachment 230221
Both these problems may be fixed with a different switch.
The wagon did seem to operate the switch OK. But have to make sure there is a tiny gap between rail and white styrene or it 'binds'. Too much gap and the flange runs between rail and styrene.
Maybe the next step is to use some bluetack for a semi-permanent installation on a running track.