Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

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

image

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.

HOW THIS STUFF WORKS
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.

WIRING
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.

HOW TO APPLY MY CODE
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.

...

image

HARDWARE PARTS
- Microsoft Kinect
- Arduino Uno
- Micro Servos X 2 (I used TG9e micro servos)
- Breadboards and wires
SOFTWARE COMPONENTS
Arduino IDE 1.0
http://www.arduino.cc/en/Main/software
Microsoft Kinect SDK V1 beta2
http://www.microsoft.com/en-us/kinectforwindows/download/
Coding4Fun Kinect Toolkit 1.1
http://c4fkinect.codeplex.com/releases/view/76271#DownloadId=300233
Microsoft Visual Basic Express 2010
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-basic-express
.NET Framework 4
http://msdn.microsoft.com/en-us/netframework/aa569263
Microsoft DirectX SDK - June 2010 or later version
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6812
Runtime for Microsoft DirectX 9
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=35
Microsoft Kinect Code4Fun Quickstart VB code (You will overwrite this with my modified version)
http://files.ch9.ms/coding4fun/KinectForWindowsSDKQuickstarts.zip

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

Tags:

Follow the Discussion

  • 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.

  • Nice tutorial.

  • IT WORKS!

  • Janet WestJanet West

    VERY VERY INTRESTING!!!!!!!!!!!!!!! LOL LOL LOL

  • Janet WestJanet West

    VERY VERY INTRESTING!!!!!!!!!!!!!!! LOL LOL LOL

  • JadJad

    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.

  • MirMir

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

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @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.

     

Remove this comment

Remove this thread

close

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.