Simple collision detection circuit. Is this possible with these constraints?

I want to make a simple collision detection circuit but the issue is very limited space to place the components, plus it needs to run off of a 1.5v battery...

I have a model train setup around my basement, roughly 110’ of track and a battery powered train runs on the track. The train uses a 1.5v battery powering a standard 1.5-3v electric motor (the kind typically found in cheap toy cars). I was thinking about putting a second train on the track system since it is so long and allow both trains to run at the same time. Inevitably even two identical trains would eventually collide given enough time.

Is there any feasible way to use, say, an IR-LED and photo transistor/diode to simply break the circuit to the motor if the train comes too close to the other? The issue is I only have 1.5v to work with and essentially no room for a microcontroller. I could theoretically stuff a few components smaller than, say a TIP102 transistor into the second empty train car and connect them all directly with soldered wire, but that is about the extent of the space I would have since these cars are HO scale. Adding a second battery or heavier (and higher voltage) power source is not an option due to size and weight.

Any ideas?

Forget about using a TIP102.It is a Darlington transistor and waists some 2 volts across emitter and cathode.
Install anti collide wagons in the trains that can house some more elctronical stuff.

By the way. This Forum is an Arduino users Forum and not a general electronics helpstation.

A stiff wire whisker connected to a lever-action microswitch will work to cut the motor power.

jremington:
A stiff wire whisker connected to a lever-action microswitch will work to cut the motor power.

That's too easy.

How about one of the cars on each train contains an RFID sensor connected to an ESP board in the car.
Every couple of feet put an RFID tag on the tracks. You can paint the tag as long as it isn't metalized paint.
Every time the car passes over a tag, the RFID sensor sends the position, the tag#, by MQTT to a central computer which monitors where each train is. When they get too close, you can control the trailing train to let the gap widen. (Node-Red on a Raspberry Pi can do this).

Whoops, you said simple. Use the whisker switch.

If you put an IR led under the train engine front tip or caboose rear, it should illuminate nearby ground. A detector on the front of an engine could trigger on that.

With an Arduino you can program chips on breadboards.

An ATtiny85 DIP chip is 4 pins long. Uno Rev 3 ATmega328 is 14 long.
It has timers and analog input, use IR brightness to tell when to stop.

Run at 1 MHz or less to save power, but 3V would have a safe margin.
Have you ever seen how small boost converters are?

Why is it necessary to power the detector from the 1.5v train battery? Why not provide a separate power supply for the detection system?

...R

3.7V coin cell?

There's little to no room was my impression. N-gauge?

Could the cars in the train carry a battery or feature, esp if there's a coal car. Maybe connect the engine and cars through short jumpers?

The OP says it is a HO scale train.

We need to see some pictures of it to get a sense of how much space is available and that the options might be.

...R
Simple Image Posting Guide