Smart Tracks, Safe Trains

This project uses ESP32 to control multiple trains and switches to avoid collision in real time. This project shows how we can use technology and logic to improve train safety in real-world scenario.
Advaith Kannanayakal
Madeleine D' Houet Bilingual School
Grade 8

Problem

Method

Analysis

Data showed that accurate collision prevention depends on proper sensor threshold calibration and timing delays in the program. Higher speeds required longer stopping distances. The addition of a third sensor improved system reliability by confirming track clearance before allowing the second train to proceed. The ESP32 processed sensor input quickly enough to prevent collisions when within Bluetooth range.

Conclusion

We concluded that we could control and automate two LEGO trains and two switches using an ESP32 microcontroller and three photo sensors. This logic can be safely used in a shared track system.  The hypothesis was supported.  The system successfully prevented collisions when sensors and timing logic were properly calibrated.

Citations

  1. https://chatgpt.com/ used chat GPT to troubleshoot errors in the code.
  2. https://www.youtube.com/watch?v=h-5FmGfYzRs&t=152s ← Switch design
  3. https://www.arduino.cc/en/software

Acknowledgement

I acknowledge the help I received from my mom (Deepthi Kannanayakal) with troubleshooting my programs.  I also acknowledge Julie Girard (Mme. Girard) for giving me time to work on the project.