Tips for using the Yocto-3D-V2

Tips for using the Yocto-3D-V2

We publish today a new firmware for the Yocto-3D-V2 with a few improvements but especially a fix for a bug on magnetic orientation. This is the perfect opportunity to remind you of some essential information to make the most of this module.

High frequency measures

To perform measures in real time, so as to be able to follow the slightest moves for example, it is essential to use the correct method to read the sensor, as we explained it previously in several posts: the callback method, when the sensor sends its measures instantaneously and spontaneously.

This impacts the value that you can obtain at a high frequency. Indeed, only the main value of each measure can be obtained in this way. For the accelerometer, the gyroscope, and the magnetometer, the main value is the norm of the vector.

Quick access to x, y, and z components of the vectors

Thus, versions of the firmware before version 26635 didn't provide the possibility to read the x, y, and z components of these vectors at a high frequency. This didn't prevent you from obtaining the module orientation, as the quaternion components were available, but this made its use somewhat more complex for some applications.

With the new firmware, you can modify the assignment of functions qt1, qt2, qt3, and qt4 to assign them, not to the quaternion components anymore, but to any other component of the vectors of the accelerometer, the magnetometer, or the gyroscope. This is done simply by changing the logical name of these functions with the set_logicalName() method. Their factory set logical name is respectively w, x, y, and z, following the quaternion convention. But they now recognize the names ax, ay, and az to become components of the acceleration vector, mx, my, and mz to become components of the magnetic field vector, and gx, gy, and gz to become components of the rotation speed vector. Thus you can use the 4 qt functions to obtain for example the ax, ay, gx, and gy components.

Note: as the qt values are integers, the units used are the milli-g (mg) for the ax, ay, and az components, the milli-Telsa for the mx, my, and mz components, and the milli-degree per second for the gx, gy, and gz components.

Note also that if you use this possibility of redefining the qt functions, you naturally can't obtain the quaternion by callback anymore. This also means that 3D visualization of the position estimated by the quaternion in the VirtualHub won't work anymore.

Quick access to other attributes

If you need to quickly access other attributes, or if you don't want to sacrifice the callback for the quaternion, you also have the possibility to use the loadAttribute() function described in a previous post. It is slightly less efficient than the callback method, but nevertheless much more efficient than using the get_ functions when you need to read only a few attributes.

Increasing the bandwidth for the inclinometer and the compass

In order not to overload machines with little power, in its standard configuration the Yocto-3D-V2 publishes the quaternion values only at 100 Hz. The inclinometers and the compass are averaged and sent only at 7 Hz. If you need a higher refresh rate, you can use the set_bandwidth() method to increase this frequency up to 20 Hz for the compass and 100 Hz for the accelerometers. Expect however more noise in the measures, as averaging is not superfluous on this type of sensors...

Magnetic orientation

The estimate of the absolute orientation performed by the BNO055 is based on the accelerometers and on the compass. Inclination can be determined without compass, but it is impossible to know the absolute orientation without a working compass.

Magnetic disturbances

A compass is very sensitive to

  • surrounding ferromagnetic metals
  • surrounding magnetic fields, including those generated by electric currents

The BNO055 can auto-calibrate itself to cancel the effect of magnetic fields which are constant with regards to the sensor (that is those of which the sources are constant and move jointly with the sensor). On the other hand, the presence of ferromagnetic metals, even if interdependent with the sensor, perturbs the proper functioning of the sensor because they modify the magnetic field lines as illustrated below.

Deformation of magnetic field lines
Deformation of magnetic field lines

Here is a short video with an experiment showing the difference between a correct and an incorrect use of the Yocto-3D-V2. Note in particular that, as indicated in the documentation, the Picoflex connector must be kept for application which use only the inclinometer as the metal in the connector modifies the proper working of the compass. For the compass to function properly, you must absolutely avoid using iron, nickel, and steel. You can however use screws in aluminium, coper, zinc, brass, or even plastic...


... and bugs

While performing these tests, we noticed that in the opposite to the Yocto-3D and to what is indicated in the documentation, the original firmware of the Yocto-3D-V2 points to the magnetic North with the Y axis and not the X axis as planed. This orientation error impacts in the same manner the quaternion describing the module position.

Starting with this new firmware 26635, we restore the expected behavior: magnetic North is thus from now on pointed by the X axis, and the [1,0,0,0] quaternion indicates a horizontal position with the X axis pointing due North. This modification can have a significant impact for some applications. Therefore, we will individually inform of the modification each of our customers who have bought a Yocto-3D-V2 so that they can take this into account before updating their firmware.

Calibrating the BNO055

Like all inertial MEMS sensors, the BNO055 sensor used in the Yocto-3D-V2 uses a calibration mechanism to return correct measures.

  • The zero of the gyroscope is recalculated when an idle position is detected by the accelerometers
  • The zero of the magnetometer is re-centered by computing the median value of the magnetic field while rotating in space
  • The zero of the accelerometer and its amplitude are re-calibrated through the measure of ground acceleration, when the sensor is idle and stable in a position orthogonal with the gravity vector.

When it is not calibrated, the BNO055 sensor is not able to return an orientation estimation. To avoid this issue, Yoctopuce performs a factory calibration of the sensor, and the Yocto-3D-V2 automatically applies the latest known calibration parameters each time the module restarts. If necessary, calibration is adapted transparently by the BNO055, which performs an ongoing calibration when it is working in NDOF fusion mode.

Monitoring the calibration state

This ongoing and adaptive behavior can however present a disadvantage: if the BNO055 detects a stimulus above the expected range on one of its sensors, such as a hard shock going above the accelerometer range, a magnetic perturbation going above the magnetometer range, or a rotation at a higher speed that the gyroscope range, the BNO055 can automatically switch back to non calibrated mode, and thus temporarily cease to perform some orientation estimations, rather than returning incorrect estimations.

You can detect this behavior with two methods of the refFrame function:

  1. You can obtain the sensor calibration state with the get_calibrationState() method, which returns an integer between 0 and 333. The hundreds digit represents the accelerometer calibration state (0=not calibrated, 3=well calibrated). The tens digit represents the magnetometer calibration state, the unit digit represents the gyroscope calibration state.
  2. You can obtain the general state of the calibration with the get_measureQuality() method

If you want to obtain this information at a high frequency, you can find them in the string returned by refFrame.load_attribute("calibrationParam"), ignoring the part preceding the space.

Performing a manual calibration

If you want to perform a full calibration again (to compensate a magnetic perturbation, for example) and to save it in the Yocto-3D-V2 flash memory so that it is applied at start up, you can do so. You can run the calibration process through the Yoctopuce library, the command line, or the VirtualHub: it sets the BNO055 in not calibrated mode, and waits for the later to get back to fully calibrated mode indicating which movements must be performed. When the calibration phase is over, the parameters are saved in the flash memory of the Yocto-3D-V2.
Calibrating the BNO055 accelerometer requires you to be patient, we never could perform a calibration as fast as what is shown on the video posted by Bosch Sensortec, we suspect that it has been somewhat shortened... So here is our video showing a calibration from start to finish, no cheating:


Other specific settings for the BNO055

Customers sometimes ask us whether one can access other internal settings of the Bosch BNO055 sensor used by the Yocto-3D-V2, for instance to modify the working mode or to change the measuring range of the sensors.

The Yocto-3D-V2 always uses the NDOF mode, which corresponds to the most advanced working mode of the BNO055 sensor (fusion mode with fast calibration). It is not possible to change this mode, because all the inner workings of the module are based on it. Moreover, when the sensor works in fusion mode, the BNO055 automatically generates all the measuring ranges. It is therefore not possible to configure them manually.

You can, on the other hand, configure the orientation of the sensor through the VirtualHub or the Yoctopuce programming library, as described in the user's guide in section 3.4.


If you expected the Yocto-3D-V2 and its Bosch BNO055 sensor to magically free you from the laws of physics, you will inevitably be a little disappointed... But when you know which precautions you must take, there are still many real applications that work :-)

Add a comment No comment yet Back to blog

Yoctopuce, get your stuff connected.