1. Introduction
Parcel services often face problems when sent packages are damaged or delivered to the wrong address. During transportation, the shipment can be repeatedly reloaded from one vehicle to another and to various logistics centers. During this process, there is a high probability that the shipment may be physically or mechanically damaged at some part of the shipping route [
1,
2,
3]. This can happen during reloading due to the carelessness of service personnel or the failure of reloading conveyors or robotic systems. Also, the parcels can be damaged during transportation when there are high vibrations due to external factors such as the quality of the roads or turbulence (if the parcels are transported by air). Certain mechanical damages may also occur during the shipping of parcels by sea, as storms, large waves, and other factors are possible during the journey [
4,
5,
6,
7]. Such violations of shipments and their contents can cause huge losses for individuals, e.g., for remote buyers. Huge losses can also be received by companies that remotely purchase various expensive technologically complex industrial equipment, for example, sensitive machines, computer equipment, medical devices, etc. The sooner the manufacturer, carrier, or customer learns that the transported item may have been damaged during transportation, the sooner they will be able to take steps to reduce unnecessary costs [
1,
8,
9,
10,
11]. In order to ensure that the parcel reached the recipient it was sent to, especially for more valuable parcels (e.g., a laboratory bench), shock indicators are used (in English it can be called a shock detector, shock indicator, or impact monitor). The impact indicators, as a binary system using only 0 and 1, indicate whether the impact threshold has been exceeded or not. A measuring device similar to them is a shock recorder that measures force magnitude over time. This is more often used when the combination of force and duration of impact is not known, which may be dangerous, because, for example, a short 1 ms 300 g hit causes little damage and is generally not interesting, but a 20 ms 300 g hit could already be critical. Shocks are vector quantities whose direction is relevant to the object being acted upon, so shock detectors can also be very sensitive to the direction of the input shock. “ShockWatch 2” impact indicators are disposable binary system devices that determine whether sensitive products have been dropped during transportation or storage [
1,
2,
12,
13,
14,
15]. These indicators are field-activated tamper-proof devices that turn bright red when a hit occurs above a certain threshold. Each one has a unique identifier to help with traceability. The ShockWatch RFID works in the same way as the ShockWatch 2, only with additional RFID functionality. Therefore, every time a package or item is scanned remotely using an RFID reader, its status is automatically entered into the Enterprise Resource Planning (ERP) software or warehouse management system. This impact indicator no longer needs to be checked by a human, as it is automatically registered in the relevant system. “ShockDot” are tamper-proof mechanically activated indicators [
3,
4,
16,
17,
18]. They turn completely or partially red when a potentially damaging impact occurs. Each indicator has a QR code that allows the user to verify the authenticity of the indicator and assure the user that the device has not been changed during transportation [
19,
20,
21]. For the ShockDot indicator, it is important to choose the mounting position responsibly because it does not react to shocks perpendicular to its own plane, although its sensitivity is not affected by the axial orientation in its own plane. The ShockWatch MAG 2000 shock indicator is a resettable and reusable device for monitoring fragile goods and cargo containers over 200 kg. The device is also widely used in railway and truck fleets to monitor the presence of excessive shocks when pushing or coupling wagons and trailers [
1,
3,
22,
23,
24,
25]. It uses two aligned and highly sensitive magnets. When an intolerable impact is experienced, the magnets are pushed out in sequence, clearly indicating the angle and strength of the impact. A unique design key is provided to unlock the device cover. This key allows the user to reset the product after activation and is tamper resistant. The Trans-Monitor TD is an effective impact indicator with a visual display that shows the date and time of impact [
1,
3,
4,
26,
27,
28]. It consists of two pairs of spring steel balls that complete the circuit of the date and time in the digital clock. The springs are selected to withstand forces up to a certain “g” value. If a higher g-force impact occurs, the steel balls are displaced from their set positions and remain displaced. The clock stops to record the date and time the impact occurred in the transport chain. A comparison of the most popular shock indicators is presented in
Table 1. The detectors presented in this Table (including the shock detector considered in this study) are powered by lithium batteries that last for about 4 years. The variation of the shock detector’s power consumption is a very dynamic process that depends on the conditions of shipment. When not exposed to external influences, the detector is in sleep mode and can consume a current of several microamps.
The greatest benefit of impact indicators is that they warn of a potentially damaged package and, similar to security cameras, encourage more caution during transportation, since, in many cases, they are installed both externally and internally. The reviewed indicators have a model with the smallest range being 0.5–20 g and the largest range being from 5 to 300 g. Most impact indicators have limited capabilities [
1,
29,
30].
As mentioned earlier, when a shipment is traveling, it can become lost on the way or be damaged due to negligence or other reasons [
1,
2,
3,
4]. In addition, most impact indicators described above have limited performance (such as limited battery life, underestimation of impact strength, etc.). A smart impact recorder/detector with a potential deployment system to monitor the shipment path and status can help solve these problems. The system is designed in such a way that it performs its function with as little human intervention as possible, using wireless communication technologies in order to avoid possible errors and not burden the employees with additional work. In addition, there is a very limited amount of information about such systems in the scientific literature, which ensures the novelty of this study. The shock detector developed in this work with advanced capabilities can not only show the direction of the shock, but also operate in the range of at least 5–100 g with an accuracy of ±15% under an ambient temperature of −25–60 °C. In addition, it can show the user the route of the package, mark the place where the package was damaged on the map, and maintain a constant connection with the data transmission network.
These research results open up new opportunities in the field of tracking shipments, introducing innovative tools that help better control and protect shipments in transit. Compared to other manufacturers, this shock detector is distinguished by its ability to monitor shocks in real time and provide accurate information about the location of the package using advanced accelerometer technology and microcontrollers. Other manufacturers often offer either simple impact sensors without tracking features or more expensive devices that do not have this level of detail and real-time data transmission. This ensures the novelty and practical applicability of this research.
The research includes the following steps: impact detector design (PCB tracing, programming code writing, and operation algorithm design), prototype production and testing, etc.
The aim of this research is to develop and investigate a smart impact detector with integrated wireless technologies for monitoring a shipment’s path and condition in real time.
2. Materials and Methods
A conceptual diagram of the structure under development consists of a shock recorder that records and stores shock force information and local servers that receive and transmit this information to a central server. A central server collects data on shipments, including cases of impact force exceedances, and allows users to monitor the status and route of shipments via a mobile app. The entire system includes warehouses that know their geographic location and name, and user devices that provide access to information stored on a central server.
The intelligent impact detection detector was created using the production of the Espressif ESP32 line. These products are characterized by the fact that there is not only a main processor, but other additional devices, such as I/O, cryptographic, or Wi-Fi peripherals, etc., may already be integrated. ESP32-S3 was chosen to implement the smart shock detector. This was decided because it is up-to-date and has various acceleration devices that enable efficient encryption operations, such as those required for encrypted HTTP (HTTPS—Hypertext Transfer Protocol Secure) communication. It also has specially dedicated logic circuits for SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit), and SD/MMC (Secure Digital/MultiMediaCard) protocols for communication with devices. It also has an XTensa LX7 dual-core CPU that can run up to 240 MHz, although one (ESP32-S2) would probably be enough. Also, it has an additional ultra-low-cost RISC-V core that can be programmed in C++ and execute RV32IMC instructions, including input monitoring. When the controller is in sleep mode, it uses only 240 μA, compared to the typical 13 mA to 108 mA, depending on the processor frequency and the additional devices used. Using a Wi-Fi device may require 285–355 mA for sending data and 97 mA for listening, depending on the communication version used and signal strength. After comparing the energy consumption with other models, the ESP32-S3 was chosen as the most optimal variant for the prototype of the developed system. When designing a smart shock detection detector, we aimed for it to have the following features: the recorder can capture and save impact force information; record the impact force in a time interval; transmit information wirelessly; have a screen that displays the tracking number of the shipment and its barcode, and if the impact force is exceeded, the background can turn red; the system has a database that stores the name of the warehouse, the shipment number, and whether the specified impact force was exceeded; and the system has a mobile application in which it is possible to view the information stored in the database in the form of a table and a map. The concept of the designed and studied system is presented in
Figure 1.
The impact recorder is designed with a microcontroller that integrates real-time and Wi-Fi devices, as well as an electronic ink screen, a memory card, and inertial sensors. The mobile application with servers is designed as follows: Warehouse server—stands in each warehouse and knows its geographical position and name. A central server can consist of several computers, depending on the amount of data and requirements for system reliability. User device—a mobile phone with access to a central server to track the shipments recorded in the warehouse or the path of one shipment. General requirements for the execution of the process: In the shock recorder, the inertial sensor constantly measures the acceleration and transmits it to the microcontroller, which records it on the memory card with the time and date, and if the permissible limit has been exceeded, it also changes the background of the screen to red. Normally, the screen displays the recipient’s information and tracking number. The microcontroller scans for wireless stations at regular intervals, and when it detects a wireless connection in the warehouse, it transmits its tracking number to the local server along with information about whether the allowable impact limit has been exceeded. The local server fills in the data on the time of receipt, the name of the warehouse, and its coordinates, and transmits it to the central server. With the mobile application, the user can, at any time, check the information available on the central server about the shipment of interest. To ensure the reliability of the measurement results, it is mandatory to use the manufacturer’s components (e.g., accelerometers) that have been metrologically checked. In addition, it is very important that the shock detector inside the package is securely fixed (e.g., to the inner wall of the package). It is important that, in the event of an impact, the detector does not detach from the mounting location (it does not lose its adhesion to the mounting location).
3. Results and Discussion
The impact recorder consists of a microcontroller “ESPRESSIF ESP32-S3-MINI-1U-N8”—U1, with real-time and Wi-fi devices, operating at temperatures ranging from −40 to 85 °C. Additional components and connections are selected for it based on the documentation and the ESP32-S3-DevKitC-1 v1.1 (ESPRESSIF, Shanghai, China) wiring diagram. The process of designing the electrical diagram of the controller is also part of scientific results and research. A power plant diagram of the controller is presented in
Figure 2. A PI-filter (FB1; C1; C2) with a ferrite bead and three capacitors (C3, C4, and C5) for voltage equalization (removal of alternating frequencies from the power line) near the controller are used to suppress noise from the power supply. The “PROG” connector is used to program the controller. Power supply: Texas Instruments TPS63070RNMR voltage converter, accepting input voltages from 2.0 V to 16 V, operating from −40 °C to 150 °C, two-pin connector for battery “DIP-XH-2.54-2P”, and USB-C connector for power “TYPE-C-31-M-12” (only the battery or the USB-C connector can be used at the same time). Batteries and USB-C lines are protected against discharges using specialized 0402ESDA-18N (operates from −25 °C to +85 °C) components adapted to a maximum voltage of 18 V. The USB-C connector is protected against reverse voltage using a 1N5819WS (−55 °C to +125 °C) shunt diode. No reverse voltage protection was applied to the battery terminal due to energy loss, because the user will not be able to connect the battery and USB-C power at the same time, since the USB-C will not be accessible from the outside and it will only be possible to connect to it after first disconnecting the battery and removing it from the body. The PI-filter is adapted to protect against both external and internal noise [
1].
Impact and orientation sensors: Three-axis inertial modules Analog Devices ADXL375BCCZ-RL7 (U3) (Analog Devices Inc., Wilmington, MA, USA) and ROHM Semicon KXTJ3-1057 (U4) (ROHM, Santa Clara, CA, USA). The electrical diagram of the shock sensor connection is shown in
Figure 3. U3—adapted for acceleration measurements up to 200 g, performing measurements at a frequency of 3200 Hz, error not greater than ±2.5%, and operating from −40 to 85 °C. However, the acceleration limit for waking up the microcontroller can only be determined by multiplying 0.78 g by an integer, so it is not suitable for determining the orientation of the recorder. The U4 measuring up to 16 g with a limit of 3.9 mg precision operating from −40 to +85 °C was chosen for this. The U3 is connected to the controller via an SPI (Serial Peripheral Interface), and the U4 is connected via an I2C (Inter-Integrated Circuit) protocol. Long-term data storage—microSD memory card holder “XUNPU TF-115K”. A bracket rather than a soldered memory was chosen because of the ability to change the size of the memory. As required by the SD card standard and the ESP32-S3 documentation, when connected via the SDMMC protocol, 10 kΩ resistors were used on the zero data and command lines and are not required for the clock signal. The other data lines are left unconnected, with test contacts only. This is carried out to reduce power consumption, since with the microcontroller in use, according to its documentation, there is no noticeable difference in the effective data transfer rate between one and four data lines in use. The connected lines are protected against discharges using four LXES15AAA1-153 (−25 to +85 °C) components. Two capacitors are used for voltage equalization.
The components are laid out on the PCB board/scheme in accordance with the following rules (taking into account that the functionality and reliability of the detector being developed will be achieved as much as possible): holes for fastening with M3-size screws are placed in the corners; a screen connector is placed near the edge in the middle; a USB-C, battery connector, and microSD slot are placed near the edge; the main inertial sensor is placed as close as possible to the mounting hole; a noisy power supply is placed as far away as possible from the other components (especially from the inertial sensor); and all of the components are laid out on one side of the board. The PCB is presented in
Figure 4. It is designed for a 1.6 mm thick FR-4 board with a 4.5 dielectric constant and 35 µm thick copper layers. The width of the plate is 65 mm and the length is 40 mm. Fixing holes are Ø 3.8 mm with Ø 7 mm unoccupied zone, and their centers are spaced 57 mm × 32 mm apart. The production capabilities of JLCPCB were taken into account during the design. The programming contacts were designed to connect to standard layout tracks (2.54 mm centers). Traces and windings were derived based on the manufacturer’s capabilities, the component, and communication protocol standards. Partial optimizations of the PCB board were carried out; the track length was kept as small as possible so that impedance mismatches did not affect the speeds used for data transmission. The fastest signal used by USB Full Speed has a rise time of 4 ns, so by using a 10% limit on the distance the signal edge travels, the tracks should be no longer than 60.96 mm.
Since the width of the board was only 65 mm, the maximum length from which we needed to start taking care of the impedance of the lines was not really a problem.
Since this is a shock recorder, there are also some specific requirements for the overall system body (the design of the body development is also part of this study), as follows: impact resistant—it should be able to withstand a fall from a height of at least 1 m with all the necessary components attached; as small as possible—should occupy as little space as possible in the package of the shipment; not influence the measurement results—should be sufficiently rigid, and the components should have their own fixing points. The PCB board and battery holder must be easily removable and re-insertable; convenient serviceability—we used a printed circuit board and battery holder with batteries; the results are visible from the outside—such a fastening method must be provided so that the screen is visible from the outside of the package; adapted for 3D printing—3D printing errors and technological capabilities must be evaluated so that the printed parts can be assembled with other components so that printing does not require the formation of additional supporting structures and their subsequent removal/processing. A 3D printer using FDM (Fused Deposition Modeling) technology with PLA (polylactic acid) plastic was used for printing. The general view of the impact recorder body is presented in
Figure 5.
Press-in threaded inserts were used to avoid mounting screws that could loosen when screwed directly into the plastic. They not only provide additional strength, but are also user-friendly in that they allow the user to do without nuts and an additional wrench. Stiffness ribs are designed in the front part of the body to provide additional strength. The bumps on the cover are designed in such a way that they not only press the battery holder, but also prevent the switch from changing its set position due to impact, i.e., shut off from a sufficiently large shock in the direction of the switch’s sliding [
1,
2,
3,
4,
5].
The algorithm of the main microcontroller program is presented in
Figure 6. The algorithm consists of the following sequence of main actions: tracking information is displayed on the screen; configurable inertial sensor—parameters are transmitted via the SPI protocol to generate a signal via the INT1 output when the sensor detects an impact force exceeding the set limit of 5 g; a 30 min timer is set—the controller is prepared so that after falling asleep, it wakes up after 30 min; wake-up due to a shock is configured—the controller is prepared so that, in sleep mode, it waits for a signal from the INT1 sensor; and the main processor is put to sleep. The main processor of the controller is put to sleep, waiting for the following signals prepared by the auxiliary processor from the impact sensor and timer: Is the device on? Is the controller still receiving power? Did the device wake up from sleep? Waiting for the controller to wake up, the signal is as follows: Woke up to a shock? Information is obtained on the reason for the wake-up of the controller and whether it was due to the input INT1 logic unit. Information stored in the inertial sensor is read—information is read from the z, y, z registers 32 times, thus collecting all of the information stored in the FIFO buffer. The information is saved on the memory card and on the screen, and then it is added to the csv (comma-separated values) file (created if it does not exist). In total, this results in 34 lines: one each for axis names and 32 lines for the measurement results. If the impact exceeds the limit of 20 g, the screen of the background changes to red. It scans for available access points and connects if found, and the information about the shipment number is passed to the warehouse server.
A portion of the main microcontroller program code is shown in
Figure 7. At first, the program records the time and counts how long it slept. This is needed in cases where the controller wakes up without a timer, so that it can only be restarted for the remaining time, such as another 20 min. Next, every time it turns on or wake up, the processor needs to reconfigure the SPI device for communication with the inertial sensor. After receiving the reason for waking up, if due to shock, the function “shock_information_output” is launched, which reads the inertial sensor and writes the data to the memory card, and if the shock force exceeds the limit of 20 g, it changes the background of the screen from white to red, tries to connect to the Wi-Fi access point, and sends information to the server. If it wakes up due to the timer, it tries to connect to the Wi-Fi access point and send information to the server. If it is not a wake-up, but instead the program is launched for the first time after switching on, the inertial sensor is configured and the shipment number with a barcode (Code-128) is displayed on the screen. This is stored as an image in an array of eight pixels. In the array, the pixels of the image (one bit each) are arranged in order as intended on the screen, from right to left and from the eighth pixel up. The code prepares immutable HTTP “POST” requests to transmit information to the warehouse server. When compiling a program, the compiler inserts three constants that specify the path to the query. This is carried out so that the control does not have to perform operations with the text.
The impact detector in warehouses connects to local servers with a static IP address through wireless routers (here, a wireless access point, a switch, and a router on one device). The local servers, after receiving the logger’s tracking number and determining whether the hit limit has already been exceeded, attach the warehouse address and transmit it to the central servers. Users will be able to connect to one of the central servers with a mobile application via the Internet. In this way, the system could work in the presence of several warehouses, but during the development and testing of the system prototype, it was tested with one warehouse whose local server acted as a central one (
Figure 8). The local network configuration of the warehouse is the same in all sectors.
The shock detector has the ability to transmit information to the control application screen, which displays the path of the shipment in which the shock recorder is installed. The general view of the shipment tracking path is shown in
Figure 9.
The shipment tracking technology using the shock logger is built using the Xamarin platform and is connected to the “tracking” database using the previously mentioned procedures. The warehouse information obtained from it is displayed on a map. By clicking on the warehouse on the map or by entering its name in the search, it is possible to receive information about scanned shipments in real time (every ~5 s). After entering the shipment number in the search, its path is displayed on a map or in the form of a table (at the user’s choice). It is also updated every ~5 s.
An accelerometer (the maximum possible number of measurements is about 200 times during the impact) was used as a device to measure impact, which detects acceleration in the following three directions: X, Y, and Z axes. It is often used in shock recorders to measure shocks and vibrations during transport. An accelerometer works on the principle that an internal mass element moves in response to an external acceleration. This movement causes an electrical signal that the device registers and interprets as acceleration. Measurements of impact crushing are presented in
Figure 10. To ensure measurement accuracy, only certified components were used to make the impact detector. The manufacturer declares that shock-sensing components (such as the accelerometer) have been metrologically tested (before sale).
The results of the measurements were obtained for the shipment model, in which the impact recorder was installed, falling from a height of 10 cm. The weight of the package was 1.8 kg. During a shock, the detector always records 32 shock values (this can be changed as needed). As the results show, the impact values in the X, Y, and Z directions vary from −0.5 to 2 g in the measurement quantity range from 5 to 32. However, at the measurement quantity range of 15 to 20, we can see that the impact detector recorded 3 to 5 g of impact in the Y direction strength. This fact can be explained by the fact that when falling, the ship simultaneously spins and turns when hit. Therefore, it is likely that such an increase in the impact strength was recorded due to the fact that, at that time, the shipment model experienced the strongest impact at the point where the impact recorder was attached. As we can see, some of the impact values have negative values. It depends on the direction in which the parcel is moving and in which direction the impact is recorded. Accordingly, measurements with a negative or positive value are recorded by the accelerometer in the impact detector. These data help to determine whether the shipment has experienced potentially damaging shocks, thereby ensuring the protection of goods during transit. In addition, modern accelerometers often have data storage and transmission functions that allow for the real-time monitoring of transportation conditions.
The impact vector is usually measured by accelerometers and impact detectors. These devices measure acceleration, which can be used to determine the impact vector. The total impact vector describes the acceleration caused by the impact in the following three directions: the X, Y, and Z axes. Using the X, Y, and Z values, the total size of the stroke vector is calculated. Each of these directions registers a separate change in corresponding acceleration, respectively. The mathematical expression of the total shock vector is: .
The values of the total impact vector are given in
Figure 11.
As can be seen from the results, the values of the total impact vector range from 0.5 to 4.5 g when the range of measurements is 32 measurements under the impact of the shipment model. The highest values of the total impact vector are at the beginning of the impact and reach about 4.5 g, and around the middle of the measurements, when the values vary between 2 and 4.5 g. Impact vector values can change because the parcel model flips and rotates in different directions when falling, even when it hits the floor or another obstacle, for example. The highest values of the impact vector are obtained where the shipment experiences the greatest impact. The magnitude of the impact vector depends on several factors, including the force, direction, and duration of the impact, as well as the mass and stiffness of the object. The force with which the impact affects the object and the direction of the force directly affects each component of acceleration (in the X, Y, and Z directions). The duration of the stroke also plays a role, as longer strokes can result in greater overall acceleration. In addition, the mass of the object and the stiffness of the material determine how it reacts to impact; heavier and stiffer objects generally experience smaller changes in acceleration than lighter and softer ones. All of these factors together influence the total magnitude of the shock vector, which is calculated as the sum of the individual components (X, Y, and Z).
The impact detector, which registers impact data, the location of the shipment on the map, and provides data in real time, is extremely useful as it ensures the continuous monitoring of the shipment and allows for a quick response to possible violations. It provides detailed information on the strength and direction of the impact, so it is possible to deter-mine exactly when and where the shipment was hit and assess the potential damage. If the detector has integrated tracking of position coordinates, it allows for tracking the location of the shipment at any time, and real-time data transmission ensures that all necessary information is immediately available [
1,
2,
3,
4]. This helps to solve problems promptly, improve logistics processes, and ensure greater protection of shipments and higher customer satisfaction.