I did something similar for layout. I added an HO gauge trolley that goes on a straight track to each end and stays there for a period of time. The HO trolley is DC but it is easier to build a timer for AC. You would have to add the controlled track sections a short distance from the bumpers.
Below is a write up summary of my reversing HO trolley from the link below, page 3, post 30. https://ogrforum.ogaugerr.com/...ra-027-layout?page=3
The HO track was recessed in the street and an HO gauge switch was added near one end to allow two trolleys to go into an HO trolley barn. The switch is remote controlled from the new control panel as well as a track selector slide switch to activate the live track section in the barn.
An HO DC transformer is used for the trolleys and is on the right of the new addition control panel.
The fun part of the trolley was figuring out how to stop and start the trolley at each end of the Main Street line and how to reverse the DC polarity on the track and the ends automatically like the bumpers reverse the Lionel O gauge Trolley. First I cut the one HO track rail about 7 inches from each end to give a section that would be un-powered and stop the trolley at each end of track. These end track sections also must be powered with the correct polarity to restart and reverse the trolley.
A trolley timer/controller was made from a small 1 RPM gear motor similar to those that power a micro wave oven turntable, which are easy to find in street trash on trash day. A cam disc was sawed out of ½ inch plywood with high humps and lower sections. Two micro roller armed single pole double throw switches were mounted together to act as an double pole double throw switch and wired in an X to switch track DC polarity when activated. This allows the trolley to start and run to the other end of track which is dead. The timer allows the trolley to stay there for about 30 seconds. Then the micro DPDT switch is activated by the timer cam and that end of the track is powered up with DC that has the polarity reversed and the trolley takes off for a 5 sec run to the other end track, stops and stays there 30 seconds until it is activated with the track with reversed DC polarity and off the trolley goes again.
This was a fun project to figure out, build and to watch operate.
HO Trolley Barn at one end of the Main Street Trolley Line
HO DC Transformer for Trolleys on Right side of New Addition Control Panel
Trolley Timer to Run and Reverse Trolley - Brown Box to right inside New Addition Control Panel
Trolley Timer Wooden Cam and Double Pole Double Throw Roller Micro Switch
Overall View of Main Street and Trolley Line