Designing a Glucose Meter Using an 8-bit Microcontroller
According to the World Health Organization (WHO), approximately 9% of the worldwide adult population has diabetes, and it is the eighth leading cause of death. In recent years the number of deaths from diabetes has been steadily increasing, rising from approximately one million deaths in 2000 to 1.5 million deaths in 2012. One of the primary methods of managing diabetes is keeping the level of glucose in the blood as close to normal as possible. This has led to an increase in the use of glucose meters.
A glucose meter is a medical device used to determine the concentration of glucose in a solution. The glucose concentration is measured in units of milligram per decilitre (mg/dl) or millimole per litre (mmol/l). Glucose meters have become key elements of home blood glucose monitoring devices used by people with diabetes mellitus. The measurements can be taken multiple times in a single day.
Most glucose meters use electrochemical test strips to perform the measurement. A small drop of the solution to be tested is placed on a disposable test strip that the glucose meter uses for the glucose measurement. The two most common methods used in electrochemical measurement of glucose are the colorimetric and the amperometric methods.
In the colorimetric method, sensors such as LEDs or photo sensors form the analog interface. A transimpedance amplifier is used to measure the glucose concentration. The color reflectance principle is used to determine the color intensity in the reaction layer of the test strip by photometry. The meter generates a numerical value that is a measure of the glucose concentration.
In the amperometric method, a capillary is used to draw in the solution placed at one end of the test strip. The test strip also contains an enzyme electrode containing a reagent such as glucose oxidase. The glucose undergoes a chemical reaction in the presence of enzymes, and electrons are produced during the chemical reaction. The charge passing through the electrode is measured and this is proportional to the concentration of glucose in the solution. An ambient temperature measurement is also made to compensate for the effect of temperature on the rate of the reaction. Most glucose meters use this method.
The test strip forms the main biochemical sensor where the sample of solution is placed. It contains three electrodes. Electrons are produced in the working electrode during the chemical reaction. This electrode is connected to the current-to-voltage amplifier. The reference electrode is held at a constant voltage with respect to the working electrode to push the desired chemical reactions. The counter electrode supplies current to the working electrode.
Most glucose meter designs use only the reference and working electrodes. A precise reference voltage (Vref) should be applied to the reference electrode and a precise bias voltage (Vbias) to the op amp. This way, the precise potential difference is maintained across the working and reference electrodes. This voltage is the stimulus that drives the test strip’s output current, the magnitude of which is then used to calculate the number of electrons produced.
The solution sample is placed on the test strip, and the reaction of the glucose with the enzyme takes place. The flow of electrons will correspond to the flow of current through the working and the reference electrodes. This current will change according to the glucose concentration. The current is measured using a transimpedance amplifier (current-to-voltage converter) and an Analog-to-Digital Converter (ADC). The output of the transimpedance amplifier will be seen as a variation in the voltage with varying glucose concentrations in the solution.
A digital implementation of the glucose meter can be achieved using an 8-bit PIC16LF178X microcontroller (MCU). This PIC® MCU features eXtreme Low-Power (XLP) operation. It contains two op amps, two 8-bit DACs, a 12-bit ADC, an internal EEPROM, I2C™ and a 16-bit timer.
The flow of electrons can be measured with the help of the current-to-voltage conversion using the internal op amp of the PIC MCU and the filtering of highfrequency signals. The filtered signal is then fed to the 12-bit ADC module.
The PIC MCU should start capturing the voltage at the ADC channel after about 1.5s of placing the solution sample. About 2048 ADC readings were taken. The average value from these was substituted into the regression equation Y = mX + C, where Y is the glucose concentration in mg/dl, m is the slope, X is the average ADC reading of the op amp output voltage and C is a constant.
The glucose concentration can be determined using this regression equation and the value displayed on the LCD in units of mg/dl or mmol/l. Up to 32 glucose readings can be stored in the internal EEPROM and can be viewed later on the LCD. The power to the glucose meter demo board can be supplied from the on-board lithium battery (3V, 225 mAH, CR2032).
The time to start capturing the ADC values (1 to 1.5s) and the number of ADC readings taken should be modified to match the type and characteristics of the test strip used.
The design specifications for this glucose meter require a glucose measurement range of 20 to 600 mg/dl, equivalent to 1 to 33 mmol/l. Test results need to be displayed within five seconds; the most recent 32 glucose readings should be automatically stored with date and time stamp. No test strip coding is needed as the generic regression equation will be implemented and modified based on the test strip characteristics. The single board in this design uses the 28-pin PIC16LF178X device. An in-circuit serial programming connection is used for debugging and programming.
As well as showing the measurements in mg/dl and mmol/l, the LCD also displays guidance messages such as “Insert test strip”, “Strip inserted, place the sample” and “Faulty test strip”. Sensors are needed to detect if the test strip is inserted, to measure the temperature and to check the health of the battery. There are two push-buttons: one to read previously stored data and one to set the date and time.
The firmware needs to sense the test strip current using the PIC MCU’s internal op amp, DAC and ADC. ADC readings need to be captured after the test strip is inserted and these checked for a rise above 450 mV. Firmware modules are available for the LCD interface and display routines, configuration of the op amp, configuration of the DAC, storing glucose readings into the internal EEPROM, reading the ADC channel, calculating glucose concentration, and implementing the Real-Time Clock and Calendar (RTCC) using the timer for time-stamping.
The voltage reference of the DAC is connected to the internal fixed voltage reference, configured for 2.048V. The op amp output (currentto-voltage converter output) is measured with ADC channel 0. ADC channel 3 is used to measure the battery voltage to indicate a lowbattery condition. The output of the temperature sensor is connected to the ADC channel 8 to read the temperature.
Glucose readings are stored in the internal EEPROM. During sleep mode, if switch S1 is pressed, the PIC MCU enters memory mode and the stored glucose reading is displayed on the LCD. To view the previous glucose readings, switch S3 needs to be pressed. Pressing switch S1 again exits memory mode.
A 16 × 2 character LCD is used for displaying the glucose readings and text messages. Power to the LCD is cut off during sleep mode by controlling the Vss of the LCD through the port pin of the microcontroller.
The timer along with the external 32.768 kHzwatch crystal is used to implement the RTCC. The current date and time can be set for the RTCC using switches S1 and S3.
The non-inverting input channel of the op amp is connected to the DAC output set at 400 mV. The inverting terminal of the op amp is connected to the working electrode. The current-to-voltage converter is formed with the help of the external resistor and the capacitor. The output of the op amp is connected to the ADC channel of the PIC MCU.
The current consumption of the glucose meter in active mode is about 1.1 mA, and it consumes 3 μA during sleep mode. The glucose meter is in sleep mode about 99.5% of the time.
The glucose measurements were affected by external factors such as temperature, humidity, altitude and so on, because the rate of the enzyme reaction depends on these and other factors. In addition, test strips with different chemistries will require variations in the regression equation determined using MATLAB® or Microsoft® Excel. These factors must be considered when designing a glucose meter for use with any particular test strip.
The PIC16LF178X MCU’s op amp, 12-bit ADC, DAC and EEPROM makes a suitable combination for this type of battery-operated application needing precision measurement and lower current consumption. This means that the PIC MCU can be used to implement a flexible and low-cost glucose meter design. Visit our Glucose Meter Design page for additional information and resources, including the design files for our glucose meter demo. Contact your local Microchip sales representative to see a working example of the Low Cost Glucose Meter demo.