Photovoltaic panels fitted to the roof, the angular blue-and-white test train moves on an 18-metre-long (60 feet) test track in Soshanguve township north of the capital Pretoria.
Trains are the cheapest mode of transport in South Africa, used mostly by the poor and working class.
“Our parents… no longer use trains (because of) cable theft… and load shedding,” said Ronnie Masindi, 18, referring to rolling blackouts caused by failures at old and poorly maintained coal-powered plants.
The state power company Eskom started imposing on-and-off power rationing 15 years ago to prevent a total national blackout.
The power outages, known locally as load-shedding, have worsened over the years disrupting commerce and industry, including rail services.
Infrastructure operator Transnet has struggled to keep rail traffic flowing smoothly since the economic challenges of the pandemic fuelled a surge in cable theft.
By 2020, rail use among public transport users was down almost two-thirds compared to 2013, according to the National Households Travel Survey with many commuters turning to more expensive minibus taxis.
Masindi said they decided to “create and build a solar-powered train that uses solar to move instead of (mains) electricity”.
The journey has not been without its challenges.
A lack of funding delayed production of the prototype locomotive, and the government later chipped in.
“It was not a straight line,” said another student, Lethabo Nkadimeng, 17. “It was like taking a hike to the highest peak of the mountain.”
The train, which can run at 30 kilometres (20 miles) per hour, was showcased at a recent universities innovation event.
For now, the prototype can run for 10 return trips on the track installed on the grounds of a school.
It will be used for further research, and eventually presented as a model the government could adopt.
Fitted with car seats and a flat-screen TV to entertain passengers, it took the students two years to build.
“What we have realised is, if we you give township learners space, resources and a little mentorship they can do anything that any learner can do around the world,” said Kgomotso Maimane, the project’s supervising teacher.