Machine Learning Food Dye Spectrum Deconvolution Project

Machine Learning Food Dye Spectrum Deconvolution Project

ISEF Category: Biochemistry

Ready to Turn This Idea Into a Real Project?

This guide was put together with the help of AI research tools to give you a solid starting point. But a competitive science fair project lives in the details: refining your research question, fine-tuning your variables, analyzing your data, and presenting your findings like a seasoned scientist.

For next steps tailored to your interests, skill level, and timeline, work one-on-one with a MehtA+ mentor. Learn more about MehtA+ Science & Engineering Research Mentorship →

Subcategory: Analytical Biochemistry  ·  Difficulty: Intermediate  ·  Setup: Home Setup  ·  Time: 1 to 2 Months

The Hook

Three dyes can hide inside one blurry spectrum, the same way three voices blend into one recording. Your job is to teach a computer to pull the signals apart. With a DIY spectrophotometer and non-negative matrix factorization, you can test how much chemistry is still recoverable when the hardware looks too simple. That makes a strong project because you are not just collecting data, you are measuring the limit of the measurement itself.

What Is It?

An absorbance spectrum is like a fingerprint for color. A dye absorbs some wavelengths of light more than others, so a spectrophotometer gives you a curve instead of one number. When you mix dyes, those fingerprints stack on top of each other, and the curves blur together.

Non-negative matrix factorization is a math method that tries to split a mixed signal into parts that only add up. That matters here because dye concentrations and absorbance values cannot go below zero. Your project asks whether a cheap instrument plus machine learning can pull apart mixtures that look too messy for the eye.

Why This Is a Good Topic

This is a strong science fair topic because you can test a clear question, measure error, and compare methods with the same samples. It connects to food quality control, environmental sensing, and low-cost chemical analysis, where cheap tools often have noisy data. You can learn calibration, matrix math, and model validation without needing a university lab.

Research Questions

  • How does spectral overlap between dye pairs change the accuracy of non-negative matrix factorization?
  • What is the effect of adding a third dye on the reconstruction error of the model?
  • Does a DIY spectrophotometer recover dye proportions as well as a reference UV-Vis instrument?
  • To what extent do baseline correction and normalization improve blind-mixture predictions?
  • Which wavelength range gives the best separation for red, yellow, and blue food dyes?
  • How does repeated measurement of the same sample change the uncertainty in estimated dye fractions?

Basic Materials

  • DIY spectrophotometer with a stable light source and fixed sample holder.
  • Red, yellow, and blue food dye stock solutions.
  • Distilled water for blanks and dilutions.
  • Transparent cuvettes or small clear sample tubes.
  • Disposable pipettes or transfer droppers.
  • Opaque box, black foam board, or cardstock to block stray light.
  • Digital kitchen scale with 0.1 g accuracy, if you prepare mass-based dilutions.
  • Spreadsheet or lab notebook for tracking sample labels and spectra.

Advanced Materials

  • UV-Vis spectrophotometer with scanning mode.
  • Quartz cuvettes.
  • Analytical balance with 0.001 g resolution.
  • Micropipettes and low-retention tips.
  • Volumetric flasks and amber storage bottles.
  • Certified dye standards or purified food colorants.
  • Optical bench or fiber-optic probe for repeatable alignment.
  • Reference wavelength calibration standard.

Software & Tools

  • Python: Scripts the NMF pipeline and compares reconstruction error across mixtures.
  • Google Colab: Runs notebooks in a browser without local installs.
  • scikit-learn: Provides non-negative matrix factorization and model scoring tools.
  • NumPy: Handles matrix math and data arrays.
  • Jupyter Notebook: Keeps data cleaning, plots, and model tests in one place.

Experiment Steps

  1. Define the dye set and mixture space you will test, so the spectra include enough overlap to challenge the model.
  2. Build a calibration set of single-dye and mixed samples, then decide how you will label each sample for training and validation.
  3. Choose a preprocessing plan for baseline correction, normalization, and wavelength trimming before factorization.
  4. Fit the NMF model, then compare reconstructed spectra against known sample compositions with a clear error metric.
  5. Test blind mixtures and record how well the model estimates each dye fraction under different overlap levels.
  6. Compare your DIY spectrophotometer results with a reference instrument or repeat runs to measure repeatability.

Common Pitfalls

  • Training on too few single-dye examples, which makes the factorization invent extra components.
  • Letting the light source warm up or drift between scans, which shifts the absorbance baseline.
  • Using mixtures whose spectra are almost identical, which makes the model assign the wrong dye fractions.
  • Skipping blank subtraction or normalization, which leaves camera brightness or ambient light inside the signal.
  • Evaluating only on the samples you trained on, which hides overfitting and gives fake accuracy.

What Makes This Competitive

A strong version of this project does more than show that NMF can separate dyes. It measures when the model stops working, compares it with a baseline method like linear unmixing, and reports error across blind mixtures. You can make it stronger by testing different illumination setups, different dye pairs, or repeated trials that estimate uncertainty. That turns a neat demo into a real study of how much information a cheap spectrophotometer can recover.

Project Variations

  • Test the same unmixing pipeline on sports drinks or flavored waters instead of pure food dye mixtures.
  • Compare non-negative matrix factorization with linear regression and principal component analysis on the same spectra.
  • Swap the phone camera for a light sensor or cheap spectrometer and measure how hardware quality changes accuracy.

Learn More

  • PubMed: Search review articles on spectral unmixing, chemometrics, and absorbance-based mixture analysis.
  • scikit-learn documentation: Read the NMF example and model evaluation notes.
  • MIT OpenCourseWare: Search linear algebra and machine learning lecture notes for matrix factorization basics.
  • US FDA Color Additives page: Check approved food dye names and basic regulatory information.
  • NIST Chemistry WebBook: Look up reference data and learn how spectral tables are organized.
  • NIH ImageJ documentation: Find guidance on plotting intensity curves and handling image data if you capture spectra with a camera.

For next steps tailored to your interests, skill level, and timeline, work one-on-one with a MehtA+ mentor. Learn more about MehtA+ Science & Engineering Research Mentorship →

To discover more projects, visit the MehtA+ Science Fair Project Discovery Hub​ →

Shopping Cart