Introduction to the Trainbot Project
The Trainbot project, also known as Onlytrains, is a fascinating initiative that combines technology with the world of trains. This project, aiming to capture and document trains as they pass over a specific section of the track, uses simple tools and techniques to generate images of these trains. These images are stitched together to create a comprehensive visual journey of each train's movement.
Core Functionality
Onlytrains utilizes any Video4Linux USB camera or Raspberry Pi Camera v3 modules to monitor train tracks. As trains pass by, the system captures their images, compiling them into a sequence to provide a detailed visual record. The frontend for this project is accessible at frontend website, with another deployment running at alternative deployment.
Unique Sightings
One aspect that makes Onlytrains exciting is its collection of unique train sightings. These special moments are captured and stored, allowing enthusiasts and users to explore these exceptional train appearances through the project's website.
Simple, Yet Effective Computer Vision
The Trainbot employs a basic form of computer vision without relying on complex tools such as OpenCV. The approach is straightforward - it assumes trains appear within a set, manually defined region and captures them using a stable camera setup. This simplicity aids in reducing computational needs, focusing on practical assumptions like predictable train speeds and directions.
Documentation and Deployment
While the project maintains a straightforward documentation approach, it does require some technical know-how for deployment, particularly in system administration, web server management, and Go programming language proficiency. Users are encouraged to refer to the source code for in-depth understanding and configuration options.
Deployment involves setting up both the Go binary, responsible for train detection, and the web frontend. This binary can be installed via multiple methods, including a direct installation from a CI (Continuous Integration) run or building it locally using the available Makefiles.
Raspberry Pi Integration
Trainbot can be efficiently run on a Raspberry Pi. The integration involves configuring the camera and cropping the capture area to ensure accurate train tracking. With provisions for deploying on remote hosts, the setup involves placing the camera in an optimal position, such as a balcony, and securing it in a waterproof case.
Web Frontend
The web frontend is powered by a VueJS single-page application, which handles all train data processing independently. Once built, it can be deployed separately from the main trainbot system, providing great flexibility in how train images and data are accessed and managed online.
Hardware and Practical Setup
For hardware, the Trainbot project leverages a Raspberry Pi 4 Model B, paired with a Raspberry Pi Camera v3, to capture images from approximately 50 meters away. This setup is demonstrated in practices like those described in the MagPi Magazine.
Development Tools
The project supports x86_64 and aarch64 architectures and can be developed using Docker or directly on a local machine. Comprehensive tests ensure that the system works as intended. Developers use a Makefile system for various build and deployment tasks to simplify the development process.
Future Enhancements
The project has identified areas for improvement, such as addressing false positives in low light and incorporating machine learning for better train classification. As a volunteer-driven effort, the team is continually exploring new ways to improve the system and enhance the user experience.
By maintaining a balance between simplicity and functionality, the Trainbot project offers an intriguing example of how technology can intersect with the world of trains, allowing enthusiasts to engage with and document this dynamic form of transportation.