# Build a simple, useful, and affordable outdoor rover

**Matt Vella**  
Developer Relations

Approaching robotics can be daunting. Many of us who have tried have ended up with empty wallets, life to catch up on, and spare parts in our closets. Some of us have had some success starting with robotic kits or learning robots. You know - the ones that are fairly easy to get up and running, but ultimately are expensive toys? In my humble opinion, these robots are somewhat missing the point: people want to create robots _that_ _do real things, that solve real-life problems_. What to do? Well, you _can_ certainly purchase a very capable outdoor robotic rover for upwards of 12 thousand dollars. It will still be hard to learn how to expand and program it, but it’s at least capable, right?

Fortunately I work at Viam, where we are building a platform that makes robotics and robotic automation approachable, and therefore much easier to build useful robots. Now, when I am an employee at _any_ company one of the most important things is that I truly believe in the product. Therefore, I challenged myself with the following proof: _“Can I build a weatherproof, outdoor rover that is capable of doing useful things for under $500?”_

**Good news: the answer is yes, and it can be done in less than a day.**

## Overall Boxbot design

The success of this project was based on two key factors:

1. Hoverboard hub motors are sealed and waterproof, can carry a good payload, are capable of navigating outdoor terrain like gravel and grass, and are somewhat readily available.
2. Pelican-style plastic boxes are not only able to protect your electronics against the elements, but are also sturdy enough for hub motors to be directly bolted on, and able to carry additional payload on top.

## Parts list for your Boxbot

Some of the equipment listed here is optional. For example, you might not need a night-vision camera if you won’t operate it at night and you will not need a solar panel and charge controller if you plan on using your rover occasionally and charging it in-between.

- 1 x [Weatherproof plastic case](https://www.alibaba.com/product-detail/Waterproof-Foam-Pu-eva-epe-xpe_1600097495864.html) ($30.50): This is the key to protecting your electronics and holding the robot together. Make sure it is a thick, strong plastic and can fit the solar panel mounted on top. Finally, get one with adjustable foam inside - this is very handy for cushioning your electronic components.
- 1 x [Night vision camera](https://www.amazon.com/gp/product/B07C1N9R4Z) ($40): Night vision is optional, but a webcam of some sort is highly recommended.
- 1 x Raspberry Pi 3B or 4B or 5 with microSD card ($100): Note: Due to supply shortages, Raspberry Pi prices are fluctuating dramatically.
- 1 x [12V Battery](https://www.amazon.com/LiFePO4-Battery-Miady-Rechargeable-Maintenance-Free/dp/B089VXSBC6) ($65): Lots of options here - some motors might run better on 24V. You can use a battery with less storage if you don’t plan to run it continuously.
- 2 x [Brushless hub motor wheels](https://www.alibaba.com/product-detail/Electric-Wheel-Hoverboard-DC-Hub-6_60615157026.html) (2 x $30 = $60): Better yet - source them from a used [hoverboard](https://www.amazon.com/RIDE-SWFT-Hoverboard-Balancing-Front-Facing/dp/B08N5DSVY3) (this is what I did).
- 1 x [USB Gmouse GPS module](https://www.amazon.com/Navigation-External-Receiver-Raspberry-Geekstory/dp/B078Y52FGQ) ($20): optional
- 1 x [Solar charge controller](https://www.amazon.com/Renogy-Wanderer-Amp-12V-24V/dp/B07NPDWZJ7) ($20): optional
- 1 x [25w Solar panel](https://www.alibaba.com/product-detail/High-Efficiency-25W-Polycrystalline-Crystalline-Solar_60814369754.html) ($10): optional
- 1 x [12V to 5V DC USB Type-C Right Angle Step-Down Power Converter](https://www.amazon.com/gp/product/B086KTGRH1/) ($13.50): To power the Pi from a 12V battery.
- 2 x [Brushless motor controller](https://www.amazon.com/RioRand-6-60V-Brushless-Electric-Controller/dp/B087M2378D)(2x $18 = $36)
- 2 x [Caster wheel](https://www.harborfreight.com/3-inch-x-3-4-quarter-inch-stem-swivel-caster-90997.html) (2x $5 = $10)
- 1 x Galvanized nuts/bolts, water sealing epoxy or caulk, washers, misc wires, brackets, etc ($15): Bolts are for mounting your hub motors and other components.

You’ll also need some basic tools:

- Screwdrivers
- Drill
- Drill bits
- Socket or combination wrenches
- Hack saw
- Soldering iron and solder

## Build the base of your Boxbot

Next, you’ll mount the caster wheels to the “front” of the box and the hub motors to the rear. For the hub motor mounts, drill two holes through each mount, line each one up, then drill through these holes into the bottom of the plastic case. While doing this I realized that I’d also want to run the wires from the hub motor into the case under the mount. To attach the hub motors, use galvanized carriage bolts with washers inserted from the inside of the case out to the bottom, then put the bolts through the mounts, add washers and nuts and tighten securely.

Now could be a good time to attach a camera in a similar way to how you attached the wheels, but through the top of the case.

## Wire it up

### Brushless motor controllers

Be sure to buy motor controllers that are built specifically for brushless motors. This is imperative because brushless DC motors (BLDC for short) have a tradeoff: while they and their controllers are more expensive and complicated to set up, they are more reliable and durable.

Let’s get to it.  The procedure for each side will look like:

1. Solder motor controller
2. Wire the hub motor to the motor controller
3. Wire the battery to the motor controller
4. Test controlling the motor with the motor controller potentiometer
5. Wire to the Raspberry Pi

Next, add wires to the VCC and ground terminals below the motor phase wires - this will supply power to your motor. **CAUTION:** Be sure your base is on its side or otherwise supported so the wheels are free-spinning before attaching the battery!

### Organize the wires and components

Now might be the time to figure out where you’re laying everything out inside your case. You’ll need a space for your already wired motor controllers, battery, Pi, and solar charge controller if you’re going to use solar charging.

### Connect the motor controllers to the Pi

Finally, you’ll want to connect the wires from the motor controller to the Pi.

## Bring your robot to life

### Viam config overview

First, let’s install [viam-server](https://docs.viam.com/get-started/installation/prepare/rpi-setup/) on your Pi. It should only take a few minutes and once you’re done, you’re ready to configure your robot.

### Setting up our Boxbot config using the Viam app

#### Board component

Navigate to the **CONFIGURE** tab of your machine’s page in [the Viam app](https://app.viam.com/).

#### Motor component

Next, create another component of type “motor”, model “gpio”. Call it “left” to represent the motor on the left side of your rover. Repeat for the “right” - make sure you’re mapping the correct GPIO pins for each.

### Base component

Now, let’s configure a [“base” component](https://docs.viam.com/components/base/wheeled/) that references both of our motors. This will allow us to control our robot’s movement through a single interface.

## Take your Boxbot for a drive

You can now have some real fun. Try driving your rover by keyboard, programmatically, or use a [color detector](https://docs.viam.com/tutorials/services/try-viam-color-detection/) to interact with the environment.

I had a lot of fun building this rover, and hope you did as well.
