I'm currently working with Kinect v2. I can do all sort of stuff on PC with it. What I want to do next is, to get the data I want on PC and control the Raspberry Pi with that data (for example, I will move the Pi with motors when I tilt my head to right). I have sorted out the motors and everything but I just don't know how to use that tracking data I have on PC to control the Pi.

I hope the question makes sense, i'm just extremely new to both Pi and Kinect.

Edit: Further clarification of what I'm trying to achieve.

I have a Raspberry Pi which is connect to 2 step-motors through a motor driver. With this setup, I can run a Python script and turn on or off the motors with that.

Now I also have a Kinect V2 connected to my PC.

What I want to achieve is, to issue the 'turn on - turn off' commands from the Kinect which is connected to my pc and not the Pi. I want to tell the pi from my computer, for example, when I turn my head left, turn on the motors connected to the Pi. I can issue the commands through the python script inside the Pi. Now I want to issue those commands from my PC which has the Kinect data and I want to do it through WiFi connection.

  • Step1: Get the head movement data from Kinect on my PC.
  • Step2: Send that data to Raspberry Pi, somehow(The step where I have the problem).
  • Step3: Pi turns on motors according to that data.

I hope this clerifies the problem.

Thanks for the help!

  • $\begingroup$ What you intend to do is rather unclear. what do you mean by 'I will move the Pi with motors when I tilt my head to right' ? This is rather obscure to me. $\endgroup$
    – N. Staub
    Commented Oct 8, 2017 at 16:59
  • $\begingroup$ Sorry for the delayed answer, I had a complication on my account. I accidentally asked the question through a gues account and couldn't answer later on. I have updated the question for you. $\endgroup$ Commented Oct 9, 2017 at 21:44

2 Answers 2


In general in what you describe you have 2 main hardware parts, a sensor(kinect) and actuators (motors). Each might or might not have its dedicated computer to deal with the perception algorithm or control algorithms respectively.

From a software point of view you have 3 main components; the perception algorithms retrieving informations from the sensor and processing it; the high level decisional algorithm reacting to those information and generating response behavior for your system; and lastly the actuators making the response possible.


considering you extended questions you have two solutions: 1. use a middleware like ROS to handle the communication for you 2. write your own communication protocol ( most likely a kind of server client)

Option 1 will usually bring you more tools and it will be easier to further add components / functionalities in your system. Option 2 it is dedicated you have control over everything.

  • $\begingroup$ I understand what you are saying. I further clarified what I'm trying to achieve. Since both sensor and the motors have different computers controlling them, I don't know how to make it so sensor gets the data and second computer( which is a raspberry pi) use that data and actually control the actuators. $\endgroup$ Commented Oct 9, 2017 at 21:47

You either need to write a communications layer that will allow the PC to send commands to the Pi, or use a system that already has this communications layer in place.

You also need to write programs for both the PC and the Pi that implement this communications layer, as well as the logic.

The PC program needs to read the kinect and figure out what the Pi needs to do. Then send the information to the Pi

The Pi program needs to listen to the communications layer and translate the communication into movements of the motors.

The communications layer will probably (if I were writing it) use TCP/IP sockets.

Or you could use ROS which has all of the implementation details done so that you can just work on the logic.

One of the easiest communication layers to set up is MQTT. I currently have a mosquito (sudo apt install mosquito) server running on a Raspberry Pi. This can be the same machine that is running your motors. Or you could run the server on another machine, it doesn't matter.

There are libraries and clients for MQTT available for most languages. Currently I'm running my commands using Gobot, which is a robot/IoT framework written in the Go language. This uses a basic publish/subscribe system. To be notified of messages with a specific topic, a program subscribes to the topic. To send a message to all the subscribers of a topic, you publish a message with that topic. In addition to the topic, there is also a message, which is an array of bytes defined by the user. You can also use the topic as a way of passing the message.

For example, the "motors-on" topic could tell the Pi to turn on the motors. The "motors-off" topic could tell the Pi to turn off the motors.

My test program used the same program as both publisher and subscriber.

It really is that simple.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.