Are your parcels well treated?

Are your parcels well treated?

Have you ever asked yourself what happened to parcels sent through the mail? We did! It's not that we have to complain about the Swiss postal services, quite the opposite. But we wondered how they manage to deliver the next morning, anywhere in Switzerland, a parcel mailed at 5 pm.

It so happens that we have in our range a small module able to detect movements and shocks and to register them in its flash memory. We are talking about the Yocto-3D module. Obviously, it was very tempting to put one in a parcel and to make it register the accelerations supported by the parcel during its journey.

As all the Yoctopuce sensors, the Yocto-3D doesn't need a true USB connection to work. It only needs to be powered. And we don't even need to power it with 5V, this module can do with a low 3.3V. In other words, three simple batteries are enough to enable it to work autonomously.

Three simple batteries are enough to power the Yocto-3D
Three simple batteries are enough to power the Yocto-3D

So we built a little flight recorder for post parcels: a Yocto-3D powered by three AA batteries, everything secured on a plate that we only need to glue inside the parcel. We started with a few tests: powered in this way, the module has enough power for about a week.

A little flight recorder for post parcels :-)
A little flight recorder for post parcels :-)


Before sending the parcel, you must configure the Yocto-3D. The easiest way is to use the command line library. You must first erase the logger data. The secondary effect is to stop the data logger if it was already running (in the following examples, always replace the serial number by that of your own module):

C:\>YDatalogger Y3DMK001-1FD59.dataLogger forgetAllDataStreams OK: Y3DMK001-1FD59.dataLogger.forgetAllDataStreams = .

Then, you must activate the function that interests you, here the accelerometer. You might be tempted to configure the sampling frequency to the maximum, but it's not necessarily an good idea: you might end up with a mountain of data difficult to manipulate. We are going to sample only once per minute. Thus, for each minute, we'll have the minimal value, the mean value, and the maximal value. We are mostly interested in the latter.

C:\>YAccelerometer -s Y3DMK001-1FD59.accelerometer set_logfrequency 1/m OK: Y3DMK001-1FD59.accelerometer.set_logFrequency = 1/m.

Note the -s forcing the module to save the configuration change. Without it, the modification would be kept only until the module restarts. If the journey is going to be long and you want to gain some space, you can deactivate the recording of the other functions of the module.

C:\>YCompass -s Y3DMK001-1FD59.compass set_logfrequency off OK: Y3DMK001-1FD59.compass.set_logFrequency = off. C:\>YMagnetometer -s Y3DMK001-1FD59.magnetometer set_logfrequency off OK: Y3DMK001-1FD59.magnetometer.set_logFrequency = off. C:\>YRefFrame -s Y3DMK001-1FD59.refFrame set_logfrequency off OK: Y3DMK001-1FD59.refFrame.set_logFrequency = off.

Then, you must configure the data logger so that it starts registering as soon as it is powered.

C:\>YDatalogger -s Y3DMK001-1FD59.dataLogger set_autoStart on OK: Y3DMK001-1FD59.dataLogger.set_autoStart = 1.

There you are, almost done. There is a last little trick. The Yoctopuce sensors don't have a real time clock: they forget time as soon as they are without power. However, they update their clock automatically as soon as they are connected to a computer (or a YoctoHub) which knows what time it is. The trick is to connect the module for a few seconds to a computer running the VirtualHub, enabling the module to update it's clock. It also starts registering data using this time as a starting point. If you then disconnect the module to power it with batteries, it continues adding data using as a starting point the time of the last recording. This manipulation is optional. If you don't do it, the data logger time stamps the data starting from second zero.

Obviously, we didn't resist making a few fun tests. Here is what happens when you let the parcel fall from about 1.2 meter high.

The parcel flight recorder registered a quite hard landing
The parcel flight recorder registered a quite hard landing

When everything is ready, you only have to mail the parcel to your own address and to wait until the next day for the mailperson to bring it back.

The next day

Our poor mailman din't quite understand why we literally flew at him to retrieve a parcel which didn't look any different from those we get everyday :-) After we opened the parcel, we noted that the module was still there in one piece, quietly registering what was happening. We first stopped the data logger.

C:\>YDatalogger Y3DMK001-1FD59.dataLogger set_recording off OK: Y3DMK001-1FD59.dataLogger.set_recording = 0.

Then, we retrieved the data.

C:\>YAccelerometer -f "[result]" Y3DMK001-1FD59.accelerometer get_recordedData 0 0 unixTime;minValue;averageValue;maxValue 1399992720;0.9920;1.0066;1.0190 1399992780;0.9990;1.0082;1.0160 1399992840;0.9990;1.0080;1.0150 1399992900;1.0000;1.0079;1.0180 1399992960;1.0010;1.0077;1.0140

The -f "[result]" is used to simplify how the results are displayed to parse them more easily. You can also register everything into a file that you can then import into an Excel spreadsheet for instance:

C:\>YAccelerometer -f "[result]" Y3DMK001-1FD59.accelerometer get_recordedData 0 0 > data.csv

And here is the result. We now know how the Swiss postal services do manage to convey parcels from one end of Switzerland to the other in less than 18 hours: they slog almost all night long.

The tribulations of a parcel in Switzerland
The tribulations of a parcel in Switzerland

We also noticed that the parcel was handled with care: the postal services never let it drop, they didn't even shake it much. If we had thought to activate the recording of the two inclinometers of the Yocto-3D, we could even have known if the parcel had been tilted.

We can even overlap the registered data with shipment tracking provided by the postal services to note that the supported acceleration peak (about 2.5g) probably corresponds to the parcel arrival in the sorting center.

The parcel is scanned at the sorting center at 22:34
The parcel is scanned at the sorting center at 22:34

Obviously, you can take the concept even further using other Yoctopuce modules:
Yocto-Altimeter, Yocto-Temperature, Yocto-Meteo, ...

Finally, if you wish to reproduce this experiment, you must know that it is strictly forbidden to airmail a device connected to a lithium battery because these batteries are a fire hazard. So no USB batteries: you'll have to do with ordinary batteries.

Add a comment No comment yet Back to blog

Yoctopuce, get your stuff connected.