Introduction

Milk is a basic and important food for human beings because it contains the essential nutrients and micronutrients [1]. Milk and other dairy products are excellent sources of calcium ions, both qualitatively and quantitatively. In processed milk powder, essential elements are usually added in order to satisfy nutritional requirements. It has high nutritional value and is also considered as a complete food. Milk is the basic food of infants and possesses all the prerequisites required for an ideal carrier vehicle. Calcium ions (Ca2+) in milk are more easily absorbed by the intestine than the calcium ions from the vegetables and cereals. Calcium ions are necessary for the growth and development of infants. Calcium is an essential mineral required for the diverse physiological and biochemical functions in the human body [2]. Regular intake of necessary amount of calcium ions is essential to keep better the function of a number of physiological processes like intercellular communication, muscular contraction, secretion and blood coagulation. Calcium ions are required in the homeostatic regulation of inorganic compounds. Institute of Medicine recommended 800 mg of calcium ions per day for children between 4 and 8 years and 1300 mg calcium ion for children of 9–18 years old, 1000 mg per day between 19 and 50 years including pregnancy and lactation period and 1200 mg per day for citizens older than 51 [3]. There have been many methods for the determination of calcium ions, which involve atomic absorption spectrometry, potentiometry with ion selective electrodes, EDTA titration and spectrophotometry with variety of reagents. Among these methods, spectrophotometry is well-suited because of its simplicity and cost effective. In spectrophotometry the formation of an absorbent complex by reaction between the analyte and an external reagent is normally used to determine the analyte [4]. The basic principle of the spectrophotometry is the transmittance measurement which relies on Beer’s law. The calcium ions react with OCPC, forms deep purple a colored complex. This complex absorbs and gives maximum at 570 nm wavelength of light. Hence, all the absorbances are measured spectrophotometrically at 570 nm of wavelength.

In biomedical field, dedicated instruments are very common to carry out artificial process with high speed, re-programmable facility and user defined functions. Programmable device like microcontrollers are becoming an integral part of instruments because of their superior application-specific properties with a rich variety of features. There is an increasing interest and demand for a portable, inexpensive but powerful spectrophotometer providing easy operation for individual use, based on microcontroller. The construction of such a spectrophotometer depends upon the availability of low-cost devices and low-power source such as LED and a compact optical detection system with effective background correction. High intensity, monochromatic and small degradation over the life time are the key reasons to use visible LEDs in modern spectrophotometers as source. New developments, especially in hardware technologies can only further improve the system capabilities compared to the conventional tungsten filament lamp spectrophotometer. So, the proposed system is designed and developed around a commercially available popular microcontroller. A colorimetric absorption spectrophotometer based on PIC18F452 Reduced Instruction Set Computer (RISC) Central Processing Unit (CPU) microcontroller seems to be very attractive in the development of a small analyzer with simple components. In the present study, a low cost, high sensitivity and easy programmable unit has been designed to assert advantages of microcontroller based system. The basic measurement characteristics of the instrument are evaluated and its suitability for real life application is tested. For performance and clinical applications, the proposed system is calibrated with calcium standard solutions.

Experimental

Hardware design

The PIC18F452 microcontroller based instrumental setup for the measurement of calcium ions in milk sample is shown in Fig. 1.

Fig. 1
figure 1

Circuit diagram of PIC18F452 microcontroller based calcium measurement system

The selection of the microcontroller is made based on the availability of data and program memories. The PIC18F452 from Microchip Technology, CA, have enhanced on-chip programmable flash memory of 32 KB operates at 4 MHz and supports 16-bit wide instructions with 8-bit wide data path. This microcontroller has five bi-directional I/O ports with high sink/source current of 25 mA. The main feature of this controller is that, it is compatible with 10-bit wide ADC with linearity ≤1 LSB. It has two Capture/Compare/PWM modules. This controller features 3-wire SPI, I2C Master/Slave mode and supports RS-485 and RS-232 using addressable USART for serial communication and the Parallel Slave Port (PSP) for parallel communication [5]. Recent advancements in material and manufacturing methods results in the production of LED with advance features. The traditional tungsten lamp is replaced with LED and it emits radiation of 570 nm wavelength. A photodiode (S2386, Hamamatsu Photonics, Japan) is used as sensor to detect the amount of light and this assembly is well insulted from ambient or external light. The signal conditioning circuit made up of dual operational amplifier LF353 IC (IC1) (Fairchild Semiconductor Corporation, South Portland, U.S.A.) is based on a gain offset amplifier, which adapts the voltage range to the analog to digital converter full scale value. The RC low pass filter reduces the noise coming from the photodiode and power supply. The output pin of IC1 is given to the pin number 3 of microcontroller unit (IC3) for analog to digital conversion. The incubation temperature is measured using LM35D temperature sensor (National Semiconductor, Americas) whose output is directly calibrated to Celsius. Hence, it does not require any external calibration or trimming arrangement. The pin number 2 of IC2 (LM35D) is connected to the pin number 2 of IC3 for digital conversion. A keypad is interfaced with PB0-PB6 pins of PORTB for user interaction with microcontroller to give commands. The controller is programmed to receive analog input signal from photo diode amplifier and temperature measurement circuits at pin number 2 and 3 of PORTA from IC1 and IC2 for analog to digital conversion. An RS-232 serial interface is implemented with the TXD (25) and RXD (26) pins of the USART module (IC3). The serial block is set up using a MAX232 (Maxim Integrated Products, Sunnyvale, CA) to achieve the necessary level shifting for communication between a PC. Temperature controller unit is built with TRIAC, pulse transformer, transistor and heater. Pulse transformer (ratio 1:1), that triggers the gate of the TRIAC (BTA12, STMicroelectronics, Australia) is connected the PORTC through the transistor (TI). The TRIAC is activated by proper commands from the microcontroller through the PC1 pin of PORTC to maintain incubation temperature at 37 °C. The PORTD and two LSB (RE0 and RE1) pins of PORTE are connected to LCD which is used to display the main menu, user command, temperature of incubation, absorbance and total calcium ions concentration of the milk samples.

Reagents

The standard and sample solutions were prepared using the reagent, to measure absorbance of calcium samples. All reagents used were of analytical grade and all solutions were prepared with doubly distilled deionised water. All solutions including samples and standards were stored in polyethylene bottle. All glass calibrated flasks of high grade and immersed in 2.0 mol L−1 HNO3 for at least 12 h, then washed with pure water. OCPC kit from Teco Diagnostic (CA, USA) was used without any further purification. OCPC is a triphenylmethane based chelating ligand containing two iminodiacetic acid functional groups. It complexes with a number of polyvalent metals but only forms characteristics deep purple colored complexes (MHL3−) with the alkaline earth metals. Ortho cresolphthalein complexone forms Ca(CPC)4−, CaH(CPC)3− and Ca2(CPC)2− complexes with Ca2+ [6]. It is readily soluble in aqueous alkaline solutions and common organic solvents. It is an acid–base indicator necessitating the use of a strong buffer to stabilize the pH. The complex formation between Ca2+-CPC occurs at strong alkaline medium. However, formation of complex was detectable spectrophotometrically at 570 nm and a strong alkaline buffer with pH 10.7 was needed to stabilize the reaction. Hence, pH 10.7 was maintained for all experiments to record the maximum absorbance.

Preparation of milk and milk powder samples

Milk and milk powder samples were collected from the local market. Milk samples were diluted 1:10 or 1:100 (v/v) with water and then introduced into the system for analysis [7]. In the preparation of milk powder sample, a 0.5 g of powder sample was accurately weighted for the determination of calcium ion. The sample then, digested with HNO3–HClO4 at the ration of 9:1 (v/v) to the near dryness. Distill water of 20 mL was added into the residue. Again the solution was evaporated to dry. The resulting solution was transferred into a 50 mL volumetric flask and diluted to the mark with water [8]. The prepared solutions were introduced in the developed system.

Procedure of measurement

Analyses were carried out at 37 °C with a sample volume of 10 μL. A 1 mL of OCPC reagent was mixed with 10 μL aliquot of prepared sample. Each 1 ml of reagent mixed with 10 μL of calcium standard solution and 10 μL of nanopure distilled water for the preparations of standard and blank solutions respectively. The above solutions were thoroughly mixed and the absorbance being measured with the 5 min of incubation at 37 °C, for better sample and reagent contact. The colour was stable for at least 30 min. To get quick results readings were taken after 5 min of incubation period. All absorbance were measured spectrophotometrically at 570 nm. The same preparations procedure was followed for all samples. In the conventional system (Stat Fax® 2000, Ark Diagnostic, India), the reagent and sample preparation procedures were same and filter assembly was used to get 570 nm wavelength light. The attenuation of a light beam that passes through a solution is expressed by the Beer’s law:

$$ {\text{T}} = {\frac{{{\text{I}}_{\text{t}} }}{{{\text{I}}_{0} }}} = {\text{e}}^{ - \epsilon{\text{lC}}} $$

where T is the transmittance, I0 the intensity of incident beam light, It the intensity of the transmitted beam light, є the molar extinction coefficient, l the length of the light path and C the concentration of the light absorbing species in the solution [9]. The prepared solutions were used to measure the absorbance and compute the concentration. By placing the blank, standard and sample solution in the sample holder, the voltages Vblank, Vstd and Vsample were measured by the microcontroller and concentration of the unknown is computed using the following relation,

$$ {\text{Concentration of the sample }}\left( {{\text{mg}}/{\text{dL}}} \right) = {\frac{{{ \ln }\left( {{\text{V}}_{\text{blank}} /{\text{V}}_{\text{sample}} } \right)}}{{{ \ln }\left( {{\text{V}}_{\text{blank}} \, /{\text{V}}_{\text{std}} } \right)}}} \times {\text{Concentration}}\,{\text{of standard}} $$

Software

On startup, the microcontroller unit jumps to the starting memory location (‘0000’h) and initialize program variables such as the location of data and program memory, interrupts, all serial and parallel ports, timer/counters and ADC. All commands of the microcontroller to control the experimental process are programmed in “C” and assembly language. This includes, assignment of serial and parallel ports for I/O operations, program a LCD display in write mode, setting 4800 baud rate for data transfer-receive with PC, measurement and controlling of temperature, getting data form keypad, light intensity measurement, conversion of analog input into digital, manipulation of data and calculation of concentration, displaying and storing the results.

Results and discussion

Absorption spectra of calcium and emission band of the LED

The optical characteristic of green LED is studied under different source current to achieve similar emission band related to absorption spectra of calcium. The LEDs are typically operated under nominal, recommended conditions, in order to maintain the lifetime stability. Under these conditions, the (light) power output of the input sources rarely exceeds 50 mW per LED, which is often insufficient to induce measurable emission in many high concentration applications. So, it is essential to understand the luminance and source current characteristics to meet the best absorption efficiency of the calcium ion sample under analysis. The relationship between the luminance and the drive current of a green LED is shown in Fig. 2. As the source current increases luminance keeps on increasing. For the 50 mA source current the red and blue LEDs produces 95 and 210 cd m−2 respectively [10]. For the same 50 mA of current, the source luminance of green LED is 400 cd m−2 which is relatively high compared to blue and red LEDs. So, 50 mA is used as source current to the green LED.

Fig. 2
figure 2

The relationship between the luminance and the drive current of a green LEDs

An investigation for an emission band of LED is carried out for calcium analysis system. Figure 3 exhibits, the emission spectra of commercial LED light source whose intensity is maximum at 570 nm of wavelength. Under nominal working condition, the spectral output of the LED is constant and limited to meet the best-match absorbance efficiency. To increase, the light power and spectral flexibility, the source current is increased little bit higher than the recommended nominal current. In Fig. 3a, the LED is driven by the 20 mA of source current. From the figure, it is clear that, the emission band of LED does not meet with the calcium spectra under this normal working condition. To meet the “best-match” with the desired spectrum which is shown in Fig. 3b, the LED is driven with increased current to generate increased optical power output with fine or small spectral shifts towards the shorter wavelength. But, the change in wavelength is very small and almost equal to the required wavelength for the measurement of concentration of the sample under analysis.

Fig. 3
figure 3

LED light source for calcium analysis system a best single matched to calcium absorption spectra, b increased current to LEDs small spectral shifts and improves the match between source and absorption spectrum

Stability of the developed system

The effect of incubation period is studied by measuring the absorbance for a period of time. For better complex formation between reagent and solution, the mixed final solution is left for incubation for 5 min. The optimization of incubation period is carried out in Fig. 4. It is observed that for 5 min, the absorbance keep on increasing and it is constant after 5 min. To get quick results, readings are taken after 5 min of incubation period, even though the color remains stable for 1 h. The stability of the absorption detection is investigated using a blank solution results as base absorption line. The developed and the conventional system noise for the base absorbance are shown in Fig. 5. The average trace of the conventional spectrophotometer is localized near zero. But, the base line of the developed system is not so flat. It fluctuates between +0.0621 and −0.0473 A.U. In most measurements, photocurrent fluctuations resulting from LED illumination noise are the primary cause. The fluctuations reflect the changes in drive current, change in hole–electron pairs and ambient temperature. The changes in noise levels can be reduced by using a feedback network. However, the variations of the trace for day-to-day operations at room temperature are always within the noise levels of the conventional spectrophotometer.

Fig. 4
figure 4

Optimization of incubation period

Fig. 5
figure 5

Comparisons of noise and stability between the developed and conventional spectrometer

Linearity

Initial experiments are carried out to establish the sample processing conditions to allow analyzing samples containing different calcium ion concentrations. The response linearity of the developed system for the spectrophotometric determination of calcium ion is evaluated under the optimum conditions [6]. The test samples are diluted and adjusted to a proper concentration for application in the system. Standard stack solutions are prepared using CaCO3 to check the linearity of developed system. The calibration curve for the standard solutions of calcium for the developed system and conventional system is shown in Fig. 6. It is observed that, the calibration graph is linear for calcium ions concentrations between 0 and 5.0 mmol L−1. The linear regression line equation for the developed system is A = 0.121 + 0.175C and for the conventional system A = 0.035 + 0.177C respectively (A = a + bC; where a is the intercept, b slope, A absorbance and C is the concentration). Absorbance versus concentration is linear with a correlation coefficient (r) of 0.985 for the developed system and 0.993 for the conventional system respectively. The curve for developed system is similar to that of the conventional system. From the graph, all the points fall in the linear range and near to the straight line with minimal error.

Fig. 6
figure 6

Calibration curves for the standard solutions of calcium (◆) conventional system (■) developed system

Accuracy

The accuracy of the developed system is evaluated by comparing the results with those obtained by using a conventional system. Analysis of calcium ions in samples containing different concentration levels are taken for evaluation. Linear regression analysis is performed and tested for lack of fitness to the linear model. The results are compared statistically with those obtained by a conventional method by applying student’s t-test for accuracy and F-test for precision. From the Table 1, no significant differences are observed in t-test and F-test results between the methods. It is found that, regression analysis reveals excellent correlation between the results. Table 1 shows the statistical comparisons between developed and conventional system. The results measured with the developed system are in good agreement with the value obtained with the conventional system. Statistical analysis of measurements with the developed system is best satisfying and produces 96% confidence level keeping all the measurement errors within limits.

Table 1 Determination of calcium in milk samples from developed system and conventional system

Precision

The precision of the proposed system is determined by repetitive analyses of a number of standard calcium solutions and samples as indicated in Table 2. In all cases the Relative Standard Deviation (RSD) is <1.5%.

Table 2 Precision of the proposed developed system

Conclusion

This work shows the great possibility of the implementation of microcontroller based system for the calcium determination in milk samples. The PIC18F452 microcontroller together with other carefully selected low power electronics devices in a design results a system with inexpensive, minimal optical requirement, application specific, over conventional tungsten light spectrophotometer designs. Absorbance detection assembly (LED and photodiode) are very sensitive and selective for colored complex detection. Both, the hardware and software designs are general, but powerful enough to auto detects the mal-function. So, this device does not require any specialized personnel to operate. The detailed optical studies are carried out and ‘best-match’ absorbance efficiency between LED source and colored calcium spectrum are obtained by increasing source current to 50 mA. Base absorption line experiment proves the stability and linearity is demonstrated by regression analysis with correlation (r) values of 0.985 for the developed system and 0.993 for the conventional system. In addition, calculated t-test and F-test results show the good accuracy and better precision. Reproducibility of the instrument is examined using different concentration of calcium standard solutions and milk samples. The overall relative standard deviation of the measurement is less than 1.5%, reveals excellent precision property of the developed instrument. This system proves the suitability of calcium measurement in milk samples and exhibit good spectroscopic properties. The performance study and tabulated values show no significant differences with the conventional method and claim the 96% of confidence level. With suitable alternation in light source and slight modification in software calculation can make this instrument to measure the concentration of other anions and cations. In conclusion, the RISC microcontroller-based automated system is a practical alternative for conducting calcium ions determination in laboratory conditions.