Real-time temperature monitoring and alarm system for biological samples storage based on FPGA

In the field of biosensing, high-quality biological samples are a prerequisite for precise analysis and detection. Strictly controlled storage temperature is crucial to ensure the stability of biological samples and achieve effective detection. Different biological samples require different temperature ranges for storage. Therefore, it is essential to design a temperature monitoring and alarm system capable of alarming based on different needs. This work presents a real-time temperature monitoring and alarm system based on the DS18B20 temperature sensor and FPGA chip. The system with simple structures has a wide temperature measurement range, an adjustable temperature alarm range, and a timely alarm function for various scenarios monitoring. This work demonstrates the temperature monitoring and alarm system for simple, accurate, and low-cost modes of temperature monitoring. The real-time temperature monitoring and alarm system will provide an effective means to strictly control the storage temperature of different biological samples, ensuring the stability and effectiveness of biological samples and the accuracy and sensitivity of biosensing and analysis.


Introduction
The accurate measurement and control of temperature by using a suitable sensor system is not only important in the industry [1][2] , agriculture [3][4] , and environmental temperature monitoring [5][6] but also is crucial for the field of biosensing.Accurate and sensitive detections of biological samples have always been the goal pursued in the biosensing technology [7][8][9] .The high quality of biological samples is a prerequisite for achieving accurate analysis and detection.Maintaining strict and accurate storage temperatures is a critical element in ensuring the stability of biological samples.The storage temperature can have a significant impact on the quality of the samples.So, it is essential to monitor the temperature during storage [10] .
Cryoprecipitates (additional Fresh Frozen plasma, FFP) and Molecular DNA/RNA should be stored in the range of -20℃ ~ -25℃.Some body fluids, such as saliva, urine, and blood samples, are stored in the range of 2 ~ 8℃ [11] .Storage of sweat samples at 25℃ for more than 7 days affects sweat lactate and ammonia concentrations but can be extended to 28 days at -20℃ [12] .The expression level of the Late Cornified Envelope 1D (LCE1D) gene in human skin swabs stored at 25℃ is significantly higher than those stored at 40℃ [13] .To prevent storage temperature from affecting the quality of biological samples, it is crucial to design a temperature monitoring and alarm system.
Recently, a temperature detection and tracking system was designed for storing COVID-19 vaccines.The analog signal output of this system needs modulation and conversion for temperature data reading, increasing the complexity of the system hardware structure [14] .A real-time monitoring system with ultra-low temperature freezers was exploited to store biomarkers at -80℃.When the temperature exceeds the set value, the abnormal information is alarmed via SMS or email.This system uses a thermocouple circuit for temperature measurement and an additional pre-calibrated resistance temperature detector for calibrating the circuit's deviation [15] .These may lead to complications of the system hardware structure and increased costs.
We develop a real-time temperature monitoring and alarm system by utilizing the DS18B20 as the temperature sensor and an FPGA chip as the central controller.This system has a wide temperature measurement range from -55℃ to 125℃ and has three selectable modes for different application scenarios.This system, based on three modes, is simple, low-cost, and suitable for temperature monitoring and alarming in various scenarios.

System hardware design
The overall hardware design of the system uses a modular approach.The system is divided into three modules, including a temperature measurement module, a control module, and a display and alarm module, as shown in Figure 1 (a).
The temperature measurement module contains the DS18B20 temperature sensor (oval wireframe in Figure 1 (a)).DS18B20 can measure temperature in 750 ms at the most and accurately in the range of -55℃ ~ 125℃.Meanwhile, it has excellent resistance to interference and stability.
The control module contains the FPGA main control chip (Cyclone IV E: EP4CE10F17C8), MP2359 chip, XTAL, standard JTAG debug ports, M5P16 flash storage chip, and four physical buttons (rectangular wireframe in Figure 1 (a)).The FPGA EP4CE10F17C8 chip is a controller and processes data transmission between modules.The MP2359 chip is a power supply chip and provides a stable 5 V operating voltage for the system.XTAL supplies a 50 MHz clock pulse to the system.The JTAG ports connect directly to the FPGA downloader for downloading programs or online debugging.The M5P16 Flash chip with a capacity of 16 Mbit can store the written FPGA program.Four physical buttons contain two switching buttons and two adjusting buttons.
The display and alarm module contains a digital tube, buzzer, and 7 LED lights (hexagonal wireframe in Figure 1 (a)).For the 7 LED lights (each row in Figure 1  The key to the alarm function is the adjustment of the temperature limit range according to the switching of three working modes (Modes 1, 2, and 3).The difference between these modes is the maximum and minimum of the temperature limits.In Mode 1, both the maximum and minimum limits are above zero degrees Celsius.In Mode 2, the maximum is above zero degrees Celsius, and the minimum is below zero degrees Celsius.In Mode 3, both maximum and minimum are below zero degrees Celsius.The maximum and minimum temperature limits are adjusted by using buttons.If the measured temperature exceeds the limits in different modes, the buzzer and the corresponding alarm indicator light will start working.
Taking Mode 1 as an example (Figure 1 (b)), the Mode 1_led indicator is lit (green), indicating that the system is working in Mode 1.When the temperature measured exceeds the limits in Mode 1, the Warn 1_led indicator will light up (red), and the buzzer will sound (the second row in Figure 1 (b)).When the Adjust_led is lit (blue), it indicates that the maximum and minimum values of the temperature limits of Mode 1 could be adjusted (the third row in Figure 1 (b)).If the temperature measured exceeds the limits when Adjust_led has lighted up (blue), the Warn 1_led indicator will light up (red), and the buzzer will sound as well (the fourth row in Figure 1 (b)).Other working modes are similar to Mode 1, so we can switch working modes by switching buttons.

System software design
The overall software design of the system uses the Top-down design method.Functions implemented by FPGA will be divided into six modules (Figure 2): the Jitter eliminating module, the DS18B20 controlling module, a data processing module, a display module, a buzzer driver module, and a counter module.A jitter-eliminating module will be used to eliminate the jitters of physical buttons and generate useful keystroke signals.DS18B20 controlling module will realize correct communication between the FPGA chip and DS18B20 for temperature acquisition.The data processing module will realize to switch working modes and adjust the maximum and minimum values of the temperature limits according to keystroke signals, and it will determine whether the temperature measured is abnormal or not.The display module will be used to drive a digital tube to display the temperature values measured, the maximum values, or the minimum values of the current working mode and will drive all indicator lights.The Buzzer driver module will realize to drive the buzzer.The counter module will be used to count the number of clock pulse signals and provide a working clock.
We use Verilog HDL as the FPGA programming language to design the system in the Quartus II integrated environment.Verilog HDL allows the modeling and describes digital systems at multiple levels.It not only simplifies the design task but also increases efficiency.

System synthesis and debugging
After completing the system design, we compiled and synthesized the system in the Quartus II environment.Figure 3 is the RTL-level view of the top module of the system.The system is divided into four functional modules after synthesis (m1, m2, m3, m4 in Figure 3).Module m1 realizes temperature acquisition.Module m2 not only realizes the elimination of jitters of physical buttons and receives temperature data but also generates alarm data and display data.Module m3 realizes the buzzer setting according to the alarm data received.Module m4 realizes digital data display according to the display data received.Inputting and outputting pins are used for pin constraints (dotted box in Figure 3).Under cooperating with the hardware system, the program debugging diagram of the top module is shown in Figure 4.When the measured temperature of the system working in Mode 1 (led was 1, 000 b) in Figure 4 (a) was at 25.312℃ (within the normal limit of Mode 1: 10.0 ~ 81.0℃), the system did not alarm (beep was 0, led_warn vdd was 000 b) in Figure 4 (a).We adjusted the maximum of limits from 81℃ (led was 1, 000 b) in Figure 4 (b) to 80℃ (led became 1, 001 b) in Figure 4 (c) by pressing the switching button (Key 3 went from 1 to 0) in Figure 4 (b), and the system did not alarm as well in Figure 4 (c).Then we switched to Mode 2 (Key 2 went from 1 to 0 and led to 0100 b) in Figure 4 (d).When the measured temperature of the system working in Mode 2 (-5.0 ~ 8.0℃) was at 25.5℃ (abnormal for Mode 2), the system started to alarm (beep became 1 and led_warn_vdd became 010 b) in Figure 4 (d).The predetermined target functions have been realized based on the real-time temperature monitoring and alarm system.

Performances of the real-time temperature monitoring and alarm system
The performances of the real-time temperature monitoring and alarm system were investigated.The system working in Mode 1 was verified in an adjustable temperature ranging from 29.5℃ to 30.5℃.The results show that the maximum error between the temperature measurement values and the preset temperature values did not exceed 0.55℃ (Figure 5   The real-time temperature monitoring and alarm system offers a simple and effective approach to measure and control storage temperature, which is a prerequisite for ensuring high-quality biological samples.As proof of concept, saliva and RNA were used as biological samples to investigate the adaptability of the real-time temperature monitoring and alarm system in Mode 1 and Mode 3 (Figure 6).As shown in Figure 6 (a), when the storage temperature of the saliva sample was at 4.187℃ (within 2 ~ 8℃, we inset 1 in Figure 6 (a)), the system did not alarm.When the storage temperature of the saliva sample was at 10.125℃ (outside 2 ~ 8℃, we inset 2 in Figure 6 (a)) or 1.375℃ (outside 2 ~ 8℃, we inset 3 in Figure 6 (a)), the Warn 1_led was lit (we inset 2 and 3 in Figure 6 (a)), the buzzer sounded, and the system in Mode 1 started to alarm.Then, the system in Mode l stopped alarming when the minimum was adjusted to 1℃ (we inset 4 in Figure 6 (a)).It demonstrates that the temperature alarm function and the adjustment of temperature limits are correct.
Additionally, we used the system to monitor the storage temperature of RNA after switching to Mode 3. As shown in Figure 6

Conclusion
In conclusion, we have developed a real-time temperature monitoring and alarm system for biological sample storage based on DS18B20 and FPGA chips.The system is simple, low-cost, and multi-mode.Synthesis and debugging verify the correctness of the system design.Meanwhile, we confirm the accuracy and stability of the temperature measurement of the system.The system realizes the storage temperature monitoring of the saliva and RNA samples and alarming.The real-time temperature monitoring and alarm system provides an effective approach to monitoring and controlling the storage temperature of biological samples.This system design has the potential to ensure the high quality of biological samples and the accuracy and sensitivity of biosensing and analysis.This design will have a significant application promise in the field of temperature monitoring and related research areas.

Figure 1 .
Figure 1.The hardware structure of the system and indicator light information in Mode 1.

Figure 2 .
Figure 2. The software architecture of the system.
50 MHz work clock and button signals are input to the system by inputting pins.Data in the process of communication between DS18B20 and FPGA chip, signals of ground, signals of power supply, signals of all indicator lights, and display data are output by outputting pins.

Figure 3 .
Figure 3. RTL view of the top module.Under cooperating with the hardware system, the program debugging diagram of the top module is shown in Figure4.When the measured temperature of the system working in Mode 1 (led was 1, 000 b) in Figure4(a) was at 25.312℃ (within the normal limit of Mode 1: 10.0 ~ 81.0℃), the system did not alarm (beep was 0, led_warn vdd was 000 b) in Figure4 (a).We adjusted the maximum of limits from 81℃ (led was 1, 000 b) in Figure4(b) to 80℃ (led became 1, 001 b) in Figure4(c) by pressing the switching button (Key 3 went from 1 to 0) in Figure4(b), and the system did not alarm as well in Figure4 (c).Then we switched to Mode 2 (Key 2 went from 1 to 0 and led to 0100 b) in Figure4 (d).When the measured temperature of the system working in Mode 2 (-5.0 ~ 8.0℃) was at 25.5℃ (abnormal for Mode 2), the system started to alarm (beep became 1 and led_warn_vdd became 010 b) in Figure4 (d).The predetermined target functions have been realized based on the real-time temperature monitoring and alarm system.
(a)), and the maximum fluctuation range of multiple sets of temperature data did not exceed 0.3℃ (Figure 5 (b)) at the same preset temperature.It demonstrates the accuracy and stability of temperature measurement by real-time temperature monitoring and alarm systems, respectively.

Figure 5 .
Figure 5.The accuracy and stability of system temperature measurement.The real-time temperature monitoring and alarm system offers a simple and effective approach to measure and control storage temperature, which is a prerequisite for ensuring high-quality biological samples.As proof of concept, saliva and RNA were used as biological samples to investigate the adaptability of the real-time temperature monitoring and alarm system in Mode 1 and Mode 3 (Figure6).As shown in Figure6(a), when the storage temperature of the saliva sample was at 4.187℃ (within 2 ~ 8℃, we inset 1 in Figure6(a)), the system did not alarm.When the storage temperature of the saliva sample was at 10.125℃ (outside 2 ~ 8℃, we inset 2 in Figure6(a)) or 1.375℃ (outside 2 ~ 8℃, we inset 3 in Figure6(a)), the Warn 1_led was lit (we inset 2 and 3 in Figure6(a)), the buzzer sounded, and the system in Mode 1 started to alarm.Then, the system in Mode l stopped alarming when the minimum was adjusted to 1℃ (we inset 4 in Figure6 (a)).It demonstrates that the temperature alarm function and the adjustment of temperature limits are correct.Additionally, we used the system to monitor the storage temperature of RNA after switching to Mode 3. As shown in Figure6(b), when the storage temperature of the RNA sample was at -22.624℃ (within -25 ~ -20℃, we inset 5 in Figure 6 (b)), the system did not alarm.When the storage temperature of the saliva sample was at -18.25℃ (outside -25 ~ -20℃, we inset 6 in Figure 6 (b)) or -27.75℃ (outside -25 ~ -20℃, we inset 7 in Figure 6 (b)), the Warn 3_led was lit (we inset 6 and 7 in Figure 6 (b)), the buzzer sounded, and the system in Mode 3 started to alarm.All functions worked correctly, showing excellent adaptability to the real-time temperature monitoring and alarm system.
Figure 5.The accuracy and stability of system temperature measurement.The real-time temperature monitoring and alarm system offers a simple and effective approach to measure and control storage temperature, which is a prerequisite for ensuring high-quality biological samples.As proof of concept, saliva and RNA were used as biological samples to investigate the adaptability of the real-time temperature monitoring and alarm system in Mode 1 and Mode 3 (Figure6).As shown in Figure6(a), when the storage temperature of the saliva sample was at 4.187℃ (within 2 ~ 8℃, we inset 1 in Figure6(a)), the system did not alarm.When the storage temperature of the saliva sample was at 10.125℃ (outside 2 ~ 8℃, we inset 2 in Figure6(a)) or 1.375℃ (outside 2 ~ 8℃, we inset 3 in Figure6(a)), the Warn 1_led was lit (we inset 2 and 3 in Figure6(a)), the buzzer sounded, and the system in Mode 1 started to alarm.Then, the system in Mode l stopped alarming when the minimum was adjusted to 1℃ (we inset 4 in Figure6 (a)).It demonstrates that the temperature alarm function and the adjustment of temperature limits are correct.Additionally, we used the system to monitor the storage temperature of RNA after switching to Mode 3. As shown in Figure6(b), when the storage temperature of the RNA sample was at -22.624℃ (within -25 ~ -20℃, we inset 5 in Figure 6 (b)), the system did not alarm.When the storage temperature of the saliva sample was at -18.25℃ (outside -25 ~ -20℃, we inset 6 in Figure 6 (b)) or -27.75℃ (outside -25 ~ -20℃, we inset 7 in Figure 6 (b)), the Warn 3_led was lit (we inset 6 and 7 in Figure 6 (b)), the buzzer sounded, and the system in Mode 3 started to alarm.All functions worked correctly, showing excellent adaptability to the real-time temperature monitoring and alarm system.

Figure 6 .
Figure 6.Saliva and RNA storage in mode 1 and mode 3.