The agrifood chain is facing significant new challenges nowadays. Among others, monitoring and controlling temperature along supply chains emerges as a key aspect to deal with food waste [1
], as well as increasing both food safety and the quality offered to consumers [4
Whereas, the early stages of processing and distribution compliance with the temperatures established for food safety was reached [6
], however, in the last three stages (considering here transport, retail, and households), temperature control and maintenance have become particularly complex [4
]. In the retail sector in particular, the scarcity of data available on the fulfilment of cold chain control is highlighted [9
]. In addition, there are many studies confirming that the temperature of display cabinets in refrigeration units is not always the appropriate one, according to safety standards [11
In Europe, there is a regulation by the European Council and Parliament assigning food companies the responsibility for complying with temperature control requirements and microbiological criteria applicable to food products, as well as cold chain maintenance [15
]. Concerning this last aspect, the regulation establishes the importance of controlling temperatures and proper operation of refrigeration equipment, considering that daily temperature reading is a valid method to control the cold chain in retail establishments. However, there are studies proving that this method cannot guarantee compliance with the perishable food safety specifications, especially in southern Spain [9
Among the technologies offering temperature control solutions currently available throughout the cold chain, wireless sensor surveillance technologies, especially radio frequency (RF) and wireless sensor networks (WSN), have been regarded as leaders in this field [16
], with many works on its implementation to achieve global food temperature traceability at different points in the chain, becoming part of broader food safety systems [18
]. Nevertheless, far fewer research studies in the retail sector refer to cabinet and refrigeration equipment temperature control. Most of the scientific literature focusing on the retail sector emphasizes the estimation of the shelf life of food located in refrigeration equipment or whether they keep the required temperature levels [14
], yet avoiding a deeper study of the systems used for temperature measurement and monitoring.
In order to provide solutions to solve this challenge, Internet of things (IoT) systems are becoming more relevant, where a wide range of sensors are connected to each other along the cold chain, sending useful information for decision-making and preventing potentially undesirable events [16
]. As a result, the IoT is expected to help retail chains to control the quality of food products, to plan the handling of end-of-life waste, to manage the temperature of freezers, refrigerators and warehouses, and to contribute to the reduction of energy consumption [24
On a commercial level, there are large companies specialised in refrigeration equipment [25
], which offer systems for monitoring temperature, but which have the disadvantage of being expensive and do not offer the possibility of easily accessing the data generated or being integrated into systems that monitor other types of parameters. Other options, based on data recording devices located in each refrigeration unit [27
], offer a cheaper alternative, but without constituting an affordable solution for small and medium-sized companies, for which this term is critical [29
This is the line in which the proposal presented in this work is situated in order to respond to the challenge of monitoring the temperature of refrigeration equipment in the retail sector, by using new trends in technological development, such as free and open-source hardware (FOSH). FOSH is a hardware whose design is made publicly available so that anyone can study, modify, distribute, make, and sell the design or hardware based on that design [30
In view of the above, the aim of this research is to develop a low-cost IoT system, based on free hardware and software, for monitoring the temperature in refrigerated retail cabinets. This system provides solutions in domains such as price management in perishable products, the frequency of temperature measurement in retail establishments, and economic problems caused by food waste [9
]. Another aim is to create a system with enough flexibility to extend the scope of supervising other relevant parameters in the working environment (door opening-closing, consumer presence time in front of the exhibitor, lighting, and energy consumption).
The current work shows a complete functional solution for temperature monitoring in the food cold chain. By proposing it for open access publication and by developing it as open-source software and hardware, it confers an innovative aspect to the set of solutions available in the market. Thus, the full accessibility to all the details about the designed device opens the possibility to communities of scientists and technicians to correct and improve aspects, extend functionalities, replace components, or compare operation modes.
Nowadays, the emergence of freely participating communities in collaborative projects with scientific-technical objectives with free and accessible information is recognized as a revolution of the scientific development paradigm. In this sense, the work presented, developed as the genesis of a collaborative project, is a pioneer in proposing an open solution that is already operational, but which can still be improved by the scientific community. Undoubtedly, these improvements will contribute to the generation of scientific knowledge as well as to the improvement of humankind’s access to food.
The next section discusses the alternatives available in this research field and is followed by the solution design. The paper then focuses on the experimental implementation and solution evaluation. Finally, conclusions and research lines of future work are presented.
2. Related Work and Technical Background
Temperature monitoring within the food distribution sector is supported by different technologies for information transmission, processing and control, measurement, and remote data storage and management.
As far as the information transmission is concerned, the use of wireless systems (WSN) have become widespread in opposition to wired systems that are expensive and not very flexible for scaling [32
To provide support to WSN, communication networks are required. Three network clusters classified by range and transmission speed are identified [34
]: (i) short-range networks, (ii) cellular networks, and (iii) long-range networks (Figure 1
Short-range networks, notably Zigbee or Bluetooth, have no licence to use. Among their features (Table 1
), low power consumption and high exchange speed are the most remarkable. Research works used Zigbee devices to monitor cold rooms and estimate energy consumption and product water loss [36
] or vegetable transportation under real work conditions [37
]. The work using Zigbee devices, analysing battery behaviour as well as data exchange quality for the control of refrigerated products, is also worth mentioning [38
Still in the field of short-range networks, there are numerous applications based on radio frequency identification (RFID) covering areas ranging from shelf life control [39
], through live animal transport control [40
], and environmental variable monitoring such as humidity, temperature, and volatile gases. [41
]. Applications with near-field communication (NFC) are less frequent than those based on RFID, but their compatibility with smartphones and tablets provide an interesting niche market. To this end, an application based on NFC sensors controlling meat product traceability have been developed [42
Furthermore, cellular networks enable a high transmission speed in both short range (Wi-Fi) and long range with license (GSM, GPRS, 3G, 4G, and 5G). There are examples of applications of cellular networks that use GPRS communication in sample shipments from refrigerated trucks to generate shelf-life predictions for transported products [21
]. In another work, the authors employ Wi-Fi and GPRS-compatible architecture, among other networks, to monitor environmental variables of perishable food containers with a very low rate of data loss in communication [20
In the field of long-range networks, low power wide area networks (LPWAN) are being developed, being compatible with the IoT concept for low transfer rates and having lower energy consumption versus cellular networks (2G, 3G, 4G, and 5G) [43
The free hardware philosophy has been used to control and process
data in a wide range of technological applications. These technologies have not been used in the food sector yet, but they are gradually becoming more and more popular due to boards equipped with Bluetooth, Wi-Fi, Ethernet, Lora, LORAWAN, SIGFOX, Android compatibility, and a catalogue of sensors designed to interact and measure any variables. In this scope, ATMEL microcontrollers and those compatible with its development environment (IDE) are relevant [44
]. Its features (free philosophy) together with low cost and size have favoured a gradual incorporation into the food traceability sector [45
], combined with Android devices for meat quality control of beef [46
] or for the foam quality of sparkling wines [47
details the most widely distributed boards integrating this open source philosophy and offering an intelligent node between temperature data reception, management, and cloud interaction as they include modules for wireless communication.
Within the scope of measurements, temperature reading in retail systems is a basic element in any refrigeration system architecture. As a result, a study of the different sensors is required. A variety of temperature sensors can be identified [48
]: Resistive, electronic, and electromechanical. Table 3
shows the characteristics of those most frequently used in industrial refrigeration.
Concerning cold chain management, every technology presented in Table 3
was applied. Both the variety of temperature ranges studied for different products and the importance of controlling temperature have been emphasized [49
]. Research works using silicon sensors to monitor the temperature in warehouses, containers, and vehicles [20
] and for drying control by means of infrared sensors [50
] are remarkable.
Finally, the technological demand for remote data storage and management (monitoring and performance based on IoT and cloud computing) is addressed in three ways in the bibliography [51
]. First of all, specific programming models for given problems are available. This method implies a considerable programming effort since it requires the whole application codification without code reuse or adaptation to standard software. Secondly, there are adjusted commercial solutions in terms of measuring and uploading data to the cloud. Within this scope there are systems like Stellapps, an end-to-end dairy technology solutions company, providing IoT, big data, and monitoring services in the daily fresh produce area [53
] or Innovecs which offers remote cold chain control services monitoring and controlling significant variables [54
]. These solutions are closed to the user which represents a significant drawback. Finally, another approach to these technological challenges is dealing with generic commercial tools (IoT platforms) where the developer is responsible for customising the application to suit the required needs. Figure 2
displays the most representative IoT platforms as well as their market distribution [55
]. Dealing with these IoT platforms, it is worth highlighting a research work that developed an IoT-based route planning system [56
] was based on the IBM platform [57
], and the one that was developed a platform to virtualize food supply chain was based on FIspace [58
], a cloud-based platform for business collaboration [59
3. Design and Implementation of the Proposed Solution
This work deals with the development of a temperature monitoring system based on free hardware and software (see Table 4
), applying the IoT concept. The proposed solution was applied in an establishment of a chain of 75 stores (Andalusia, Spain).
3.1. Architecture of the Solution
With regard to local architecture communication, considering the options detailed in Section 2
and due to the average size of the establishments where the proposed solution will be deployed, LPWAN was excluded because it is long-range. From the remaining options, Wi-Fi (cellular network) was chosen because it offers a higher speed than short-range solutions, its performance range is better suited to the size of an average-store and, essentially, most food establishments are equipped with Wi-Fi. Within the framework of a low-cost solution, it was considered appropriate to take advantage of the existing network for the exchange of information. Moreover, its bandwidth copes with the monitoring system requirements and this choice for device Internet access eliminates the need for a hub/gateway. Figure 3
shows how a general solution would be developed on the basis of Wi-Fi.
Devices equipped with Wi-Fi communication for cloud exchange information were considered for the control and processing of temperature readings. The characteristics and cost of the boards analysed are presented in Table 2
. In this project, the Electrodragon ESP Relay (Figure 4
), based on the ESP-12F module equipped with the ESP8266 microcontroller, was chosen. Its price is the lowest among the boards considered. An essential feature of this board is that it is powered from the AC mains at 230 Vac, since it integrates a 230 Vac/3.3 Vdc power supply. It also has two relays with a switched contact for voltages up to 250 Vac and 10 A. This solution enhances options based on RFID and BLE (Bluetooth Low Energy) communications with battery-powered nodes [17
], which dismiss the Wi-Fi solution allowing greater range by making the system developed incompatible with a stand-alone solution. Although there are other options with a greater number of inputs and outputs, this is enough for the development of the proposed solution. Studies in the literature [23
] show that the number of inputs supported by the central unit is limited. In the proposed solution, the system is decentralized, achieving a system with control based on ESP8266 enabling multiple inputs at a very low cost.
Considering measurement scope, the DS18B20 was selected from among the sensors analysed (Table 3
) due to its accuracy, measurement range, low cost, and communication standard and for its broad use within the food industry literature [60
]. Table 5
shows the most relevant characteristics of this silicon sensor.
The sensor is provided in TO-92 enclosure or sealed stainless steel sheath (Figure 5
). This second option was chosen to allow immersion in water. Each sensor has an identification number engraved on its ROM, composed of 64 bits.
Connections between the electronic board and temperature sensors were established with the communication protocol 1 wire, a master slave type, developed by Dallas Semiconductor. For a maximum distance of 25 m up to 100 slaves (sensors) can be connected to the bus by implementing a 4.7 kΩ pull-up resistance. The bus consists of three wires: Vcc, GND, and DATA. In this way, with a microcontroller it is possible to monitor the temperatures of a large part of the equipment of an establishment. Although, given the cost of the microcontroller, it may be more profitable to increase the number of these as opposed to the extension of the bus wiring to the different measuring points. Figure 6
shows the connection diagram of the sensors.
In cases where a single sensor is connected such as 1-wire bus protocol, it is not necessary to specify the direction of the sensor.
Implementation in the field is simple, placing the temperature probe (DS18B20) next to the one corresponding to the control thermostat in the chilling cabinets. Considering that the probes are wired up to the board and, since the size of the average store is within the working range of the Wi-Fi network, it is not necessary to adopt a methodology for the deployment of sensors that would be mandatory in other types of applications with limited coverage [63
]. The control board (ESP8266) takes the electrical supply from the same source as the cabinet. The board ESP8266 has a very low energy consumption (0.3 W average), so it can be connected to the cabinet power supply without affecting the normal operation of the cabinet and the electrical protections. The solution described avoids the use of batteries, which would imply a higher maintenance cost. Figure 7
shows the probe location in the freezer used for the experimental device. In a commercial solution, protection against intentional damage would be necessary.
Once all components are connected, programming can be implemented. There are libraries facilitating the use of this sensor on boards supporting the Arduino IDE for programming. In our proposal DallasTemperature.h and OneWire.h, and the ESP8266Wifi.h libraries were utilised [44
Finally, the solution requires the choice of a system for remote data storage and management. As highlighted in Section 2
, alternatives based on specific programmed models and closed commercial solutions had many drawbacks. In the present case, a solution based on an IoT platform was chosen by customizing our specific application. Concretely, the educational version of the ThingSpeak platform was used [64
], which provides up to four channels with eight fields each, thus 32 variables can be updated at intervals of 15 s per channel. It supports up to three million data per year in this type of non-commercial account. The possibility of inserting the information in different ways is contemplated: HTTP, MQTT, and API-REST. In this project we opted for HTTP, using the ThingSpeak.h library for the Arduino IDE. The use of this library simplifies the writing procedure in the ThingSpeak channels (Figure 8
The platform stores the information transmitted according to the structure described. Additionally, this platform provides some mathematical analysis tools based on MATLAB highlighting statistics and machine learning toolbox, deep learning toolbox, and predictive maintenance toolbox.
Communication between each ESP8266 board and the ThingSpeak platform was made via the WLAN of the establishment which was developed ex professo for this application. WPA2 Personal [65
] has been selected as the security mechanism considering data sensitiveness. Figure 9
shows the implemented code in Arduino IDE for alarm generation. Alarm management is performed from each device, sending an e-mail to one or more addresses, identifying the establishment and the refrigerator where the incident occurred.
The operating logic at the level of alarm generation is based on the definition of an admissible temperature range and an offset time. This avoids the generation of false alarms caused by the defrost cycles of the condensing batteries.
3.2. System Scaling
The proposed solution allows for easy scalability at both individual store and store chain level, either in chilling (temperatures about 0 °C) or freezing (temperatures under −18 °C) [66
When applying the system to a whole store chain, the need arises to carry out the initial configuration of the boards and possible changes in remote mode. For this purpose, a LAMP (Linux + Apache + MySQL + PHP) server has been developed, hosted on a Raspberry Pi computer.
Each device connects daily to the DataBase and updates the values of: Supermarket, number of sensors, sensor ID, device status, maximum temperature per sensor, minimum temperature per sensor, time out of range for alarm generation, addresses to which alarm email is sent, ThingSpeak channel ID, write API key (WAP) of the ThingSpeak channel, read ThingSpeak channel API key (RAK), and ThingSpeak channel field.
The database consists of five components (Figure 10
): (i) proto_db spmarket
refers to the name and number id of a supermarket; (ii) proto_db users
registers the email address of maintenance managers with an identifying number (each email address is associated with a store); (iii) proto_db channels
records the ThingSpeak channels to which each board must send temperatures; and (iv) proto_db devices
collects data from the boards, its identifying numbers and operating status (error code: 0 if operating correctly). In addition, each device is associated with a channel and a store; (v) proto_db sensors
collects the sensor data (identifier, maximum and minimum temperature, model, and operating status) associated with a device.
The standard version of ThingSpeak, which provides up to 250 channels of eight fields, that is up to 2000 variables that can be updated every second, is suitable for the deployment of the project in all the establishments of the chain. The maximum number of data per year is 33,000,000.
This work proposes the integration of several open-source hardware and software systems applied to the control of retail cold chain maintenance. Cost-effectiveness and reliability results confirm a very competitive IoT solution within the market. This competitiveness increases even more when considering the system as an open programming system, so that the architecture of the solution can be used to monitor and produce alarms in other relevant variables (door opening-closing, consumer presence time in front of the exhibitor, lighting, and energy consumption).
The operation and applicability of the solution has been evidenced by the evaluation performed on 3.4 million data obtained over twenty months. The proposed solution improves cold chain management control and monitoring in the retail sector, leading to better-quality standards traceability. As a result, this system simplifies the control tasks of inspectors or auditors (reports are automatically generated instead of using thermographs and dataloggers). Furthermore, this affordable solution enables an improvement in the corporate image for food retail companies which shows transparency in the way they control temperature and assure food safety, one of the major problems facing humanity.
The solution was installed in one establishment; however, expansion to the full network of establishments (75) is already in progress so the outstanding benefits will be extended to more stores.
In future works, the deployment of this solution over a prolonged period of time will provide a large volume of data leading to new approaches to data management (big data, trend analysis, adaptive models, neural networks, and deep learning) aimed at predictive maintenance, equipment comparison, and price management. A specific interface might also be designed to overcome the limitation that the generic one of Thingspeak could present for an efficient management of multiple establishments.