Cheap Telepresence Robot


DIY Internet Connected Robot

Telepresence robots allow you to move around and interact with people who are in a totally different location to you. Basically teleporting you somewhere else. This tutorial will shows you how to use a Smartibot (cost £55) as a simple telepresence robot, using a smartphone (mounted on the robot) to handle a video call, and a computer to relay the control commands, sent over the internet using a simple webapp. There are some fantastic specifically designed telepresence robots available commercially, for example from Double Robotics, but they run into the thousands of dollars, so this is a much cheaper way to get a similar effect. 

Looping video of a smartphone on a cardboard robot chassis displaying a man's face. Both the man and the robot are wiggling from side to side.

Telepresence MVP

This example is very much the 'minimum viable product' of telepresence using Smartibot, as we wanted to get something out there, that anyone who has a Smartibot can use, as quickly as possible. If people find this useful we may be able to intergrade the receiver functionality into the Smartibot app, meaning the computer is not required to act as the receiver. If that would be useful to you please let us know on Twitter, Instagram or Facebook, or in the Smartibot Reddit forum.

Diagram showing the elements of the Smartibot telepresence set-up described below

Programming the robot for Telepresence

We need to start by loading some code onto the Smartibot to set it up for telepresence. As all the control instructions will be sent over the internet, there will probably be some delay between the user sending a command and the robot moving (latency). Because of this we want the robot to move in steps each time it receives a command, rather than keep moving until it receives another command to stop (as it does when it is controlled from the Smartibot app). The code below makes that happen and sets up some simple commands that can be sent from the receiver webapp to move the Smartibot.

To load the code onto the Smartibot load the Espruino environment on your computer (Mac, Linux, Chrome OS or Windows 10) or Android device in Chrome from this URL:

https://espruino.github.io/EspruinoWebIDE/?settings={%22BLOCKLY_EXTENSIONS%22:%22|smartibot|%22}

Copy the code below and paste into into the large box on the left hand side of the screen (replace any code that is already there):


var smarti = require("Smartibot");
var counting = false;
var count = 0;
var step = 2;

function go(drive){
if (drive == "B"){
 smarti.setLEDs([0,0,50],[0,0,50]);
 smarti.setMotor(1,0.7);
 smarti.setMotor(2,-0.7);
  step = 4;
 counting = true;
 }
 if (drive == "R"){
 smarti.setLEDs([50,0,50],[60,0,50]);
 smarti.setMotor(1,-0.6);
 smarti.setMotor(2,-0.6);
   step = 2;
 counting = true;

 
 }

  if (drive == "SR"){
 smarti.setLEDs([50,0,50],[60,0,50]);
  smarti.setMotor(1,-0.55);
 smarti.setMotor(2,-0.55);
   step = 1;
 counting = true;

 
 }
 if (drive == "L"){
 smarti.setLEDs([50,0,50],[50,0,50]);
 smarti.setMotor(1,0.6);
 smarti.setMotor(2,0.6);
   step = 2;
 counting = true;
 }
  if (drive == "SL"){
 smarti.setLEDs([50,0,50],[50,0,50]);
 smarti.setMotor(1,0.55);
 smarti.setMotor(2,0.55);
   step = 1;
 counting = true;
 }
 else if (drive == "F"){
 smarti.setLEDs([50,0,0],[50,0,0]);
 smarti.setMotor(1,-0.7);
 smarti.setMotor(2,0.7);
   step = 4;
 counting = true;
 }
 else if (drive == "S"){
 smarti.setLEDs([0,50,0],[0,50,0]);
 smarti.setMotor(1,0);
 smarti.setMotor(2,0);
 } 
}

setInterval(function() {
 if (counting == true){
 count = count + 1;
 }
 if (count > step){
 counting = false;
 count = 0;
 smarti.setMotor(1,0);
 smarti.setMotor(2,0);
 }
}, 50);

 

Switch on your Smartibot, connect to it using the button in the top right:

Button showing a plug and socket

choose WebBluetooth:

Pop up window titled 'SELECT A PORT...' showing an option called 'Web Bluetooth'

and then choose your Smartibot from the list when it appears:

Pop-up window titled 'espruino.github.io wants to pair' with a Smartibot showing as an option

Next send the code to the Smartibot by pressing the little button with a chip and an arrow in the centre of the screen:

Button showing an icon of a microchip with an up arrow on it

On the right hand side of the screen, in the text prompt, type:

save()

and press return.
Your Smartibot is now programmed!

Disconnect using the button at the top left.

Setting up your computer to receive telepresence commands and send to the robot

This example uses a service called PubNub to handle the transfer of the robot control commands between the user and the robot, over the internet. To make it work you need to register with PubNub for a free account and get your own subscribe and publish key. You can do that with the form below or over on the PubNub website:

Paste your keys into a note or text file as you will need them shortly, if you've lost them you can view them on the PubNub admin dashboard.

Next open the Smartibot Telepresence Receiver webapp:

https://thecraftyrobot.github.io/smartibot_telepresence_receiver/

Paste your PubNub subscriber key into the text box at the top and hit return. The WebBluetooth connection window should appear again and you should be able to connect to your Smartibot. You can test to make sure you are connected by pressing the buttons on the screen.

Connecting the telepresence user to the robot

Now your Smatibot is programmed and connected to the telepresence receiver it is time to get connected to the user, ie the person who will be present through the robot - who will be controlling it and who's face will appear (who may be on the other side of the world, but for initial testing could be in the next room).

Send the user the URL of the Smartibot Telepresence Controller webapp:

https://thecraftyrobot.github.io/smartibot_telepresence_controller/

along with your PubNub publish and subscribe keys.

Dial the user into a video call from the smartphone you intend to put on the Smartibot using your preferred service (eg FaceTime, WhatsApp Video Call, Hangouts, Zoom etc) and ask them to open the Webapp and paste in the keys. If everything is set up right they should be able to control your Smartibot straight away.

Pop your phone onto your Smartibot and attach with one of the elastic bands and your user should be fully autonomous.

If you've got them on a table be careful to make sure they don't drive off!

We've had fun building little worlds for people to teleport into and explore using toys and other household objects. We've also dialled the robot into a big group call on Zoom and given different participants turns controlling it.

If you want to make things simpler for your user and omit the need for them to paste in the PubNub keys you can download this html file, open it up with a text editor, paste your keys at the bottom, where shown, and then just email it to your user.

Thanks

Huge thanks to Dries De Roeck for suggesting we should use Smartibot as a telepresence platform over on Twitter and for testing this system, and also to Ryan White and Tom Stables for more testing and useful feedback.

0 comments

  • There are no comments yet. Be the first one to post a comment on this article!

Leave a comment

Please note, comments must be approved before they are published