Stoners get a bad rap. The stereotypical pothead is a lazy underachiever whose skills include eating an entire bag of Doritos in one sitting and curating reggae playlists, but this caricature neglects the bottomless creativity stoners apply to getting high.
Case in point is a DIY bong attachment that gathers data on how thick the smoke is from a bong hit. The device was made by Bradley Moore, an 18-year old pizza delivery guy and aspiring engineer, who recently posted the invention to r/stonerengineering, a subreddit dedicated to unconventional methods of cannabis consumption.
Moore’s device consists of an Arduino Uno—a small computer that is optimized for running repetitive tasks—that is connected to a light and a photoresistor, a small sensor that measures the strength of the light. The light and the photoresistor are placed opposite of one another on the bong stem so that when smoke passes between them the photoresistor will register a decrease in the amount of light received by the sensor. The way the strength of light varies over time corresponds to the thickness of the pot smoke and is plotted as a graph by the Arduino microcontroller.
Moore demoed his device for us.
“I thought back to the AP Chemistry course I took my junior year of high school,” Moore told me in an email about the genesis of the project. “We used machines to figure out the concentration of different substances with spectroscopy. It’s almost the same idea.”
Moore told me that the entire set up cost him less than $200, most of which was the cost of the bong. The electronic components, including the Arduino microcontroller, only cost around $50. All the components are connected with a breadboard, which is used to prototype electronic circuits and lends an extremely DIY aesthetic to the project.
Read More: We Need More Data On Our Weed
Moore said that the hardest part of the project was getting the code correct. He said he started with some code that he had written for an engineering class he is taking at his local community college, but had to rewrite it so that it would work on an Arduino. After that it was just a matter of hooking up the sensors.
“It worked like a charm the first time I tried it,” Moore said. Now that he has a working device, the next step is to generate some dank data. “I haven’t done any testing to see which cannabis makes the densest smoke yet, but I imagine different plants will make different smoke!”
This article originally appeared on VICE US.