Let's Robot

Welcome to the Let's Robot network. You'll find comprehensive guides and documentation to help you start working with Let's Robot as quickly as possible, as well as support if you get stuck. Let's jump right in!

Connect a Robot to LetsRobot.tv

Uplink to Skynet

Initializing and Setting up the Raspberry Pi

The brain of your robot is the Raspberry Pi, it connects everything to LetsRobot.tv and runs all of the hardware. The first step is to set up your Pi.

Flash a MicroSD Card

Start by flashing an 8GB microSD card on your PC or Mac. You will need a micro SD card reader, or an adapter and a standard SD card reader.

Download Etcher and flash an 8GB (or more) micro SD card with the Raspian Stretch Lite disk image (.img file). You can also do it manually.

For these instructions we are using the non GUI (Graphical User Interface) and instead setting things up using the command line. The reason for this is so that you begin to familiarize yourself with programming and navigating the brain of your robot this way. There are many ways to do this part but learning to navigate the terminal and command line will be important for your learning process.

Connect to your Raspberry Pi

If it is your first time with a Raspberry Pi you should connect an HDMI monitor and keyboard as well as power the Pi with a quality micro USB cord with a power supply that is providing 5V and at least 2.0 amps. The official Raspberry Pi power supply provides 5V 2.5 amps.

Raspberry Pi Power Requirements

One of the major issues most robot builders come across is poor quality USB Power packs and USB cables. Many batteries will not actually provide the amperage they say they are rated for. The Raspberry Pi should optimally be run at a steady 5V 2.4amps.

Common Raspberry Pi Commands

Welcome to Linux, here are the basics of understanding common commands

Your first prompt will be the login

Username: pi
Password: raspberry

Set Up your Raspberry Pi using raspi-config

Enter raspi-config by entering the following at the command prompt:

sudo raspi-config

Commands line prompts

The above format will be used whenever there is a command to enter at the command line prompt. Simply copy and paste this into the command line prompt.

Setup Locale, Timezone, and Wifi Country
As soon as you start raspi-config it will prompt you to set these.

Change your password!

This is very important as others can break into your network simply by using your robot as the gateway.

If that fails to connect try these instructions.

Network Options

Add your wifi SSID and Password

Enable SSH in Interfacing Options

You will want to be able to connect to your robot using your computer (if for no other reason to copy and paste the command line instructions to avoid typos)

You may want to also enable I2C here if you plan on using the Adafruit Motor Hat

Exit the Raspi-config and reboot

To exit use your right arrow key to move and select <Back> , hit enter.
Then do the same thing to select the <Finish>

Reboot the Pi

Type the following into the command prompt:

sudo reboot

When you reboot to the command line your IP address should be shown in the last few messages before the login prompt. Write it down.

Switch over to your computer on the same Wifi network.

Open the Terminal program on your PC or Mac.

ssh pi@YOUR-PI-IPADDRESS

Then enter your login:

username: pi 
password: the new password you just set

You can now copy and paste all of the commands below into the terminal instead of typing them arduously line by line.

Update your Raspberry Pi

sudo apt-get update

Install ffmpeg and other software needed to run our code.

Make sure you don’t get any errors in the console when doing the step below. If you have an issue, you can run this line again, and that will usually fix it!

sudo apt-get install ffmpeg python-serial python-dev libgnutls28-dev espeak python-smbus python-pip git

Download the Let’s Robot / Run My Robot software from our github

git clone https://github.com/runmyrobot/runmyrobot

Go into the /runmyrobot directory

cd runmyrobot

Install requirements

sudo python -m pip install -r requirements.txt

Create A Robot on Your LetsRobot.tv Account

Load LetsRobot.tv and select sign up / log in on the upper right of the page.

Login or create an account

Login or create an account

Navigate to your profile and click + Add a new Robot!

Navigate to your profile and click + Add a new Robot!

Now edit your new robot.

Now edit your new robot.

Fill out the Name and Description, then select the recommended resolution (if using the C920).

Fill out the Name and Description, then select the recommended resolution (if using the C920).

Enter a Stream Key and **BE SURE TO SAVE**

Enter a Stream Key and BE SURE TO SAVE

Options & Toggles

Robot ID

Write this down, you'll need it!

Camera ID

Write this down also.

Choose File Button

Click this to upload a picture of your robot.

submit

Click this after you upload a picture of your robot.

Robot Page Link

This link will allow you to access your robot page if it is set to private.

Robot Setup Page Link

Bookmark this for a quick way to get back here.

Robot Name

Your robot's display name.

Robot Description

A small description that appears below your robot name

Wifi Name

Sorry this feature is not enabled

Wifi Password

Sorry this feature is not enabled

Video Resolution

640 x 480 - Lowest resolution setting common for cheaper webcams
768 x 432 - Recommended mainly for the C920 Logitech webcam
1280 x 720 - Not recommended as it usually doesn't work with most webcams.

Stream Key

This is your private key that will be added in your start_robot file later and will connect your send_video.py script to your LetsRobot.tv profile. Keep this private for security.

Streamlabs Donation Widget Url

Add your Streamlabs info for donations through Streamlabs. This is optional.

public

Your robot will be listed publicly or available only using your Robot Page Link.

anonymous control

Allows anonymous users to control your robot.

profanity filter

Filters some profanity

global chat

Connects your robot to all the other robots chat or keeps your robot users chatting only on your robot(s).

show exclusive control button

Sorry this feature is not enabled

mute text-to-speech

Turns on/off the trigger for TTS on your robot.

mic enabled

Turns on/off the mic on your robot

dev mode

Enables only you to be able to control your robot.

custom panels

Enables additional function or features buttons on the robot control user interface.

Save Robot Settings

DON'T FORGET TO SAVE!!!!!

Setting up your start_robot file on the Raspberry Pi

Back on the Pi once you have accessed it by SSH again, copy the start_robot script to your home directory.

cp ~/runmyrobot/scripts/start_robot ~

You will need to edit start_robot in order to sync it with your robot:

nano ~/start_robot

Once you open it up, it will look something like this:

#!/bin/bash
# suggested use for this:
# (1) Put in the id's for your robot, YOURROBOTID and YOURCAMERAID
# (2) use sudo to create a crontab entry: @reboot /bin/bash /home/pi/start_robot

cd /home/pi/runmyrobot
nohup scripts/repeat_start python controller.py YOURROBOTID &> /dev/null &
nohup scripts/repeat_start python send_video.py YOURCAMERAID 0 &> /dev/null &

Nano

You are using the linux text editor "nano". It does not recognize your mouse so you will need to use your arrow keys to navigate with the cursor.

Commands:
To Save: Cntrl + O Then Press Enter
To Exit: Cntrl + X

You will need to replace “YOURROBOTID” and “YOURCAMERAID” with the numbers generated from the site for your robot. You also need to add your stream key. If you haven’t done that step, go to your letsrobot.tv profile and add a robot (Be sure to click the SAVE button).

Move your cursor to the bottom and delete/backspace everything in this file. Copy and Paste the following:

#!/bin/bash
# suggested use for this:
# (1) Put in the id's for your robot, YOURROBOTID and YOURCAMERAID
# (2) use sudo to create a crontab entry: @reboot /bin/bash /home/pi/start_robot
#

cd /home/pi/runmyrobot
nohup scripts/repeat_start python controller.py YOURROBOTID --type none --filter-url-tts --tts-volume 80 --female --voice 1 &> /dev/null &
nohup scripts/repeat_start python send_video.py YOURCAMERAID 0 --stream-key YOURSTREAMKEY --audio-device-name C920 --pipe-audio --mic-channels 2 &> /dev/null &

This has all the arguments (--ARGUMENT <variable>) to set up the a bot with the C920 camera with onboard stereo mic and the USB speaker. This disables the motor controller. You'll change the --type <argument> to the correct motor controller or serial input command.

In order to exit the nano editor, control + x

Once you have your start_robot file filled in appropriately to have it run on startup run the following:


crontab -e

Note: If you accidently use the wrong editor try

EDITOR=nano crontab -e

and insert the following text at the bottom

@reboot /bin/bash /home/pi/start_robot

Example:

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command

@reboot /bin/bash /home/pi/start_robot

Now just plug in the Camera and USB Speaker and reboot

sudo reboot

Hopefully you’ll hear your robot say “OK” and everything will be working!

If not, it is time to checking the Technical FAQ and Troubleshooting Tips. Also drop in to our Discord Channel and ask for help.