If you've received your Marty after 2020 it's likely you have a version 2!
Getting started with your Pi
**//Note://** This guide assumes a cursory knowledge of Linux.
Connection diagram for a Rick and a RaspberryPi
A Raspberry Pi is a miniature, single-board computer originally developed as a means to encourage programming and computer science education. Owing to it’s small size, price and great feature set, adding a Raspberry Pi to your Marty can greatly expand your robot’s capabilities. Effectively, your Marty becomes a full fledged computer, and this boost in computing power can be leveraged to let your Marty do some pretty advanced things. Take a look at the amazing Robot Operating System (ROS) and some of our work using it, such as gamepad control, face, eyes and smile tracking using a camera, and even robot football.
Flashing a Pi image
We have a pre-built image for a RaspberryPi available with ROS and a bunch of other programming tools already installed to use with Marty. You can download it here:
For information on how to flash an image onto an SD card, the official RaspberryPi install instructions cover the topic well.
Note that these are images that we've made a bunch of changes to, so they might be a bit behind on the most recent updates. There are also some configuration differences, for instance, bluetooth is disabled as unfortunately using it and the UART/Serial on the Pi at the same time results in glitchy, poor performance.
Configuring a Pi from scratch
If you don’t want to use our official Raspbian image, then it is possible to get up and running from scratch, though this is only advisable if you are an experienced user.
A step-by-step breakdown of this is outwith the scope of this getting started guide, though the individual steps are well documented elsewhere on the web.
Main required components:
- Install the latest version of Raspbian Jessie.
- Install ROS. Currently only Indigo is officially supported, your mileage with other ROS distros may vary.
- Install Marty specific dependencies on to your Pi
Installing a Raspberry Pi in Marty’s Head
Marty’s head has mounting holes and a slot behind Rick designed to accommodate a Raspberry Pi (Pi 2, Pi 3 or Zero). You can use two space M2.5 machine screws and nuts to affix the Pi.
If you’ve got access to a 3D printer, we also have a mount designed for the Raspberry Pi Camera to poke through the mouth. Carefully tuck and fold the Pi camera cable under Rick to connect it.
Check Figure 1 above for how to connect a Pi to Rick, this will also power the Pi so you don’t need a Micro USB cable as well! Be careful to insulate the top of the ethernet port on the Pi, using electrical tape or something similar, as ther small JTAG pin header on Rick can short out on it if they touch.
Because the Raspberry Pi is now also being powered, your Marty’s battery life will be shorter - you can upgrade the battery to a bigger capacity one, which you can find on RC Aircraft & Hobby sites. Just be careful to check the specs to ensure any different battery won’t be dangerous and damage your Marty. Depending on the type of battery you select, you might also need an external charger, and it might also be unsafe to use Rick’s built-in charger.
Network setup
Note on WiFi:
If you have a Pi older than a Pi 3 Model B, i.e, without built in Wi-Fi, then you will have to skip the SSH part for now. You can follow the steps after but you will have to plug your Pi in to a monitor as well as use a USB keyboard.
This is because the Model B has built in Wi-Fi, and paired with a USB dongle, will enable the Pi to broadcast it’s own hotspot, as well as connect to another network. After you’ve completed your network configuration, you can SSH into it,as it will be connected to the same network as your computer.
SSH
In order to configure Marty for first time use, a way to input commands must be established. The simplest way would be to connect a USB keyboard and a HDMI monitor to the Pi and physically type commands in. However, this is impractical for anything other than temporary work, especially if Marty is moving around.
A better solution would be to take advantage of being able to remotely access the shell (command line) from another computer over your network. This can be achieved through the Secure Shell (SSH) protocol.
Most Linux distros and OSX versions come with SSH pre-installed, though unfortunately a third-party client like PuTTY will be required for Windows. The next steps assume your’re using Linux, and the steps will be very will be similar for OSX too. For Windows they may vary dependent on your SSH client.
On your computer, connect to the wifi hotspot generated by Marty. Open a terminal and ssh into your Marty:
ssh pi@marty.local
This will then prompt you with a password, which is marty.
You may be prompted to confirm the authenticity of the host, in this case just confirm it with a yes.
For those who are unfamiliar with ssh, you have formed a connection from your computer to the Raspberry Pi within Marty and in effect, are in total control. You can confirm this by looking at the user prompt within the terminal, it should read pi@marty. Any commands entered into this terminal, will be equivalent to entering them a terminal on the Pi itself.
Network configuration
Now, we need to give the Pi your network information. Enter the following:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
This will bring up the nano text editor in your terminal and here you will add your network info in the format below:
network={
ssid="your-network"
psk="your-network-password"
key_mgmt=protocol
}
Where your-network and your-network-password are the name of your network and your network’s password. The quotation marks are required. Finally, protocol is the security protocol of your network, commonly this is WPA-PSK. Ensure that this network is the same as the one your computer is on.
When finished, save, quit and restart your Marty.
On reboot, Marty should automatically connect to your network.
To double check, use an IP scanning tool such as AngryIP and see if your Marty is present on the network.
Next steps
Now, that the basics have been taken care of, the only limit is your imagination! With a Pi in Marty, you’ve unlocked a whole load of functionality!
See here for some technical documentation, and if you’re up for some more advanced stuff it, take a look at getting started with ROS.
Upgrades!
If you’re lucky enough to have access to a 3D Printer, you can also find a nifty mouth mount for a RPi camera here at the bottom of the page (a bit weird, I know….)
Having a RaspberryPi in the head will also increase the current draw of your Robot, and therefore reduce the battery life. However, you can upgrade your battery - most hobby RC LiPo batteries (Two Cell, 7.4v, ~2C and higher) will work in Marty. If you are changing the battery from the one we supply, remember you’re assuming full responsibility for its safety, and that we can’t guarantee the on-board charger will work with it. Always follow the battery manufacturer’s advice and safety guidelines. See also Robotical Hardware Tech Specs
A Word of Warning
A general rule of thumb is that as things become more advanced, so too do the ways of “breaking” things within your Marty. Please exercise caution when changing system level stuff within your Pi, and when playing around with hardware! If all is lost, you can always re-flash a fresh image.