Dhairya Dand, a Massachusetts Institute of Technology student, drank too much at a campus party and woke up seven hours later in the emergency room after blacking out last fall.
But instead of taking the incident as a lesson to slow down on the hard liquor, the 23-year-old Indian origin student used it as motivation to invent high-tech ice cubes to measure how drunk he is, the daily mail reported.
The cubes are made from gelatin and implanted with infrared transmitters, accelerometers and LED lights that change color from green to yellow to red, depending on how quickly he's imbibing booze and how much he's had.
The accelerometers measure the number of sips he taken - giving him an estimate of his blood alcohol content that is about 80 percent accurate, he said.
If he continues to drink despite the red-light warnings in his cup, the ice cubes will even send text messages to his friends warning them that he should be taken home.
A video Dand created to describe his experience and his quirky invention had garnered thousand of views since its release last week.
The idea came to him, he said, after he was ordered to write a 20 page research paper about the dangers of binge drinking after he got into trouble with the university administration for his drunken night.
Instead he had this sudden flash of an idea to make something that would keep alcohol consumption in check, he said.
The concept began as a one-off invention, but Dand said that he now plans to develop his electronic ice cubes further and try to find them with a Kickstarter crowd funding grant.