Embedded Based Miniaturized Universal Electrochemical Sensing Platform

We created an embedded sensing platform based on STM32 embedded system, with integrated carbon-electrode ionic sensor by using a self-made plug. Given ration of concentration-unknown nitrate liquid samples, this platform is able to measure the nitrate concentration in neutral environment. Response signals which were transmitted by the sensor can be displayed via a serial port to the computer screen or via Bluetooth to the smartphone. Processed by a fitting function, signals are transformed into related concentration. Through repeating the experiment many times, the accuracy and repeatability turned out to be excellent. The results can be automatically stored on smartphone via Bluetooth. We created this embedded sensing platform for field water quality measurement. This platform also can be applied for other micro sensors’ signal acquisition and data processing.


Introduction
Nitrates are important constituents of living organisms such as proteins, amino acids, and nucleic acids (DNA).Although excessive nitrate contents have seriously affected human health and the environment [1], this does not mean that too much nitrate is poisonous.The reduction of nitrates, a reaction which anaerobic bacteria (such as some photosynthetic bacteria) perform in an aquarium, releases nitrites and ammonia, which are poisonous [2].If the nitrate content is excessive, the reduction reaction can be catalyzed to react rapidly, thereby poisoning the aquatic life.An abundance of nitrates can also cause methemoglobinemia, which seriously affects the human body.Besides, the standard nitrate concentration of potable water in China is less than 10 mg/L.Therefore, creating a platform to detect the nitrate concentration in water effectively and accurately has become necessary and meaningful.
People, such as farmers, urban residents, and environmentalists, want to know how seriously polluted the water they drink is.However, it is difficult for average citizens to detect invisible concentrations of nitrates in water because specialized, expensive equipment is required for the detection [2].To enable the average citizen to determine nitrate concentrations in water, a low-cost, easy-to-operate, mancarried platform for nitrate detection was created.The data collected from the nitrate sensor in the platform can be processed not only by a computer, but also by an Androidbased smartphone, allowing a person to easily read the results from either the computer or the phone.A person, using a smartphone to read the results, can locate the information about contaminants on a map and share that information on a network, such as the Weibo website, where others can readily see whether the water quality in that place is good or not.
Many methods, such as spectroscopy, capillary electrophoresis, and electrochemistry, have been proposed to detect nitrate concentration [3].The spectroscopic method is widely used to detect nitrates [4,5].However, this method can be used only to determine nitrate concentrations between 0.28 ppb and 28 ppb [3].Because the spectroscopic method is unreliable for concentrations above 28 ppb [2], an alternate method must be used.Electrophoresis, however, is too complicated for a typical citizen to operate [6].
The electrochemistry method is relatively easy to operate, compared with other methods [3,7,8].Because the electrochemistry method is dependable, portable, and low-cost to operate, it is an ideal method for detecting nitrate concentrations [2].In the electrochemistry system, an oxidation or reduction reaction occurs when the voltage sweeps between working and reference electrodes [9].Cyclic voltammetry is universally applied in electrochemistry systems [3].In electrochemistry systems, every detection process requires only 8 mL of liquid sample because of the microscale electrodes design and small capacity of the test bottle, which makes the system portable.
An emerging technology named underwater sensor networks has comprehensive applications in oceanographic data collection, pollution monitoring, offshore exploration, and so on [10].But it is not portable to carry, so we propose an embedded sensing platform based on the STM32 embedded system, which has an integrated carbon-electrode ionic sensor, a controlling circuit, and a computer (or a smartphone) that can receive and deal with the data transferred from the liquid sample.The integrated carbon-electrode ionic sensor is designed to be miniaturized with small electrodes so that the sensor has low ohmic drop, rapid mass transport, and low capacitive current [11,12].We use the carbon as working electrode because it applies to testing different concentrations of nitrate in neutral environment.Testing in a neutral environment can make it easier for people to use than testing in an acidic or alkaline environment.Users can easily operate the platform by looking at the Liquid Crystal Display (LCD) that shows the functions of the platform and depressing the buttons on the box to choose the desired option.
Because the system's entire package is lightweight and compact, it can be carried and operated outdoors.The embedded sensing platform is different from some smartphone based sensing platforms [2].Our platform achieves programmable adjustment of the voltage excitation signal by using the STM32 embedded system.Thus, the sweeping voltage for the electrochemical system is more accurate and stable than that for other smartphone based sensing platforms [2].The Digital-to-Analog Converter (DAC) module in the circuit board and the Analog-to-Digital Converter (ADC) module enable the system to send and retrieve signals.The use of a serial port to send data to a PC makes our system easy to handle and able to deal with the results.Also, the use of Bluetooth makes it possible for users to easily operate the system outdoors and read the results directly from their smartphones.After the data is retrieved from the electrochemistry sensor, a curve, electrochemical impedance spectroscopy (EIS), is drawn to provide important information for further study, such as searching the characteristic values and calculating fitting functions.As cloud computing is becoming increasingly popular, we adopt cloud storage to store the measurement results in a confidential, integral, and available way [13].To protect data privacy, we use secure searchable encryption schemes to meet different privacy requirements [14].A content-based search scheme makes semantic search more effective and context-aware [15].All in all, our embedded sensing platform detects and measures the concentration of nitrates.And it can store results in the memory embedded in the circuit.Users are allowed to share the testing results to social networks.If the sensor is equipped with the appropriate electrodes, our platform universally detects other ions or contaminants, such as metal ions or bacteria [16].

Design of the Embedded Sensing Platform.
The design sketch of the embedded sensing platform is shown in Figures 1(a) and 1(b).As shown in Figure 1(a), the complete package of this platform includes a white box that wraps the whole controlling circuits as Figure 1(b) displays, a computer that connects to the serial port, or a smartphone and the sensor.In order to make it convenient for users to use this platform outdoors, we added Bluetooth to the circuit.Figure 2 shows the detailed executing procedure of the embedded sensing platform.The steps during the detection are as follows.(1) The DAC module in the circuit board generates a sweeping voltage to (2) drive the nitrate electrochemical sensor.(3) The ADC module embedded in the circuit retrieves the output voltage from the sensor and (4) the data is stored in the memory.(5) The serial port reads the data from the memory and ( 6) sends to a PC once it receives the command sent from the box.( 7) The results will be calculated via computer  3) ADC module transfers the voltage that is generated by the sensor to digits so the system can identify the data.( 4) Test data will be stored temporarily in the memory of the embedded system.(( 5) and ( 6)) Serial port reads data from memory and sends to PC. ( 7) PC stored the data and calculated the results.(( 8) and ( 9)) Data is transferred by Bluetooth from memory to smartphone.( 10) Users can share the information about the testing results, like the nitrate concentration, to the network such as Weibo.software and will be stored for further study.Alternatively, Bluetooth also can (8) receive the data from the memory and ( 9) send the data to a smartphone.(10) The information of the detection can be sent to a social network, such as Weibo.
The embedded sensing platform provides an option, Run option, to drive the system.Retrieved from the electrochemical sensor, the data is output after the user depresses Output option.Then the data is sent to a computer via the serial port.The data can be processed in the computer.Alternatively, an application in a smartphone is supposed to retrieve the data from the sensor with the help of Bluetooth.We concluded a fitting function by extracting characteristic values on the EIS curves, which are drawn from nitrate measurements.Finally, after the detection of the nitrate solutions, the results can be shown or stored in a computer or in a smartphone.

Electrochemical Sensor (RRPE1001C) Fabrication.
The layout and schematic of the electrochemical sensor are shown in Figures 3(a) and 3(b).The miniaturized circuit is distributed on plastic substrate.The carbon electrodes are designed in a square in round corners fashion.Electrodes on the surface are counter, working, and reference electrodes, respectively.The working electrode is made of carbon, because it applies to testing different concentrations of nitrate in neutral environment, which is proved to be reliable.In electrochemical system, carbon electrode has high stability and good electrical conductivity.And also, testing in neutral environment can make it easier for people to use than testing in acidic or alkaline environment.With the oxidation of OH − at high current density [2], oxygen bubbles are likely to attach on the sensor's surface.So the area of counter electrode is fabricated to be the largest to reduce the impact.Figure 3(c Triangular wave excitation would be output to run the electrochemical system.Data would be collected by DAC which is embedded in the circuit board.The system transferred data with the use of Moving Window Denoising (MWD) method via serial port to PC or by Bluetooth to smartphone.As the data is collected from the system, a curve which is called electrochemical impedance spectroscopy (EIS) would be drawn so as to provide important information for calculating the nitrate concentration or for further study.
solution is 7 before the experiment.After testing, the pH value remains 7.

Cyclic Voltammetry Method.
Cyclic voltammetry method is an electrochemistry method.By changing the voltage on the electrodes over time, it is able to obtain the reduction/oxidation reaction in the electrochemical system [17,18].In this embedded sensing platform, the voltage sweeping range is −1.5 V to +1.5 V, and the output voltage is in the form of triangular wave.Sodium nitrate with different densities is mixed with purified water (H 2 O) that is used as electrolyte for testing.We use carbon as working electrode because it applies to testing different concentrations of nitrate in neutral environment.So we use DI water as electrolyte.
Every period of the sweeping voltage is 30 seconds.The voltage starts from 0 V.It increases to 1.5 V in 7.5 seconds with a sweeping rate of 200 mV/s.After that, the voltage decreases to −1.5 V in 15 seconds with the same rate.In the last 7.5 seconds in a whole period, the voltage increases with the rate of 200 mV/s to 0 V finally.The first cycle of the sweeping voltage is regarded as the activation process that is supposed to eliminate the impact of the oxidation at the surface of the working electrode [2].The whole testing includes four cycles and the data received from the second, the third, and the forth cycles are used for further study as the first cycle is for activation process.The curves were more accurate if we adopt the average of the 2nd, 3rd, and 4th cycles.We did many experiments to make sure the migration effect did not happen between the working and reference electrode.Through the testing results, we compared these results collected from all the experiments.We found that the data collected from the second period of the testing, the third period of the testing, and the fourth period of the testing are approximate.We also found that the curves drawn from the data collected from different days are approximate.So we make sure that the migration effect did not affect our results.

Embedded Programming Implement.
The embedded system was programmed by the software Keil uVision 4, which provides library functions for users so as to simplify the programming.The API (Application Programming Interface) is the core of this system, which can be called by users' commands.There are four options being displayed on the LCD.There are Set, Run, Stop, and Output shown on the LCD, respectively.Set option makes it possible for users to change the voltage and period of triangular waveforms.Run option enables the electrochemical sensor work by the drive of sweeping voltage; it also roughly removes some noise that may exist in the data by calculating the average of the 2nd, 3rd, and 4th periods.Stop option can be used to terminate sending the voltage from the platform to the sensor during the operation.As for Output option, it is mainly used for sending the retrieved data to the computer through serial port or to the smartphone via Bluetooth.As shown in Figure 4, the whole system works according to this process.
We program the embedded system in virtue of the software Keil uVision 4. We use the functions which are provided by the library in the software, such as GPIO functions (used to initialize the pins in the circuit board), TIM functions (used to initialize the clock), DMA functions (used to initialize the DMA channels that can transfer mass data), and ADC and DAC functions (used to initialize the ADC and the DAC modules).
Since the acquiescent original electrochemical voltage is between −1.5 V and +1.5 V, with the original period which is 30 s, the output of the frequency data from the embedded system is performed to meet the requirements.Due to the output voltage generated before the Op-amp addition circuit performs, the maximum of the voltage is seen as 3 V.The signaling rate of sending definite voltage of every interrupt in the program is determined by the TIM module that is collocated in the microcontroller (STM32F407VGT6).To general triangular waveform voltage of plus or minus 1.5 V, DAC is supposed to execute interrupts 3723 times per 30 s (the period), since the DAC determines 4095 is corresponding with reference voltage of 3.3 V.The TIM module with the prescaler of 2 and the clock frequency of 42 MHz needs to determine the frequency to get into the interrupt.Based on the TIM module, the relation between frequency and the maximum of output voltage (called as PeakValue in the equation, which is 3723 if the maximum of the electrochemical voltage is 3 V) is as the following equation (1): The range of the triangular voltage signal is −1.5 V to +1.5 V and the period is 30 seconds.The triangular voltage signal is sent by the DAC module embedded in the microcontroller.Definite voltages are sent every short interval of time.The adjacent two voltage signals are 0.806 mV apart.
2.5.Software Implement.The software can be operated both on an Android-based smartphone and on a Windows-based PC.The mobile phone receiving terminal is called mobile sensor platform, which supplies functions of detecting, analyzing, mapping, and showing the weather.The PC receiver is called ComAssistant, which receives data via serial port.The software on a PC or the software in a smartphone will calculate the data to determine liquid samples' concentrations.A liquid sample's concentration and other results will be displayed on the screen of a computer or on the screen of a smartphone.

Data Processing.
Although the retrieved data from a serial port or from Bluetooth is roughly dealt with, the curves drawn from the data still have some noise that may badly influence the results of the measurements.So before obtaining the fitting function, we eliminate the noise with the method of Moving Window Denoising (MWD).The MWD method updates the 571 points by calculating the average of every point and its next point (see Algorithm 1).
In order to obtain the fitting function that describes the relation between the acquired data and the concentrations of nitrate liquid samples, we tested 9 different concentrations of NaNO 3 liquid samples in a neutral environment.After MWD, characteristic values are supposed to be determined from the worked data.Through exploring many times, the results turn out to be excellent if slopes of the first inflection points and the acreages enclosed by every curve are chosen as characteristic values.The method of calculating slopes of the first inflection points in every curve is to find out the approximate region where the inflection point exists and calculate the slopes of the point, which made the calculation more effective.As Figures 5(c) and 5(d) show, the first inflection point in every curve has been marked red.Integration is used to calculate the acreage of the irregular figure that every curve encloses.Using the Least Square Method (LSM), the fitting

Results and Discussion
3.1.Miniaturized Nitrate Testing.The process of nitrate reduction in a neutral environment is either 2 electrons (94%) or 8 electrons (6%) as given below: (see [2,7]) or (see [2,7,19]).Nine testing samples with different nitrate concentrations from 1 ppm to 150 ppm were measured by plus or minus 1.5 V sweeping triangular waveform voltage for 4 times.The first periods in every test are regarded as activation process, and the 2nd, the 3rd, and the 4th periods are used for calculating the average curves.

Measurement Results.
The embedded sensing platform is utilized to measure the nitrate concentration in a neutral environment.The raw data is processed with the method introduced in the preceding part and the tested liquid's concentration can be determined by (2).
Using the control variable method, we handle the volume, the kind of sensor, and the environment to be invariable and change concentrations of the testing samples only.The nitrate concentrations of standard testing samples are 1 ppm, 5 ppm, 10 ppm, 20 ppm, 30 ppm, 50 ppm, 75 ppm, 100 ppm, and 150 ppm, respectively.Here we analyzed the data we obtained from the first time we used a new sensor and used this sensor a second time for testing.The results turn out to be excellent as shown in Table 1 (showing the results  obtained from the first test) and Table 2 (showing the results acquired from the second test).Figure 5 shows the two testing curves.The first test is used to calculate the fitting function, and the second test is to verify that the fitting function is applicable in other tests.From the laboratory findings, the fitting function is proved to be suitable for measuring the concentrations of unknown nitrate liquid.As the standard nitrate concentration of potable water in China is less than 10 mg/L, the platform is able to distinguish whether the water samples users are testing reach the standard or not.Owing to its miniaturized size, the platform is designed to be portable and easy for users to carry and operate.

Conclusions
In general, we have created an embedded sensing platform for portable and rapid nitrate concentration measurement.
It includes a sender and receiver of the voltage, a small three-electrode electrochemical sensor, and a computer or a smartphone.The platform could test the nitrate ion and concentration in water based on existing analytical data and the fitting function.The results can be both received and stored by a smartphone and a computer so it is convenient for further study.

Figure 1 :
Figure 1: Design sketch of the embedded sensing platform.(a) Assembly outlook of the embedded box.(b) The view of the whole controlling circuits.

Figure 2 :
Figure 2: The schematic diagram about the detailed executing procedure of the embedded sensing platform.(1) The box sent the command to control the DAC module so as to generate sweeping triangular waveform.(2) Sweeping voltage transfers to the electrochemical system for testing.(3) ADC module transfers the voltage that is generated by the sensor to digits so the system can identify the data.(4) Test data will be stored temporarily in the memory of the embedded system.((5) and (6)) Serial port reads data from memory and sends to PC. (7) PC stored the data and calculated the results.((8) and (9)) Data is transferred by Bluetooth from memory to smartphone.(10) Users can share the information about the testing results, like the nitrate concentration, to the network such as Weibo.

Figure 3 :
Figure 3: The electrochemical sensor and fabrication.(a) Real image of the sensor.(b) The schematic diagram presenting the three electrodes of the sensor.(c) Photograph showing the self-made plug suitable for the sensor.

Figure 4 :
Figure4: The sequence of the steps during the detection.According to the front page, users could choose the function to execute the procedure.Triangular wave excitation would be output to run the electrochemical system.Data would be collected by DAC which is embedded in the circuit board.The system transferred data with the use of Moving Window Denoising (MWD) method via serial port to PC or by Bluetooth to smartphone.As the data is collected from the system, a curve which is called electrochemical impedance spectroscopy (EIS) would be drawn so as to provide important information for calculating the nitrate concentration or for further study.

Figure 5 :
Figure 5: ((a) and (b)) Two testing EIS curves drawn by original data.All EIS curves are acquired from the electrochemical system in which the sweeping triangular waveform voltage is plus or minus 1.5 V, with the period of 30 s.(a) Original curves of the first test.(b) Original curves of the second test.(c) Denoised EIS curves from the first test.(d) Denoised EIS curves from the second test.The first inflection points on every curve are pointed out by red points.EIS curves are used for calculating the characteristic values.The acreages enclosed by every curve and the slope of the first inflection point are characteristic values.

Figure 6 :
Figure 6: User interface of the application in the smartphone.(a) The main page of the application.(b) Testing results plotted on the phone screen.(c) Showing the location of the test on Baidu map.(d) Information posted on Weibo website through this page.

Figure 6 (
a) displays the main page of the application, which contains testing option, analysis option, map option, and weather option.The real time curve is drawn on the phone screen just like Figure6(b) describes.

Figure 6 (
c) shows the location of the test on Baidu map.The sharing page of the testing results is shown in Figure6(d).After a user depresses the Send option at the top right corner of the page, a message about nitrate testing results will be seen on the Weibo website.

Table 1 :
Measurement results of the first test. represents the concentration of the testing nitrate liquid. represents the acreage of the curve.The slope of the first inflection point is .

Table 2 :
Measurement results of the second test.Network to Share the Nitrate Testing Results.The application on the smartphone is developed to share the nitrate detection results to the social networks, such as Weibo in China.Users can send the sensing results, such as the nitrate concentration, the date, and the location, to a social network for public communication.An example of the smartphone application interface is shown in Figure6.