> ## Documentation Index
> Fetch the complete documentation index at: https://stem-docs.intellectualpoint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect via SSH

> Open a terminal on your laptop, SSH into your robot over WiFi, verify the connection, and run the setup script to install all required software.

## Connect to your robot and install software

<Info>
  **Time**: 10:40 AM to 11:10 AM
</Info>

Your robot is now powered on and connected to WiFi. In this section, you will open a terminal on your laptop, connect to the Raspberry Pi remotely, and run a setup script that installs everything the robot needs.

### What is SSH?

SSH stands for **Secure Shell**. It lets you control another computer by typing text commands on your laptop. Instead of plugging a keyboard and monitor into the Raspberry Pi, you send commands over the WiFi network. Everything you type in your terminal gets executed on the robot.

Think of it like texting instructions to someone in another room — except the "someone" is your robot's computer.

### Find and open your terminal

A **terminal** (also called a command line) is a program where you type commands instead of clicking buttons. Every laptop has one built in.

<Tabs>
  <Tab title="Mac">
    1. Press **Cmd + Space** to open Spotlight search.
    2. Type **Terminal** and press **Enter**.
    3. A window with a dark or light background and a blinking cursor appears — this is your terminal.
  </Tab>

  <Tab title="Windows">
    1. Click the **Start** menu or press the **Windows key**.
    2. Type **PowerShell** and click **Windows PowerShell** when it appears.
    3. A blue window with a blinking cursor appears — this is your terminal.
  </Tab>
</Tabs>

<Tip>
  Keep this terminal window open for the rest of the camp. You will use it constantly.
</Tip>

### Verify the Pi is on the network

Before connecting, confirm that your laptop can see the robot on WiFi. Type this command and press **Enter**:

```bash theme={null}
ping picar.local
```

**What this does**: `ping` sends a tiny message to the robot and waits for a reply. If you get replies, the robot is on the network and reachable.

<Frame>
  <img src="https://mintcdn.com/intellectualpoint/xLJwHPVqdzG8quCt/images/day1-setup/31-ssh-connected.png?fit=max&auto=format&n=xLJwHPVqdzG8quCt&q=85&s=4afd325e9a5fb994b3e4bd470555789a" alt="Terminal showing successful ping responses from picar.local" width="1024" height="647" data-path="images/day1-setup/31-ssh-connected.png" />
</Frame>

You should see lines like `64 bytes from picar.local` repeating. Press **Ctrl + C** to stop the ping.

<Warning>
  **If ping fails** (you see "could not resolve host" or "request timed out"):

  1. Make sure your laptop is on the **same WiFi network** as the robot.
  2. The Pi may still be booting — wait 2 to 3 minutes and try again.
  3. If it still fails, ask a facilitator for help. They can check your Pi's connection from the router.
</Warning>

### SSH into the robot

Now you will connect to the robot. Type this command and press **Enter**:

```bash theme={null}
ssh car@picar.local
```

Here is what each part means:

* `ssh` — the command to start a secure connection
* `car` — the username on the Raspberry Pi
* `picar.local` — the hostname of your robot on the network

#### Accept the fingerprint

The first time you connect, you will see a security message like this:

<Frame>
  <img src="https://mintcdn.com/intellectualpoint/xLJwHPVqdzG8quCt/images/day1-setup/32-ssh-fingerprint-actual.png?fit=max&auto=format&n=xLJwHPVqdzG8quCt&q=85&s=e6113f3648e9046882db5c86ea01af45" alt="Terminal showing SSH fingerprint warning asking to continue connecting" width="1024" height="647" data-path="images/day1-setup/32-ssh-fingerprint-actual.png" />
</Frame>

This is normal. The terminal is asking if you trust this computer. Type **yes** and press **Enter**.

<Note>
  You only see this fingerprint question the first time. Future connections skip it.
</Note>

#### Enter your password

The terminal asks for a password. Type:

```
car
```

Then press **Enter**.

<Warning>
  **Nothing appears as you type the password** — no dots, no stars, no characters at all. This is normal terminal behavior for security. Type the password and press Enter even though the screen looks blank.
</Warning>

#### You are connected

After entering the password, your terminal prompt changes:

<Frame>
  <img src="https://mintcdn.com/intellectualpoint/xLJwHPVqdzG8quCt/images/day1-setup/33-ssh-connected-actual.png?fit=max&auto=format&n=xLJwHPVqdzG8quCt&q=85&s=e4dd6944c44d88fa4a19bf577def9899" alt="Terminal showing successful SSH login to the Raspberry Pi" width="1024" height="647" data-path="images/day1-setup/33-ssh-connected-actual.png" />
</Frame>

You now see something like:

```
car@picar:~ $
```

Here is what that prompt means:

* `car` — the user you are logged in as
* `picar` — the name of the computer (your robot)
* `~` — your current folder (the home directory)
* `$` — the terminal is ready for your next command

<Check>
  **You are now inside your robot.** Every command you type runs on the Raspberry Pi, not on your laptop.
</Check>

### Verify internet access

Confirm the robot can reach the internet. Run:

```bash theme={null}
ping google.com
```

You should see replies coming back. Press **Ctrl + C** to stop.

Next, check the robot's IP address:

```bash theme={null}
hostname -I
```

This prints a number like `192.168.1.42` — that is your robot's address on the WiFi network. Write it down as a backup in case `picar.local` stops working later.

### Clone the camp repo and run setup

The setup script installs all the software your robot needs: motor drivers, camera libraries, audio support, and more.

<Steps>
  <Step title="Clone the camp repository">
    Download all camp files onto the Pi:

    ```bash theme={null}
    git clone https://github.com/intellectual-point/robot-genai-camp.git ~/camp
    ```

    This creates a `~/camp` folder with all scripts organized by day.
  </Step>

  <Step title="Run the setup script">
    Run the script with administrator privileges:

    ```bash theme={null}
    cd ~/camp && sudo bash setup.sh
    ```

    **What `sudo` means**: `sudo` stands for "superuser do." Some software installations require administrator access — `sudo` gives the script permission to install system-level packages.

    <Warning>
      **This takes 15 to 20 minutes** on a Pi Zero 2 W. Do not close the terminal or disconnect from WiFi while it runs. You will see a lot of text scrolling by — this is normal.
    </Warning>
  </Step>

  <Step title="What the script installs">
    The script sets up everything your robot needs:

    * **robot-hat** — the hardware interface library
    * **vilib** — the camera and vision library
    * **picar-x** — the motor and servo control library
    * **espeak** — text-to-speech so the robot can talk
    * **I2S audio driver** — enables the onboard speaker and microphone

    You do not need to install any of these individually.
  </Step>

  <Step title="Reboot when prompted">
    At the end of the script, it asks if you want to reboot. Type **y** and press **Enter**.

    ```
    Do you want to reboot now? (y/n): y
    ```

    The connection drops — this is expected. The robot is restarting.
  </Step>

  <Step title="Reconnect after reboot">
    Wait about 60 seconds for the Pi to restart, then SSH back in:

    ```bash theme={null}
    ssh car@picar.local
    ```

    Enter the password `car` when prompted. You are back in.
  </Step>
</Steps>

<Check>
  **Setup complete.** Your robot now has all the software it needs for the rest of the camp.
</Check>

### WiFi troubleshooting

If you run into network issues at any point, work through this list:

| Problem                           | What to try                                                                                                      |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `ping picar.local` fails          | Confirm your laptop and the Pi are on the same WiFi network.                                                     |
| Pi does not appear on WiFi at all | The SSID or password entered during SD card setup may be wrong. You may need to re-flash the card.               |
| SSH connection refused            | The Pi may still be booting. Wait 2 to 3 minutes and try again.                                                  |
| SSH works but no internet         | The WiFi network may block outbound traffic. Ask a facilitator to check the network settings.                    |
| Connection drops mid-session      | The Pi may have lost power or WiFi. Power cycle the robot (unplug, wait 10 seconds, plug back in) and reconnect. |
| Password rejected                 | Make sure you are typing `car` (all lowercase). Remember, no characters appear on screen as you type.            |

<Tip>
  If you know your Pi's IP address, you can always connect with `ssh car@192.168.x.x` (replacing `x.x` with the actual numbers) instead of using the hostname.
</Tip>

### Raspberry Pi Connect as backup

If SSH does not work after troubleshooting, you can use **Raspberry Pi Connect** as a backup. This service was set up when you flashed the SD card.

<Steps>
  <Step title="Open Raspberry Pi Connect">
    In your browser, go to [connect.raspberrypi.com](https://connect.raspberrypi.com).
  </Step>

  <Step title="Sign in">
    Log in with the Raspberry Pi account you created during the SD card setup.
  </Step>

  <Step title="Open a remote shell">
    Find your device listed as **picar** and click **Remote shell**. This opens a terminal in your browser that works exactly like SSH.
  </Step>
</Steps>

<Note>
  Raspberry Pi Connect requires the Pi to have internet access. If the Pi is not connected to WiFi at all, this backup will not work either — ask a facilitator for hands-on help.
</Note>
