Cocoa beans are the raw material for making cocoa powder, cocoa butter, and chocolate.  They are seeds from the tropical cacao tree and are grown in areas of the world within 20° latitude of the Equator.  Cocoa powder is the leftover component after cocoa butter has been extracted from chocolate liquor, which is made by grinding roasted cocoa beans into a liquid state.  Chocolate is made from the chocolate liquor and cocoa butter after removing the cocoa powder. Other ingredients are added as well, including sugar, milk in milk chocolate, and vanilla in some types of chocolate.  World production of cocoa was 3,455,622 metric tons in 2013 and is projected to grow to a $2.1 billion value with a CAGR of 3.1% by the end of 2019.  The chocolate market is projected to grow to $131.7 billion with a CAGR of 2.3% by the end of 2019.  Factors driving growth include larger markets in developing countries, increasing urbanization and widespread availability, new applications in food and confectionary products, and increased sales of seasonal, festive, and niche chocolate products.  Proper quality control at all stages of the cocoa & chocolate manufacturing process is essential for a good finished product.  Parameters of interest in cocoa beans include protein, fat, moisture, ash, carbohydrates, and color measurements.  It is important to properly classify varieties of beans as well as different varieties have a large impact on the physical and chemical properties of the final product.  Fermentation level of beans is a strong indicator for evaluating dry cocoa quality.  Mixtures and formulas during the chocolate manufacturing process are proprietary and are always kept as a closely guarded secret by chocolate makers.  The final stage in chocolate manufacturing is tempering, which entails heating and cooling the chocolate to change different cocoa butter crystallization patterns that form into the desired final crystallization structure.  The physical parameters that need to be monitored for optimization of this process cannot be monitored in real-time by current methods.  Current methods for testing parameters of interest in cocoa and chocolate are expensive, laborious, and time-consuming, especially when implemented in a process setting.  In-line monitoring is impractical and sometimes impossible.  There is a need for fast, cost-effective, and real-time monitoring of parameters at all stages of the cocoa & chocolate manufacturing process.  One such method that has been examined is NIR spectroscopy.  


  • Protein 
  • Moisture 
  • Fat 
  • Ash 
  • Carbohydrates 
  • Color (Lightness, Redness, Yellowness) 
  • Varietal Classification 
  • Fermentation Index 
  • pH 
  • Total Polyphenols 
  • Ammonia Nitrogen 
  • Viscosity 
  • Enthalpy 
  • Slope (Second point of inflection of a temper curve) 

Summary of Published Papers, Articles, and Reference Materials   

Measurement of chemical parameters in major constituents of cocoa and chocolate for quality control purposes has been studied using NIR spectroscopy. The results of most studies have been promising.  One study examined measuring various chemical and physical parameters in cocoa beans as well as classifying them based on variety.  The study also compared results for calibration models made from both intact and ground beans.  Results show classification of cocoa beans is feasible using differences in NIR spectra and that protein, moisture, fat, ash, carbohydrates, and color parameters could all be quantitatively measured from NIR spectra and calibration models.  Another study assessed using both NIR spectroscopy and Electronic Tongue (ET) sensor measurements in combination to classify cocoa beans.  100% correct classification of beans was achieved using data from both technologies and modeling algorithms.  Two separate studies evaluated measuring quality and fermentation parameters in cocoa beans using NIR spectroscopy.  The first study assessed three important quality parameters: fermentation index, pH, and total polyphenols.  Fermentation index and pH are direct fermentation measurements while total polyphenols are a good indicator of antioxidants.  Results were good enough for screening purposes but would likely improve with a larger sample set and wider range of values.  The second study measured ammonia nitrogen in cocoa beans, considered a good indicator of fermentation time. Results were excellent and showed high correlation between the NIR spectra and calibration model, showing the potential to replace the expensive and time-consuming Conway reference method with NIR spectroscopy.  Tempering is one of the most crucial parts of the chocolate making process and NIR spectroscopy was examined as a method for measuring physical parameters related to rheological data that are directly affected by input variables of the crystallizer.  Good correlations were obtained for viscosity, enthalpy, and slope (a measurement related to the temper curve), indicating that NIR spectroscopy has the potential to be used as a real-time process control tool for optimizing the tempering process.   

Scientific References and Statistics 

Classification and Compositional Characterization of Different Varieties of Cocoa Beans by Near Infrared Spectroscopy and Multivariate Statistical Analysis – Barbin, Maciel, Bazoni, et al., Journal of Food Science and Technology, July 2018 55(7): 2457-2466 

Cocoa beans of different varieties present inherent challenges in assessing compositional information for quality control and monitoring of processing activities after harvesting.  The use of genetic breeding to develop high resistance to plant diseases has made the assessment of compositional information even more challenging.  NIR spectroscopy was examined as a method for differentiating varieties of cocoa beans and assessing chemical and physical parameters of interest.  Parameters in the study were protein, fat, moisture, ash, carbohydrates, and three different color measurements (lightness – L*, redness – a*, and yellowness – b*).  Five different varieties of cocoa beans ranging from fourteen to eighteen fruits each were procured for the study.  All samples were processed through the standard procedure of breaking the pod, fermentation for five days, and sun-drying for seven days before analysis.  NIR spectra were collected in reflectance mode on the intact beans from 400 nm to 2498 nm at 2 nm intervals.  A portion of each sample was ground and the NIR spectra collection process was repeated.  Standard methods were used to determine reference values for the parameters of interest.  Chemometric models were created using the NIR spectra for both the intact bean and ground samples for comparative purposes.  Principle Component Analysis (PCA) was first performed to assess the feasibility of classifying the different varieties of cocoa beans from the NIR spectra.  Partial Least Squares (PLS) regression models were created to correlate the NIR spectra to each individual parameter of interest.  For the color parameters, only the ground bean NIR spectra were used for PLS analysis.  Various pre-processing methods were applied to the NIR spectra before modeling and the results below show the best models obtained for classification and each individual parameter. 


Intact Beans: 98% of Variance Explained by Three Principle Components 

Ground Beans: 98% of Variance Explained by Three Principle Components 


Intact Beans: 

Protein R² = 0.99RMSEP= 0.18%
Moisture R² = 0.98RMSEP= 0.17%
Fat R² = 0.98RMSEP= 0.42%
Ash R² = 0.97RMSEP= 0.05%
Carbohydrates R² = 0.96RMSEP= 0.36%

Ground Beans: 

Protein R² = 0.98RMSEP= 0.14%
Moisture R² = 0.98RMSEP= 0.17%
Fat R² = 0.99RMSEP= 0.25%
Ash R² = 0.96RMSEP= 0.06%
Carbohydrates R² = 0.99RMSEP= 0.22%
L*R² = 0.87RMSEP= 0.79
a*R² = 0.88RMSEP= 0.37 
b*R² = 0.96RMSEP= 0.56

Modeling results were excellent for all parameters and proved the feasibility of using NIR spectroscopy as a method for classifying cocoa beans and measuring parameters of interest for quality control.  Principle Components in a PCA model are iterations that use differences in the data set to see if variation can be explained.  In this case, 98% of the variance is explained using three Principle Components in both PCA models proves that enough difference exists in NIR spectra of different bean varieties to use the spectra to classify them. In the case of the PLS models, the difference in the results between the ground bean and intact bean models was statistically insignificant.  In a real-time setting, a sampling system requiring no grinding of the samples is preferable and would keep sample preparation of the beans to a minimum.  In the case of the color measurement models, the results were worse than the chemical parameter models but this is likely due to a lack of homogeneity in the color of the samples, even when ground.  In order to use these models on a universal level for cocoa beans, more samples and varieties must be added, but the potential for using NIR spectroscopy for cocoa bean analysis and quality control was shown in this study.

Integrating NIR Spectroscopy and Electronic Tongue Together with Chemometric Analysis for Accurate Classification of Cocoa Bean Varieties – Teye, Huang, Takrama, Haiyang, Journal of Food Process Engineering 37 (2015) 560-566 

NIR spectroscopy and Electronic Tongue (ET) were examined together as a method for classifying cocoa bean varieties.  An ET sensor uses seven potentiometric chemical sensors that all differ in the five tastes: sourness, saltines, sweetness, bitterness, and savory.  One gram of each sample is weighed and 100 mL of boiled distilled water is added.  Samples are cooled, filtered, and the filtrate is used for ET analysis.  Five varieties of twenty samples each of cocoa beans were procured for the study.  All samples were ground and sieved before both NIR and ET analysis.  NIR spectra were collected from 10000 cm-1 to 4000 cm-1 at 3.856 cm-1 interval using 8 cm-1 resolution.  Thirty-two scans were collected and averaged into one spectrum for each sample.  After ET analysis, different algorithms were performed on both the NIR and ET data.  Standard Normal Variate (SNV) treatment was performed on the NIR spectra to remove slope variation and scatter effects. After SNV transformation, the wavenumber range from 9500 cm-1 to 7500 cm-1 was chosen for further analysis.  Principle Component Analysis (PCA) was performed for the selection of optimum variables from both the NIR spectra and ET data.  Support Vector Machine (SVM) is a non-linear supervised pattern recognition method that was used to create classification models from the NIR spectra, ET data, and the combination of NIR spectra and ET data after data fusion.  Data fusion was performed after PCA on both sets of data to choose the optimum variables.  Both sets were scaled by normalization and merged as one input for the SVM model. Out of the one hundred total samples, sixty-five were used for the classification models and thirty-five were used for a validation set. 


NIR Data Correct Classification92.0%
ET Data Correct Classification80.0%
Combined NIR and ET Data Correct Classification100.0% 

The best results were shown using the combined data set after PCA and SVM modeling.  SVM is particularly used for non-linear techniques and reference values obtained on samples for protein, ash, pH, and moisture showed a marked difference in those values for the different varieties of samples.  The potential was shown in this study for an accurate and rapid solution to classification problems in cocoa beans using both NIR spectroscopy and ET analysis.  Such analysis could be a useful tool in both quality assurance of beans and development of breeding programs.

Non-Destructive Determination of Cocoa Bean Quality Using FT-NIR Spectroscopy – Sunoj, Igathinathane, Visvanathan, Computers and Electronics In Agriculture 124 (2016) 234-242 

Adulteration is a big problem in the food industry and cocoa beans are no exception.  Assessing bean quality and variety is important as beans can vary in their chemical composition.  Misrepresenting a higher quality bean variety with a lower quality bean is one potential form of adulteration.  Another form of adulteration is to mix under-fermented beans with ones that are fermented to the proper state.  Three important quality parameters are fermentation index, pH, and total polyphenols.  Fermentation index directly measures degree of fermentation.  Unfermented beans have a pH of 5.5-5.8 while properly fermented beans have a pH of 4.75-5.19.  Polyphenols serve as an antioxidant, adding to the nutritional value of beans as well as imparting astringency and bitterness.  NIR spectroscopy was examined a method for determining these three quality parameters in cocoa beans.  Ripe cocoa pods were directly procured after harvesting for the study.  Four portions of fifty pods each were stored at ambient temperature and relative humidity for a period of zero, seven, fourteen, and twenty-one days.  At the end of each period, the fifty pods were split open and fermentation was initiated.  For each day of fermentation (over six days), 150 g of sample was pulled for collecting NIR spectra and reference test analysis.  NIR spectra were collected using an FT-NIR spectrometer from 12500 cm-1 to 3600 cm-1 averaging sixty scans per spectrum at 8 cm-1 resolution. Various pre-treatments were performed on the NIR spectra before Partial Least Squares (PLS) chemometric analysis and standard reference methods were used to obtain values for fermentation index, pH, and total polyphenols.   

Fermentation IndexR² = 0.88RMSEP= 0.06
pHR² = 0.76RMSEP= 0.26
Total PolyphenolsR² = 0.84RMSEP= 0.93 mg/g

The study demonstrated the potential for measuring fermentation index, pH, and total polyphenols using NIR spectra and PLS calibration models.   While correlation coefficients for the models was not particularly high, independent predictions using cross-validation generally agreed with the reference values.  Results should improve with more samples and a larger range of reference values.  The small range of values for pH very likely contributed to poorer results than those shown for fermentation index and total polyphenols.  It is estimated that performing reference tests for these three parameters would take approximately twenty-eight hours.  Using NIR spectroscopy to measure them would take approximately a minute, justifying continued work and study of the feasibility of the NIR method.

Near Infrared Spectroscopy as a New Tool to Determine Cocoa Fermentation Levels Through Ammonia Nitrogen Quantification – Hue, Gunata, Bergounhou, et al., Food Chemistry 148 (2014) 240-245 

Fermentation is a key step in producing quality cocoa.  In the experience of cocoa and chocolate manufacturers, a direct correlation exists between the level of ammonia nitrogen (NH3) and fermentation level, making ammonia nitrogen a good fermentation marker.  It has also been demonstrated that ammonia nitrogen level varies in beans of different geographical origin.  Because of this, manufacturers must refer to their own background knowledge to determine the fermentation level when assessing proper conditions for optimum fermentation of beans.  The current reference test used for determining ammonia nitrogen is the Conway method, which is expensive and time-consuming.  A fast, non-invasive technique for determining ammonia nitrogen would be useful for manufacturers and NIR spectroscopy was examined for this purpose.  Over thirty total micro-fermentation trials were carried out in seven different countries for the study.  The standard fermentation technique for cocoa beans was implemented over six days for each trial.  Samples were stirred at various points during fermentation and pulled from various sections of the fermentation boxes.  Temperature was monitored for most of the samples.  In total, seven hundred eighteen samples were created during the trials.  Of these, one hundred and ninety were chosen for wet chemistry and NIR analysis according to a design of experiment conducted to determine the optimum sample set encompassing different variables such as temperature and box positioning.  NIR spectra were collected in reflectance mode from 400 nm to 2500 nm in 2 nm intervals averaging 32 scans per spectrum.  The Conway method was used to obtain reference values for ammonia nitrogen, with samples ranging from 25 ppm to 441 ppm. A Partial Least Squares (PLS) model was created using the NIR spectra and reference values. 

Ammonia NitrogenR² = 0.975RMSEP= 16 ppm

The model results showed excellent correlation between the NIR spectra and reference values for ammonia nitrogen, indicating that NIR spectroscopy can be used as a reliable and efficient method for determining ammonia nitrogen content in cocoa beans.  Statistical analysis confirmed that ammonia nitrogen is produced during fermentation of the beans.  The amount produced is a function of fermentation, sum of temperatures, and geographical origin.  The robust design of this study obtained a good picture of fermentation heterogeneity.  However, it must be noted that because of the small concentration of ammonia nitrogen, it is likely that the PLS model is using an indirect correlation with another physiochemical change related to the change in ammonia nitrogen.  It is also possible that this indirect correlation is a direct measurement of fermentation.  While indirect correlations in regression models are acceptable in NIR spectroscopy, such models must be carefully examined and validated to prove that the correlation is reliable.  Adding more samples from different parts of the world to the study will increase the robustness of the model and give farmers a tool to manage fermentation in real-time as well as provide a quality control screening tool for cocoa and chocolate manufacturers when purchasing cocoa beans.

In-Line Measurement of Tempered Cocoa Butter and Chocolate by Means of Near-Infrared Spectroscopy – Bolliger, Zeng, Windhab, JAOCS, Vol. 76, no. 6 (1999) 

Tempering is one of the main process steps for determining product quality in chocolate manufacturing.  The objective is to produce cocoa butter crystal nuclei in the preferred modification for ideal texture and melting point.  It has been shown that in a shear crystallizer, the mechanical energy input has a significant influence on viscosity, enthalpy, and slope (defined as the second point of inflection of a temper curve).  Defined relationships exist between rheological data and temper curve measurements but obtaining this rheological data in real-time is impractical.  NIR spectroscopy was examined as a method for determining viscosity, enthalpy, and slope in pre-crystallized cocoa butter.  A crystallizer was set up using the standard tempering method for the study.  Mass flow, rotor speed, and outlet temperature were all set and monitored through the process.  The constant cooling temperature was varied during the runs.  Samples were pulled directly from the process and NIR spectra were immediately collected after a crystal had nucleated.  Samples were scanned from 1000 nm to 2500 nm using a reflectance probe.  There was a 5 mm gap between the end of the probe and reflection surface where the samples were placed.  After the NIR spectra were collected, viscosity, enthalpy, and temper curve values were obtained using standard reference methods.  Partial Least Squares (PLS) regression models were created using the NIR spectra and reference values for the parameters of interest. 

Viscosity R² = 0.970
Enthalpy R² = 0.975
Slope R² = 0.945

Correlation for all three parameters was excellent and the models were tested in a new set of experiments using a constant outlet temperature of 25°C.  Both the viscosity and enthalpy were shown to increase as the rpm of rotor speed accelerated during the tempering process, which is the expected result.  At 700 rpm, a peak was reached.  Similar results were shown for the slope measurements. It is suggested that the results here indicate that NIR spectra can be correlated with microstructural information related to the size, shape, and quantity of cocoa butter crystals.  Further statistical analysis such as selective wavelength ranges correlating to the known regions for overtone vibrations of cocoa butter molecules would help further prove the validity of the correlation.  The results here do show the potential for monitoring the tempering process in chocolate manufacturing using NIR spectroscopy.