Introduction: Create an Internet Controlled Robot Using Livebots

Here you will learn how to create an internet controlled robot or other installation using Livebots.

Livebots is a project I'm working on which consists of an easy to use website for all the robots that people can interact with through the internet.


As an example I will be using a simple Arduino UNO with a LED connected to an Raspberry Pi to show you the concept, but of course you can use anything that can be receive messages by the serial port and any computer you would like.

Here is it:
 

And here is another example:

 

Step 1: Program the Arduino

Attached is a simple arduino program that reads the messages form the serial port and lights the LED when they contain "HIGH" and turns it off when "LOW".

Feel free to adapt it to your own needs.

Step 2: Add the Robot to the Livebots Website

Start by creating an account (http://livebots.cc/Account/Register).

Click Add a Robot and upload your bot's picture (http://livebots.cc/Upload/1).

Then you can add your robot information that will appear on the robot's page.

Step 3: Install PySerial

In order to let python communicate with arduino you will need to install pySerial: http://pyserial.sourceforge.net/  

1. Download and click open: http://sourceforge.net/projects/pyserial/

2. Unzip and untar the files

3. Install pySerial. On a terminal window, navigate to the folder where you have the files and run the following command:
cd pyserial-2.5
sudo python setup.py install

For more info on how to do this on raspberry pi go here:
http://www.doctormonk.com/2012/04/raspberry-pi-and-arduino.html

PS: If you're on Windows make sure you have python installed: http://www.python.org/getit/windows/ (Thanks msandersmay10 for pointing this out!)

Step 4: Get Livebots Python Class

We have a respository for the pyhon code we use to control the robots, you can find it here: https://bitbucket.org/XicoMBD/livebots

In order to use it to control your own robot just follow this steps:

1. Download livebots.py from the repository and save it somewhere convenient

2. Open the terminal window and navigate to the folder where you saved the class
cd ..

3. Run python:
python

4. Import the library:
>>>from livebots import *

5. Create the livebot (Enter the Livebot number on the first field and the serial port name on the second):
>>>livebot('9','/dev/ttyACM0')

Step 5: Get the Webcam Streamer for Raspberry Pi

To stream the webcam video using raspberry pi, mjpg-streamer should be the best option: http://sourceforge.net/apps/mediawiki/mjpg-streamer/

I
n order to install it on your pi follow the steps:
1. Install subversion:
sudo apt-get update
sudo apt-get install subversion

2. Go to the folder where you want to have the mjpg-stremer, for example /home/pi
cd /home/pi

3. Get mjpg-streamer:
svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer

4. Install libjpeg8-dev
sudo apt-get install libjpeg8-dev

5. Install ImageMagick
sudo apt-get install imagemagick

6. Make the project:
cd mjpg-streamer/mjpg-streamer
make

7. When it finishes you should be ready to start streaming your video. To do so, enter the following command:
./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"

8. Now you should be able to view the stream from other computer on your network. Open a web browser and open the following link:
http://{name or IP-address of the Raspi}:8080

9. However, to let the stream be viewed from outsite your network you will need to port forward your router. This varies from router to router, so please search on google how to do it on yours.


For more information go here: http://wolfpaulus.com/journal/embedded/raspberrypi_webcam

Step 6: Put the Stream on Livebots and Setup the Control Mode

If you're using mjpg-streamer select it on the Stream Mode combobox and paste your URL on the Stream URL textbox (for example: http://79.169.49.122:8090)

The you can choose your control mode. If you go for the Buttons, select it on the Control Mode combobox and add your buttons content on table.

If you want color on the buttons add one of the following tags to the cell:
  • #Green
  • #Red
  • #Blue
  • #Orange
Uncheck the Is Draft box, check the LIVE box and it's done!

Now your robot will appear on the robots list and on the front page.

Step 7: Have Fun!

Comments

author
Raphango made it! (author)2013-10-16

Whoa! Pretty nice man! =D
Is there any way of controlling te Arduino by USB over the internet? Actually, I don't have a RapberryPi...

author
nerd7473 made it! (author)nerd74732014-03-12

you need a pi if you like Linux I am running raspbian wheezy (similar to Debian)

author
Raphango made it! (author)Raphango2014-03-12

ok thank you!

author
nerd7473 made it! (author)nerd74732014-03-12

you're welcome

author
TSJWang made it! (author)TSJWang2014-01-03

Haha this is a late reply.
Use the ethernet shield. It's not USB, but you can control it without another computer.

author
Raphango made it! (author)Raphango2014-03-12

And this is a late thank you! ^^

author
Raphango made it! (author)Raphango2014-01-10

Ok then,gotta try it someday. Thank you!

author
supra_2009 made it! (author)2013-09-09

in step 6'
6. Make the project:
cd mjpg-streamer/mjpg-streamer

And i got error:
pi@raspberrypi ~ $ cd mjpg-streamer/mjpg-streamer
bash: cd: mjpg-streamer/mjpg-streamer: No such file or directory

I can only typed cd mjpg-streamer/
Then i went on to "make" and still getting error
pi@raspberrypi ~/mjpg-streamer $ make
make: *** No targets specified and no makefile found. Stop.

Can u help us to fix this problem?

author
XicoMBD made it! (author)XicoMBD2013-09-09

What happens when you type ls?

author
DGaley made it! (author)DGaley2013-12-27

I'm having the same issue as supra_2009:
make: *** No targets specified and no makefile found. Stop.
If I type ls at the command line I get
index.html

author
supra_2009 made it! (author)supra_20092013-09-10

Does webcam driver has to be installed or not?

author
supra_2009 made it! (author)supra_20092013-09-09

Can I put step 1 into step 2 folder?

author
supra_2009 made it! (author)supra_20092013-09-09

pi@raspberrypi ~ $ cd mjpg-streamer
pi@raspberrypi ~/mjpg-streamer $ ls
input_file.so mjpg-streamer.sh output_file.so
input_uvc.so mjpg-streamer.sh.orig output_http.so
mjpg-streamer.log mjpg_streamer output_udp.so

author
beverageexpert made it! (author)2013-09-04

this worked great for me. Do you know how to have the cam start at boot?

author
supra_2009 made it! (author)supra_20092013-09-10

Do u installed webcam driver?

author
XicoMBD made it! (author)XicoMBD2013-09-09

Try to adapt this tutorial maybe:http://www.raspberrypi-spy.co.uk/2013/07/running-a-python-script-at-boot-using-cron/

author
ilikemysocks made it! (author)2013-09-02

This is the best bit of info I have found on this.Thank you.

The repository has moved though. It can be found at https://svn.code.sf.net/p/mjpg-streamer/code/

I also found this page useful to get mjpg-streamer running at boot.
http://www.rudiswiki.de/wiki/DockStarWebCamStream

author
ilikemysocks made it! (author)2013-09-02

This is the best bit of info I have found on this. Thank you.

The repository has moved though it can be found at https://svn.code.sf.net/p/mjpg-streamer/code/

I also found this page useful to get mjpg-streamer running on boot.

author
TheRafMan made it! (author)2013-07-31

Nice project. I came across your Instructable after I Googled how to install mjpg-streamer and your instructions worked perfectly, thank you for detailing it step by step.
Off to work on my version of telepresence :)

author
saitomaster made it! (author)2013-04-25

Very usefull. See more about creating sites http://saitomaster.com

author
Denon made it! (author)2013-03-24

Just had a go with the one with rolling eyes, great fun. Will there be an instructable for puppet bob one day?

author
XicoMBD made it! (author)XicoMBD2013-03-24

I didn't think it was necessary, you just need to print it (http://www.thingiverse.com/thing:43708), mount it, connect to an arduino and add it to Livebots how it is described here :-)

author
odvratno.zgodan made it! (author)2013-03-15

Hello,
let me start by saying this is a great projects! I've been doing some work with a similar concept for a few years already. If you're interested you can check out my old instructable at https://www.instructables.com/id/Arduino-Candygrabber/ . In the last few months I have begun to work on the project again. This time I did everything in Red5(the queue and the shared objects).
I'm interested which technology you used for Livebots? Of course, if you can share that info.

author
XicoMBD made it! (author)XicoMBD2013-03-15

Awesome work! For Livebots we used ASP.NET Razor, but basically when someone clicks the button we just create a html file that replaces the previous, like for example on http://livebots.cc/Robot/Message/23.html

Don't you want to add your project to Livebots?

author
odvratno.zgodan made it! (author)odvratno.zgodan2013-03-16

Nice, well it could be useful for some projects in my hacklab, though not for my project as I need very fast response time(under 100ms) and streaming video. Have you tested what is the speed/time it takes from somebody clicking a button in the browser until the command gets to the robot?
In my last iteration I'm writing a Java program for RaspberryPi that would connect to the red5 server directly, and allow it to control it's GPIO pins.

author
XicoMBD made it! (author)XicoMBD2013-03-16

I've never tested it properly but should be around 1 second.

However, the controls can be inside an iframe, so you can use whatever you want.

Looking forward to your hacklab projects there ;-)

author
Michael_Bell made it! (author)2013-03-11

Would it be possible to host the livebots code on our own personal domain?

author
XicoMBD made it! (author)XicoMBD2013-03-11

I'm not sure if I understood your question...

You can have your controls on Livebots from your domain using an iframe. Is that what you want?

author
Michael_Bell made it! (author)Michael_Bell2013-03-14

Yes, I suppose that would work

author
jupli1 made it! (author)2013-03-12

That's extraordinary ..Man!!! really cool stuff

author
ProbioticSoundsystem made it! (author)2013-03-08

this is so crazy cool!

author
andreyeurope made it! (author)2013-03-08

By the way, I think it would be very funny if you make a maze.

author
XicoMBD made it! (author)XicoMBD2013-03-08

That's one of the ideas I had, the problem is that I'm out of time for that, so I was willing that someone would do that instead of me. Are you up to the challenge? ;-)

If you any more ideas for new robots you can share them and vote for others here: http://livebots.cc/ideas 

author
alvin_lee made it! (author)2013-03-08

Man, this is sooooooooooo cool!

p.s.: It's very funny to see that robot dancing like crazy a min after I have the link of this page sent to a friend.

author
andreyeurope made it! (author)2013-03-08

nice job, man!!

author
GarthBock made it! (author)2013-03-07

Awesome job ! I remember years ago a university that had a small bulldozer in a sandbox you could control over the internet. That was way before webcams and Arduinos and easier ways to do it like we have now. I had a lot of fun playing with it during breaktimes. Thought it would be fun to set up something like that. I can't wait to see how far this can go .

author
droid_mechanic made it! (author)2013-02-07

That is EXTREMELY awesome. I am in awe. The interface is sleek and embeddable (is that a word?). I shall endeavor to follow this tutorial, though it may be difficult. I am in college and must conform to our network firewall.

author
XicoMBD made it! (author)XicoMBD2013-02-07

Glad you enjoyed it!

Yes, getting access to the mjpg stream through the firewall might be difficult. Although you can try to use services like UStream, Bambuser, Hangouts on Air, etc...

Hope to see your bot online soon! ;-)

author
theargha made it! (author)2013-02-06

Which operating system do u use ?

author
XicoMBD made it! (author)XicoMBD2013-02-06

On the raspberry I tried both with the Raspian Wheezy and the Adafruit's Occidentallis and the process was the same :-)

We've also tested the python class in Windows, OSX, Ubuntu and Linux Mint and it worked everywhere.

About This Instructable

98,632views

183favorites

Bio: Hi, My name is Francisco Dias and I'm a student from Lisbon, Portugal. Have a look at my website: http://franciscodias.net/
More by XicoMBD:Create an internet controlled robot using LivebotsArduino controlled Ping Pong Balls LauncherBuild a USB Orange Thrower Machine
Add instructable to: