Tutorial
Valentijn
2023:12
Collect and process data in python from Xsens DOT sensors
As shown in the image on the right (sourced from the XsensDOT User Manual) the Xsens DOT there is a single button located on the front middle orange panel. This button allows you too turn on the sensor with a single click and turn it off by holding it down for a few seconds.
The dot also contains an LED which shows the status of the dot. When running into errors the led can provide helpful information on the status of the device.
There are about 13 different states ranging from different colors to different blinking patterns. Each of these is explained in the Xsens DOT User Manual by Movella
The DOT's can be charged individually through the micro USB port found at the bottom of each sensor or all together when placed inside their case and by connecting the included micro USB cable to the case.
It is important to manually turn off each of the sensor after charging!. As they turn on when connected to power but won't turn off automatically after being disconnected!
The Xsens DOT is compatible with lots of different platforms as can be seen in the table below (sourced from the XsensDOT User Manual)
For active use the easiest way to collect data is using a mobile phone which runs the Movella DOT app
The setup and use has been well documented by Movella in this youtube video
In this tutorial we will setup python for live data collection and processing in Python.
We assume you have the following: - Python 3.10 on a machine. (This tutorial will only work with version 3.10) - XSense DOT's - Visual studio code (or another editor)
1. Checking the python version. We must double check that the python version that we have installed is the correct version of 3.10 we can do this using
python --version
This should return an output like this
Python 3.10.2
2. Downloading the movella dot SDK
You will need to download the latest stable software - PC from this website
You may need to provide contact details, you will get a download link emailed to your inbox.
After unzipping double click to install the movelladot_pc_sdk_2023.setup.exe and follow the wizard. Make sure this is correctly installed before moving on!
3. Installing the DOT python library
We must install the Python library for the Xsens DOT by navigating in the file explorer to
"C:\Program Files\Movella"
In which you should see a folder called “DOT PC SDK XXXX.X” note down the name of this folder and what the x's are. You need to replace them in the commands below with your own.
Make sure that you see 4 files in here, just like in the screenshot right.
Next install the package using (replace the X's with your own version that you have downloaded)
pip install "C:\Program Files\Movella\DOT PC SDK XXXX.X\SDK Files\Python\x64\movelladot_pc_sdk-2023.6.0-cp310-none-win_amd64.whl"
4. install python dependencies
The movella DOT sdk has a few dependencies. To install these we must navigate into the examples directory in a terminal using
cd "C:\Program Files\Movella\DOT PC SDK XXXX.X\SDK Files\Examples\python"
(replace the X's with your own version that you have downloaded)
We can install the dependencies using the requirements.txt by running:
pip install -r requirements.txt
5. Running the example code
Next we can try running the example python script recieve_data.py which is located in the Program files > Movella > DOT PC SDK > SDK Files > Examples > python
WARNING We will be diving into code and modifying parts of your laptop's system. Please only continue if you understand the risks and are confident that you know what you are doing!
BLUETOOTH DEVICES WARNING We will be modifying the blueooth driver on the laptop, thus you wont be able to use any Bluetooth devices (such as mice, keyboards or headphones) while connecting to the DOT sensors.
To easily collect data using your laptop we must install the Xsens DOT Server from github.
The installation process for windows, macOS and raspberry pi] is well documented on their [[https://github.com/xsens/xsens_dot_server#set-up-the-environment | github. Linux setup might work but is not directly supported, only installation on a Raspberry Pi is.
After installing the dependecies and configuring our bluetooth adapter, you must clone the server application repository using the command
git clone https://github.com/xsens/xsens_dot_server.git
After which we must open the downloaded folder using
cd ./xsens_dot_server
We can then start the server using
node xsensDotServer
Now when you go to localhost:8080/ you should be prompted with a page where you can connect to the sensors, start data collection and download the data as a .csv file
Having issues? Please check the part below on trouble shooting!
We have configured the Bluetooth adapter using Zadig in a way that does not allow us to use normal Bluetooth devices.
1. Using the search bar look for Device Manager and open it
2. In the device manager look for Universal Serial Bus Devices
3. In here select your Bluetooth device
4. While having the Bluetooth device selected navigate to Action at the top bar
5. In the action tab click on Scan for hardware changes
This should usually work, and you should see the page refresh and the device return back as a normal Bluetooth device as shown below
This however may not always work correctly. After trying the above steps twice please try the steps below (at your own risk)
6. Make sure you still have the Bluetooth serial device selected as in step 3
7. With the Bluetooth device selected navigate back to the Action tab
8. In the action tab select Update Driver
9. In the update driver popup select Search automatically for drivers (you may need an internet connection for this)
These additional steps should reinstall your default driver for your Bluetooth adapter.
Some of these steps have also been documented here by the team that created the XSens DOT server
There are a few common issues that you may have.
- You may see
Error: No compatible USB Bluetooth 4.0 device found!
this can be caused because the adapter can't be found by the nodejs application. This can be solved my modifying part of the code to include your bluetooth adapter when searching for adapters connected. How to do this has been well documented here