Package Handling Monitoring | MindPlus Coding Kit for Arduino Started Tutorial E18
AshG Oct 19.2021

Chapter 8 Have fun with IoT

After learning to use WiFi IoT to upload local data to the IoT, we can try some projects. In this chapter, we will use the IoT to solve some pesky problems in our life, such as checking whether the delivery package has been carefully handled, and automatically control the laundry rack to take back clothes when it rains, and when the baby cries, alert parents automatically.



Project 1 Package Handling Monitoring

In the last few years, e-commerce has developed rapidly. And more and more people are shopping online. Occasionally, we receive damaged packages. What if it contains valuables insides?

Can we make a package handling sampling tester to check how many times the package is carelessly handled, and see how much damage it receives during the transportation?

Task Navigation 

1. Learn how digital shake sensors work.

2. Test package delivery handling using digital shake sensor.



Knowledge point analysis 

Learn how digital shake sensors work.

The digital shake sensor is a digital sensor that is only sensitive to one-way movement caused by human hand. It uses a spring-style vibration switch, and outputs high level while stationary. When the user shakes the sensor with power towards a predefined direction, the module outputs a low-level pulse and the onboard indicator light flashes. Thanks to the unidirectional sensitivity of the vibration switch and the corresponding filter circuit, a medium-intensity collision or vibration (such as: drop, impact) will not accidentally trigger an interrupt signal. Therefore, the sensor is highly impact-proof and interference-proof.

When the user holds the module as shown in the figure on the right, and shakes it in the direction of the arrow (from + Y to Y-), a valid low-level interrupt pulse can be generated on the "D" Pin, and ON will produce bright flash. Shake, impact or vibration in X or Z direction will not generate effective interrupt pulse.

In the process of package delivery, the sensor can be placed inside the package, where it can detect the number of vibrations or whether it is upside down. Also, multiple sensors can work together to draw a picture of how the package is handled through the trip.


Hardware connection




1. Write the program

The function we want to achieve is to send information to the cloud as soon as there is a vibration. Can we print out digital output information using a serial port for real-time monitoring? And can we find a suitable angular position to install the sensor?




Very good. The reading is normal.

2. Reference program



3. Program results


EasyIoT receives vibration information in real time, and achieves vibration monitoring.

4. Program analysis

Further Reading 

Basic of Serial Communication

Arduino’s Hardware Serial and Software Serial

Taking Arduino UNO as an example, there is only one set of serial ports on the panel, namely Pins 0 (RX) and 1 (TX). These two ports facilitate the communication between computer and Arduino. USB port is connected to two serial port pins via a conversion chip (often ATmega16 u2). Ostensibly, the computer is not connected to these two pins via external wire, but it works the same way. When the Arduino controller is connected to the computer with a USB cable, a serial connection is established between the two. By this connection, the Arduino controller can communicate with the computer.

Usually, a serial port can only connect one device for communication.

Further Exercise 

In Chapter VI Ultrasonic Rangefinders, we have learned how to use an LCD display. Can you modify the reference program to display the information on the electronic screen?

Program 8-1 E18.rar 165KB Download 0
All Rights
COMMENTS ([[commentTotla]])
[[c.user_name]] [[c.publish_time]]