Kinect'ing to Arduino with Visual Basic


Today's Hardware Friday post is another Kinect related project, but this time using a couple things we don't see much in the Kinect space, Ardunio and Visual Basic!

Kinect controls Arduino wired Servos using Visual Basic 2010


In this project, I use left and right hand movements in Kinect to control the rotation of two servos tied to Arduino Uno, which in turn moves the left and right arms of a makeshift stickman. The middleware is written in Visual Basic 2010 and is based on the Microsoft Kinect SDK beta 2.

There are plenty of C++ and C# code examples to interface Kinect to other gadgets, but not many Visual Basic examples. So I figured this project could help folks with mostly VB skills to start hacking Kinect with Arduino.

Kinect keeps track of 20 skeleton joints for each player. To simplify this project, I extract the coordinates of the left hand and right hand joints only. Then I pass those joint coordinates to an Arduino UNO after I do some scaling in Visual Basic from computer screen size to servo angles.

I modified the VB code in the Microsoft Quickstart samples because it's well documented and comes with good tutorials. So anyone can review these tutorials to learn more about how this VB code works with Kinect.

The changes I made to the sample VB code were mostly to facilitate serial communications with Arduino as well as to map screen coordinates to the servos angles. In this project, I capture the Y (vertical) movement of the HandLeft and HandRight joints. It should be easy to modify my code to add more servos and joints.

For this project, I used two TG9e micro servos powered by the Arduino Uno connected to my PC via USB. For bigger servos with more power needs, you may have to power them separately or else the Arduino will act erratically.

I labeled one servo as the Left Hand servo while the other as the Right Hand servo. If you confuse the servos at some point, the fix is often as simple as changing a line of code instead of rewiring.

Left Servo ---> Arduino Digital Pin 9
Right Servo ---> Arduino Digital Pin 11

For debugging purposes, you may wish to consider testing your build with one servo before adding another.

In addition to the instructions, you can view my step-by-step screen captured stills. Please click the "i" in the upper left corner of each photo to see the full resolution still.



- Microsoft Kinect
- Arduino Uno
- Micro Servos X 2 (I used TG9e micro servos)
- Breadboards and wires
Arduino IDE 1.0
Microsoft Kinect SDK V1 beta2
Coding4Fun Kinect Toolkit 1.1
Microsoft Visual Basic Express 2010
.NET Framework 4
Microsoft DirectX SDK - June 2010 or later version
Runtime for Microsoft DirectX 9
Microsoft Kinect Code4Fun Quickstart VB code (You will overwrite this with my modified version)

If you're an Arduino builder, a Kinect hardware hacker or Visual Basic dev, there's a little here for all of you...

The Discussion

  • User profile image

    This is such a time saver. I was stuck for days trying to get Arduino to work with Kinect. Thank you for sharing this. And a big thank you for the developer Hazim Bitar for taking the time to document his work in such meticulous details.

  • User profile image

    Nice tutorial.

  • User profile image


  • User profile image
    Janet West


  • User profile image
    Janet West


  • User profile image

    I wish if Bitar's VB code has more comments. It works as advertised but more explainations would have been helpful for those of us who like to peer inside the magic blackbox.

  • User profile image

    This link for vb code is not working, is there another link or any other way to get the vb code.

  • User profile image

    @Mir: You're referring to the "Microsoft Kinect Code4Fun Quickstart VB code (You will overwrite this with my modified version)" link, right?

    That's a know server side issue that the Channel 9/Microsoft team is working on and will hopefully resolve soon.


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.