Subscribe to Newsletter
Discovery & Development Formulation, Dosage Forms

The Candy Coder

Did you see the fascinating and visually vibrant work of William Grover in the media recently? Grover – a bioengineering professor at the University of California Riverside – covered pills in candy sprinkles and demonstrated how the approach could work as an anticounterfeiting measure (1). Sounds bizarre, but, as Grover points out, counterfeit medicines are still a global problem despite all the effort the pharma industry has put into this area. We need more solutions.

Here, we learn more about CandyCode – and its creator.

What’s your background?

I’m an Associate Professor in the Department of Bioengineering at the University of California, Riverside. Much of my training was actually in analytical chemistry, which definitely influenced my research interests; I love developing instruments and techniques that can analyze a substance and provide useful information. We’re particularly interested in the physical properties of a sample, such as density, freezing point, and viscosity, because all samples have these properties. Tools that can measure these properties (or distinguish samples based on these properties) can be applied to a huge range of problems.

To that end, we’ve developed tools for testing the authenticity of liquid medications based on their density (using a sensor inspired by a 3000-year-old African musical instrument called the mbira (2) and their freezing behavior (using a technique we call Chronoprinting that we’re in the process of commercializing) (3). We’ve also made mass sensors that can detect tiny changes in the density of fish embryos as they react to toxicant exposure (4) and measure the degradation rate of individual particles of controlled-release pharmaceuticals (5), and we’ve developed microfluidic chips that can sort cells by their density (6).

Fraudulent pharmaceuticals are fascinating because they’re just downright evil. Imagine making pills out of plaster and selling them as antimalarials for sick children... I’d do anything in my power to fight that.

Finally, I’ve always had an interest in computing, especially ways of building computers that don’t require electricity. Indeed, we’ve made various microfluidic computing circuits that run on air instead of electricity. We recently demonstrated an air-powered random-access memory (RAM) that can significantly reduce the cost and complexity of soft robots for important applications in industry and healthcare (7). I think that my longstanding interest in “weird” computing like this was probably part of my inspiration for CandyCodes – I like looking at something and asking myself, “How could I build a computer out of that?”  CandyCodes are basically just answering the weird question, “How could I store data in candy?

Why is the authenticity of pharmaceuticals such an interesting topic for you?

I think I’ve got a bit of an investigative journalist in me; I love trying to expose corruption, especially when the corruption takes advantage of innocent people. For example, a few years ago, I investigated a fake university called “California South University” and its connection to predatory journals (8).

Fraudulent pharmaceuticals are fascinating because they’re just downright evil. Imagine making pills out of plaster and selling them as antimalarials for sick children... I’d do anything in my power to fight that.

I hope that the tools and techniques my lab has developed can make a real difference in the fight against counterfeit pharmaceuticals. But even if they don’t, I’m still grateful I’ve had the opportunity to draw attention to this problem. Whenever I give a talk about my research, I’m always surprised by how many people tell me that they didn’t realize counterfeit pharmaceuticals were such a problem globally. We need greater awareness of this problem so that people from a wider range of backgrounds can apply their unique expertise to solve it.

What inspired your work with CandyCode?

It honestly started one day when I was eating some little chocolate candies that are covered with multicolored sprinkles called “nonpareils.” I noticed that the nonpareils are applied to chocolates at random, which made me wonder if the patterns ever repeat themselves. After studying a bunch of candies and doing some math, I discovered that the nonpareil patterns are indeed unique and unlikely to ever be repeated by chance – even if you made astronomically large numbers of candies – and that means the patterns could be used as “universally unique identifiers.”

CandyCodes are the simplest and most feasible way to put unique identifiers directly onto a pill or other drug product.

Since they are unique, easy to produce, and hard to counterfeit, I realized that these “CandyCodes” could be applied to pills and capsules to combat pharmaceutical fraud. By coating each pill with nonpareils and then taking a photo of each pill before it leaves the production facility, a pharmaceutical company could create a database of known-authentic pills based on their CandyCodes. Then, when a consumer wishes to confirm the authenticity of their CandyCoded pill, they can use a smartphone camera to snap a photo of the pill. If a matching CandyCode is found in the manufacturer’s database, then the pill is authentic, but if no matching CandyCode is found, the consumer would be warned that the pill may be counterfeit and should not be consumed.

What are the main benefits of this approach?

I believe that CandyCodes are the simplest and most feasible way to put unique identifiers directly onto a pill or other drug product.

Other researchers have proposed various on-drug IDs to combat fraud, but their implementations haven’t seen widespread adoption because they require significant alterations to the drug formulation or manufacturing process, or they require consumers to have specialized equipment to read the IDs.

CandyCodes are just particles applied at random to a pill or capsule. They require no alteration of the drug formulation and only minimal alteration of the manufacturing process – basically just adhering edible colored particles to each pill and then photographing them. They’re easy to make but very difficult to counterfeit, and consumers need only a smartphone to verify the authenticity of their CandyCoded medicine. 

How would the approach work in the pharma industry?

My little proof-of-concept testing of CandyCodes used actual candy sprinkles because they are already mass-produced and easy to come by. To use CandyCodes on pharmaceuticals for patient use, you’d need to modify a few things; for example, for patients with dietary constraints, using particles that don’t contain sugar might be necessary. Also, different markets have different rules on which colorants are approved for food and drug use, so you’d need to make sure that the particles use appropriate colors and dyes for the target market. But I think these are all fairly minor modifications. We’d also need to confirm that CandyCode coatings don’t make pills harder to swallow.  I tried a few of my CandyCoded pills myself and found that their candy coating made them quite pleasant to swallow (as predicted by Mary Poppins!) but more rigorous testing would be needed.

Would consumers need to photograph a particular side or angle of their dose?

One of the challenges I faced while developing CandyCodes was how to read the codes. Traditional barcodes and QR codes have a structure and orientation that imparts a meaning to each part of the code, greatly simplifying them. However, the patterns of colored sprinkles in CandyCodes are totally random.

Pharmaceutical fraud hasn’t gone away, so clearly there’s still work to be done in this area.

I solved this problem by taking advantage of how the little colored particles pack together on the surface of a pill. Since the particles are spheres, they tend to cover the surface of the pill in a hexagonal pattern, at least in some local areas. This hexagonal pattern lets us define each sphere’s “neighbors” (usually six of them). Then, we can convert that “neighborhood” into a text string based on the colors of the spheres. For example, the text string “WGWWGY” corresponds to a sphere “neighborhood” with a white sphere (W) surrounded by green (G), white (W), white (W), green (G), and yellow (Y) spheres, in clockwise order.  Using this process, we can convert each CandyCode to about 50 of these text strings to effectively decode it. These text strings can then be saved in a manufacturer’s database of known-authentic CandyCodes and searched when a consumer wishes to confirm the authenticity of a pill.

Crucially, this decoding process doesn’t require the CandyCoded pill or capsule to be oriented in a specific way.

Now, if a pill or capsule is completely covered with colored particles, then a manufacturer might need to take photos of each pill from multiple sides to capture all of the CandyCode information. But in my proof-of-concept study, I just coated one side of each pill with colored particles; this approach requires just a single photograph of each pill and still provides more than enough room for each pill to have a universally unique CandyCode. It also leaves the other side of the pill free for conventional brand or dose markings.

Why do you think more creative thinking and innovation is needed for approaches to authenticity?

Well, pharmaceutical fraud hasn’t gone away, so clearly there’s still work to be done in this area.

I personally like approaches that use ideas from computing to combat fake medicines.  CandyCodes are an example of this, but there are many other people trying to take concepts from computing, like cryptography and blockchain technology, and apply them to fighting counterfeit pharmaceuticals.

The challenge is making sure that the proposed solution is feasible; that it can actually be implemented by pharmaceutical manufacturers and used by consumers in the parts of the world where pharmaceutical fraud is most prevalent. Many proposed solutions are elegant and creative, but don’t seem sufficiently feasible. I hope that the simplicity of CandyCodes makes them more feasible than other approaches, but there’s undoubtedly still a need for even simpler and easier-to-use tools for fighting fake medicines.

I’d love to hear what pharmaceutical producers think about CandyCodes. I’ve actually already heard from a producer of candy sprinkles about the feasibility of tweaking their production process to make particles optimized for CandyCode use. If a pharmaceutical producer sees any practical problems with CandyCodes, I’d be grateful to hear their thoughts in hopes of resolving those problems in the future. Contact me at [email protected]

Receive content, products, events as well as relevant industry updates from The Medicine Maker and its sponsors.
Stay up to date with our other newsletters and sponsors information, tailored specifically to the fields you are interested in

When you click “Subscribe” we will email you a link, which you must click to verify the email address above and activate your subscription. If you do not receive this email, please contact us at [email protected].
If you wish to unsubscribe, you can update your preferences at any point.

  1. WH Grover, “CandyCodes: simple universally unique edible identifiers for confirming the authenticity of pharmaceuticals,” Scientific Reports (2022). DOI: 10.1038/s41598-022-11234-4
  2. HC Bhakta, VK Choday, and WH Grover, “Musical Instruments As Sensors,” ACS Omega, 3, 11026-11032 (2018). DOI: 10.1021/acsomega.8b01673
  3. BA McKenzie et al., “Chronoprints: Identifying samples by visualizing how they change over space and time,” ACS Central Science, 5, 589-598 (2019). DOI: 10.1021/acscentsci.8b00860
  4. SM Oskui et al., “Measuring the mass, volume, and density of microgram-sized objects in fluid,” PLOS One (2017). DOI: 10.1371/journal.pone.0174068 
  5. HC Bhakta, JM Lin, WH Grover, “Measuring dissolution profiles of single controlled-release drug pellets,” Scientific Reports, 10 (2020). Available at 10.1038/s41598-020-76089-z
  6. N Norouzi, HC Bhakta, WH Grover, “Sorting cells by their density,” PLOS One (2017). DOI: 10.1371/journal.pone.0180520
  7. S Hoang et al., “A pneumatic random-access memory for controlling soft robots,” PLOS One (2021). DOI: 10.1371/journal.pone.0254524
  8. Grover Lab, “The University of Alberta, Southern California” (2017). Available at
About the Author
Stephanie Sutton

Making great scientific magazines isn’t just about delivering knowledge and high quality content; it’s also about packaging these in the right words to ensure that someone is truly inspired by a topic. My passion is ensuring that our authors’ expertise is presented as a seamless and enjoyable reading experience, whether in print, in digital or on social media. I’ve spent fourteen years writing and editing features for scientific and manufacturing publications, and in making this content engaging and accessible without sacrificing its scientific integrity. There is nothing better than a magazine with great content that feels great to read.

Register to The Medicine Maker

Register to access our FREE online portfolio, request the magazine in print and manage your preferences.

You will benefit from:
  • Unlimited access to ALL articles
  • News, interviews & opinions from leading industry experts
  • Receive print (and PDF) copies of The Medicine Maker magazine