A device that sounds the alarm after a traffic accident occurs has won the top prize in a 24-hour coding competition.

The palm-size BlackBox, which can be attached to a vehicle's dashboard, detects a crash through vibrations and transmits a distress signal to emergency responders.

It sends rescuers the driver's pre-registered medical information such as blood type, allergies and medical history, and informs the motorist's relatives of what has happened.

At the same time, a live video feed is activated, so rescuers can assess the driver's condition.

The inventors - undergraduate Clarence Ngoh, 21, and full-time national servicemen Kong Yu Jian and Wong Wai Tuck, both 20 - created the device because it sounded like fun.

"Precious time may be wasted when calls are being made," said Mr Wong.

The trio hope that their device will reduce the time it takes for an ambulance to arrive at the scene.

The idea for it came from a microprocessing workshop they attended, while they were fiddling with sensors and modules.

And the end product is an "integrated system that has various applications", said Mr Ngoh, a first-year information systems student at Singapore Management University (SMU).

The BlackBox will also collate data, such as traffic conditions and accident occurrences, from the Land Transport Authority and warn drivers to be extra careful when they enter an area where the risk of a crash is higher.

It was the multiple functions of the box that landed the team the top spot at the codeXtremeApps hackathon, which is organised by the Infocomm Development Authority and Information Technology Standards Committee.

They beat 61 other teams and won $10,000, as well as two complete computers built on a single circuit board, for their prototype and the innovative use of road and traffic data.

The winners met last year through an informal mentorship programme organised by Professor Lee Yeow Leong, a senior lecturer of information systems at SMU.

Both Mr Wong and Mr Kong will study information systems management at the university next year.

The three men are currently working on how to commercialise their device, as well as looking for collaborators.