DENTON, Texas – A University of North Texas professor and one of his graduate students have spent the last nine years making meth, fentanyl and PCP in a lab.

It's all legal — the federal government signed off on it — and they've used the drugs to test a device they're developing: a breath analyzer that can identify marijuana, cocaine, methamphetamine and other drugs in people's systems.

Guido Verbeck, a chemistry professor, created the device with the help of graduate student Tom Kiselak.

The device isn't yet ready for the market. But Frisco, Texas-based InspectIR has been working with the researchers and sees law enforcement and medical uses for the device.

The device is bulkier than an alcohol Breathalyzer. The size is because a mass spectrometer, a device that analyzes the chemicals, is contained in the device.

A mass spectrometer usually remains stationary and is about the size of two home printers stacked on top of each other. Verbeck has managed to make a smaller spectrometer that can fit into the palm of a hand.

The device is designed so that when a person breathes into it, a carbon mesh captures the organic chemistry, eliminates the air and water from the breath, and sends the rest to the mass spectrometer. Within 15 seconds, the screen lights up with the results.

Verbeck has tested the gadget with the drugs he has made and a machine that can imitate human breath.

Once they work out the kinks, Verbeck and Kiselak will need to win approvals and put the device through clinical trials with humans. Verbeck said he expects to be finished with the process by year's end.

If the tests are successful, InspectIR can take the device to market. Verbeck estimates that the commercial version will cost $20,000 to $40,000. Over time, he expects the price to fall to about $10,000 as production becomes more efficient.

Verbeck said that if someone on opioids or other drugs was unresponsive and needed medical treatment, they could breathe into the device so doctors could determine a diagnosis quickly and give them appropriate treatment.

Public safety uses could also be in the offing well. In Texas, it's illegal to drive under the influence of drugs. While an officer can perform a field sobriety test, they have no means to confirm the person is impaired because of drugs other than alcohol.