A sensor system called MEDIC can continuously measure levels of medication and illegal drugs in human blood.

It’s every doctor’s dream—a small, wearable sensor that can monitor levels of, say, the heart drug digoxin in a patient’s blood, and make sure that he or she gets just the right amount of medication 24 hours a day.

But the MEDIC biosensor, developed by researchers at the University of California, Santa Barbara (UCSB), can be easily reconfigured to test a person’s blood for just about any substance, including illegal drugs. In fact, the new technology builds on previous research by UCSB mechanical engineer Dr. Hyongsok (Tom) Soh on a microchip that can continuously screen blood for cocaine.

Learn More About the Signs of Drug Abuse and Available Treatments »

Soh says that MEDIC could help take the guesswork out of dosing for prescription drugs. Soh and his team published the results of their initial experiments late last month in the journal Science Translational Medicine.

“Such technology would enable truly personalized medicine, wherein therapeutic agents could be tailored with optimal doses for each patient to maximize efficacy and minimize side effects,” Soh’s team wrote in the study.

But some online critics say that, taken to its logical endpoint, his technology could be used by police, government agents, or even overzealous employers to drug test people on an ongoing basis.

Soh hopes to scale the technology down to a wearable size, which would make constant remote monitoring a possibility.