How to Configure a SCUTTLE Robot with a Camera

Instructions for configuring a SCUTTLE Robot on the Viam platform.

Requirements

  • A Raspberry Pi with Raspberry Pi OS 64-bit Lite and the viam-server installed.

Refer to Installing Raspberry Pi OS on the Raspberry Pi, if necessary.

Start configuring your robot

  1. Go to the Viam app at https://app.viam.com.
  2. If you already created your robot in the app, navigate to its CONFIG tab and skip to Configuring the board.
  3. Create an Organization. If you already have an Organization, then this step is optional. If you need help with organizations and locations, see our guide to using the Viam app.
  4. Create a Location. If you already have a Location, then this step is optional.
  5. Create a robot and navigate to its CONFIG tab. We will stay in Builder mode for this tutorial (as opposed to Raw JSON).
  6. A screenshot of the Viam app UI showing the CONFIG tab of a robot.

Configuring the board

Add your first component, the board (in this case the Raspberry Pi).

  1. Enter a name for your board in the Name field. In this tutorial, we've named the board "local." As long as you're consistent, you can name the board whatever you want.
  2. Select the component Type, "board."
  3. Select "pi" from the Model drop-down.
  4. Click Create Component and the board component panel will expand. We don't need to worry about any other attributes for this component.
  5. Screenshot of the component configuration panel for a board component. The name (local), type (board) and model (pi) are shown at the top of the panel. No other attributes are configured.

Configuring the motors

Adding the right motor

The next step is to add a motor and make it spin a wheel.

  1. Begin by adding the right motor, naming the component "right".
  2. Select "motor" from the Type drop-down.
  3. Select "gpio" from the Model drop-down.
  4. Click Create Component, which will generate the motor component panel.
  5. Then select local from the Board drop-down (since the motor is wired to the Raspberry Pi named "local").
  6. Set Max RPM to 100.
  7. Next, you'll need to describe how the motor is wired to the Pi:
    1. Switch the Component Pin Assignment Type to In1/In2.
    2. Set A/In1 to 16.
    3. Set B/In2 to 15.
    4. Leave the pwm (pulse-width modulation) pin blank, because this specific motor driver’s configuration does not require a separate PWM pin.
Screenshot of the motor config panel with the attributes set as described above.

Click to view the raw JSON for the right motor

Testing the motor configuration

Having configured a board and a motor component, you can now actuate your motor. Save the config by clicking SAVE CONFIG at the bottom of the page, then click over to the CONTROL tab.

Here you’ll see a panel for the right motor. You’ll use this panel to set the motor’s power level.

Power level adjustment

Be careful when activating your robot! Start with the power level set to 10% and increase it incrementally until the wheel rotates at a reasonable speed, clicking Run at each increment.

At this point, the right-side wheel should be working.

Adding the left motor

Now, you’re ready to add the left-side motor. This will be very similar to adding the right motor.

  1. Name the component "left".
  2. Select "motor" from the Type drop-down.
  3. Select "gpio" from the Model drop-down.
  4. Click Create Component.
  5. Select local from the Board drop-down.
  6. Set the Max RPM attribute to 100.
  7. Configure the motor's pins:
    1. Switch the Component Pin Assignment Type to In1/In2.
    2. Set A/In1 to 12.
    3. Set B/In2 to 11.

Click to view the raw JSON for the left motor

With both motors configured, the CONTROL tab now display panels for both motors:

Motor panels

Viam (https://app.viam.com) displays component panels in order of their creation. Don’t worry if your motor panels are not adjacent.

Configuring the base

It’s time to configure a base component, which describes the geometry of your chassis and wheels so that the software can calculate how to steer the rover in a coordinated way. Configuring a base component will give you a nice UI for moving the rover around.

From the CONFIG tab:

  1. Give your base a name.

  2. Enter “base” in Type.

  3. Enter “wheeled” in Model.

  4. In the Right Motors drop-down select “right.”

  5. In the Left Motors drop-down select “left.”

  6. Enter “400” in width_mm (measured between the midpoints of the wheels).

  7. Enter “250” in wheel_circumference_mm.

    The left and right attributes represent the motors corresponding to the left and right sides of the rover. Since we named the motors “left” and “right”, you can simply add “left” and “right” between the brackets for your set of motors, respectively.

The attributes of your base component’s config should look something like this:

{
 "width_mm": 400,
 "wheel_circumference_mm": 250,
 "left": ["left"],
 "right": ["right"]
}

When you save the config and switch to the CONTROL tab, you’ll see new control buttons for the base. In the Keyboard tab, toggle your keyboard control to active. Use W and S to go forward and back, and A and D to arc and spin.

WASD controls

If you click the Discrete tab, then you’ll see different movement modes such as Straight and Spin; and different movement types such as Continuous and Discrete and directions such as Forwards and Backwards.

Discrete controls

Now you have a rover that you can drive using Viam’s UI! Awesome!

Try driving your SCUTTLE Robot around using the WASD keyboard controls described above.

Configuring the camera

Finally, we’ll add a camera to your SCUTTLE Robot.

  1. Enter a name of your choice in Name.
  2. Enter “camera” in Model.
  3. Click Create Component.

Now, you’ll see the config panel for the camera component: Camera component config panel

On the camera config panel, set the video_path. This is often “video0,” but please see our camera configuration tutorial for more information on choosing the correct video path.

Once you save the config, you’ll be able to see your camera’s stream in the CONTROL tab.

On completion

After successfully completing this tutorial, you have a fully configured SCUTTLE robot. You can drive it around and view its camera stream.

To take things to the next level, check out our Color Detection with SCUTTLE Robot tutorial or create your own camera-related tutorial. Alternatively, you can check out our Bluetooth Gamepad For SCUTTLE tutorial or our Line Follower Robot tutorial.

Documents referenced