DIY Telepresence Using Ubuntu Laptop

by swingboy3 in Circuits > Robots

1558 Views, 16 Favorites, 0 Comments

DIY Telepresence Using Ubuntu Laptop

Diy telepresence

If you watch the video and see the picture, I have made a very simple DIY telepresence robot. It is not quite finished but working to the point that it is functional. Here is what I used:

1 x86 laptop. I used Ubuntu OS but you can probably do this with a raspberry Pi or Windows based laptop.

1 MSP430 Launchpad. You can use any microcontroller with UART and PWM capabilities

1 Virtual Serial port (VSP). I think you can use the serial port attached to the Launchpad, but I have always found these flakey

2 Continuous rotation servos. I use parallax Servos

1 Battery Pack. As long as it is above 4.8 volts it should be fine. You can't pull this off of the USB port because it is for the servos and they draw more current than a USB port can supply.

Wires. It may be best to buy a set of these if you are new to wiring stuff. These make life so much easier.

1 mini breadboard. You may be able to get away without this. As you can see I used it.

3D Printed connectors. I will post a link or the file of these connectors so you can print your own.

A second computer to connect in to your little robot.

The basic overview of the functionality is as follow. The computer hosts LAMP of which you only need Apache and PHP, but heck, MySQL is good for future projects. This allows a remote user to press buttons that send serial commands across the VSP to the microcontroller. The microcontroller uses this data to control the servos. Completely independent of this is Skype, which is used to do the "presence" portion of the robot.

Step 1: Control Servos With Microcontroller

I have to say I have fallen in love with the MSP430 chips. It gives you lots of control (more than an Arduino) and is very inexpensive. What I really like about it is the chip comes out (MSP430 G2553) and can be plugged into a bread board with just a 3.3V power supply and a pullup resistor and it runs. The code I wrote is uploaded here. I use Code Composer Studio (CCS), and you can get this free from TI. I have provided five files. There is one main file and then two accompanying source files with their *.h files. Simply make a new project in CCS and replace the main.c file with the one I gave you and then import the other four files that have been provided.

Servos may need an instructable all on their own. Suffice it to say that there are three wires that go into a servo (Ground, Power, Signal). The servo ground needs to be directly connected to both the battery (-) and the ground of the microcontroller. The Servo power needs to be connected directly to the batter (+) and nowhere else. The servo signal needs to go to pins 2.0 (2.1 for the second servo).

With the code loaded on the MSP430 and the servos connected it is time to make these servos move. The best way to do this is with the VSP that I used. If you would like, the VSP can power and talk to the MSP430. This would require 4 lines (RX, TX, 3.3V, and GND). Remember that the ground of the MSP430 is already connected to the ground of the battery and servo. We do common grounding (at least in the US) so make sure your grounds are all common. Specifically the RX line of the VSP is connected directly to pin 1.1 on the MSP430 and the TX line on the VSP is connected directly to pin 1.2 on the MSP430. The VSP is then connected to any computer (it does not matter at this point).

Step 2: Understanding Serial Communication

Terminal.png
Putty.png

There are wonderful resources on understanding serial ports. Here is the basic overview. A serial port is a simple way to talk to a microcontroller with a computer. We use this to tell the servos what they are supposed to do. To test our serial port and our servos I use putty. This is normally used for network communications, but since windows removed hyperterminal I have reverted to putty. If you are using linux, I like gtkterm, it feels a lot like putty. From this point I will use putty. Before opening putty you have to figure out which port your VSP is plugged into. Simply open a command prompt by typing "cmd" into any of windows many search options. Then type "mode" in the command window. It should display something that looks like the terminal window shown. Notice that this one reports back "COM3" but yours may display many. I simply unplug it and see which one disappears and then reappears when I plug it back in.

Now open Putty. Select the "Serial" radio button and modify it to the correct port. I did use a baud rate of 9600 as well. This is specific to the code for the microcontroller so don't change that. Once open type the following:

#10010&

This should move both servos opposite directions. The commands that I set up are as follows

First character needs to be #

Second character is 0-4 (0-stop 1-Forward 2-Left 3-Right 4-reverse)

3rd through 7th character is the time duration that the wheels will be moving.

8th character is & and denotes the end of the string. If you type something wrong simply place a & and start over.

You should now have a computer controlling servos.

Step 3: Ubuntu and Web Interfaces.

Now you need to brush off that old laptop and install Ubuntu. I don't care what distro, but Ubuntu makes it easy to keep your windows on your machine and add Ubuntu as well.

Once you are up and running you need to install LAMP. This is very simple, just follow the instructions with the link.

Now make a new folder in the web area of your control. Open up a terminal (term) and do the following

$ cd /var/www/html/

$ sudo mkdir bot_control

Download the three files I have linked here and then move them into this folder

$ sudo mv send_any.sh /var/www/html/bot_control

$ sudo mv init_tty.sh /var/www/html/bot_control

$ sudo mv bot_control.php /var/www/html/bot_control

Now that you have it all in place we need to mess with permissions. The user www-data has to be able to both execute the commands init_tty.sh and send_any.sh and also be allowed to talk to the serial port.

$ cd /var/www/html

$ sudo chown www-data:www-data -R bot_control

And now for the serial port.

$ sudo gpasswd --add www-data dialout

Also it is important to find out what port your serial port is on. Simply type the following

$ dmesg |grep tty

Mine happened to be on ttyUSB0, but yours may be different. If yours is different you must modify both of the *.sh files so that the ttyUSB0 is the port you care about instead.

You may need a reboot in here somewhere. I know you can do this by restarting modules, but a good reboot helps every now and then. (Someone is rolling their eyes at this comment right now)

Now find out what your local IP address is by dowing the following

$ ifconfig

Mine is 192.168.1.129. Yours is going to be different but remember that this is a local address and is not visible outside of your local network.

Once this is up go ahead and navigate to your page via any web browser you'd like on any computer on your local network.

http://192.168.1.129/bot_control/bot_control.php

Remember to put in the correct address.

You should be able to press the buttons and make the servos move. If you can then congratulations, you just need a chassis.

Step 4: Building the Chassis

I decided to 3D Print my Chassis. I've attached my *.stl for the three body parts the drag wheel and the wheels.

I used standard electrical conduit in about 10" sections to tie everything together. The conduit is only about $4 for a 10' section at your local hardware store.

I used hot glue to hold it together. The servos should simply snap into the blocks there.

I left the platform up to you. There are three post holes at 15 degrees out of the 3D printed chassis mounts. You can just use one or two of these, or all three for a tripod and a platform. Just be careful because the servos are pretty small for this build. I recommend if you want something more solid to look into another chassis. PWM output is very standard to most motor controls especially in the RC arena, so you can simply find a robust tank chassis and you are off.

In the end all of the stuff that I used was on hand already. I just had to print the chassis and I was up and running. I figure you could do it for the following costs if you had absolutely nothing.

Old Laptop $100?

Servos $13 each ($26)

MSP430 Launchpad $20

VSP $8

Wires $8

Battery clip $3

Total is about $165.

You obviously can make some of this more expensive by adding a better robot chassis.

You can also make this quite a bit cheaper by relying on a Raspberry pi to control this, but then you would need to add a screen if you wanted full telepresence. It is probably better to just do the old laptop in the end.

Good luck with your build.