Arduino 101 and Visual Studio C++ 2013

This article shows how to interface Arduino (in the example, I used an Arduino 101, but you can use any other Arduino model) with the PC. The Arduino sends IMU data (acceleration and gyroscope sensors data) to the PC using Serial communication.

On the PC side, I implemented, using Visual Studio C++ 2013, a client software which polls data from Arduino. Once the PC receives IMU raw data, the program uses the data to calculate the rotation quaternion, and then the Tait-Bryan angles (yaw, pitch, roll) are calculated using the quaternion as an input. This process repeats every 50ms (20Hz); the cycle time can be tuned.

The data is then visualized in real time using the console, as well as an other window which is handled by "glfw" library (OpenGL library).

The video below shows how the program works. Since the yaw angle is calculated based on gyroscope signals integration, there is an error on yaw angle. This error can be corrected by using a magnetic sensor, or using any other yaw angle estimation methods, for example angle estimation from GPS data.

The next step which I would like to implement, is to reduce the algorithm computational load in order to be able to run the algorithm smoothly directly inside Arduino 101 (32 bit, 32Mhz microcontroller).

The complete source code can be downloaded here: IMU_receive_glfw_20161013.

Author: Davide Cavaliere

I am an Italian Electrical Engineer graduated at Politecnico di Milano. My interests are motorcycles and cars, electronics, programming, Internet of Things, and Japanese culture.

Leave a Reply

Your email address will not be published. Required fields are marked *