1. Getting Started

Getting Started: Interacting with Rearview

Prerequisites

Hello, Rearview!

Connect to Rearview

Turn on the Rearview by pressing the power button above the camera. Wait for the LED to start blinking. This means the Rearview is ready to connect to your computer.

From your computer, connect to the Wi-Fi network created by Velovision Rearview.

  • Network name: Velovision Rearview
  • Password: velovision

Your First Request

From your browser, go to http://velovision-rearview.local:8000 (opens in a new tab). (Note HTTP, not HTTPS) You should see a page that says:

Welcome to the Velovision Rearview

Congratulations! You've successfully connected to Velovision Rearview.

Troubleshooting

If you don't see the message, check:

  • Make sure you're connected to the Wi-Fi network created by the Rearview.
  • Make sure the Rearview is powered on and the LED is blinking.

Using the Command Line (curl)

Great! Let's get some system stats, like the CPU temperature. This time, we'll use the command line and the curl program instead of a web browser.

curl http://velovision-rearview.local:8000/cpu-temp

When you run this, you should see the CPU temperature printed to the console. It should look something like this:

45

Using Python

We can also use Python to get other information, like current battery level percentage. Here's a simple Python script that does just that:

get_battery_percent.py
'''
Run: python get_battery_percent.py
'''
import requests
 
url = "http://velovision-rearview.local:8000/battery-percent"
 
response = requests.get(url)
 
if response.status_code == 200:
    # Success
    print("Battery Percent: ", response.text)
else:
    print("Failed. Status Code:", response.status_code)

When you run this program, you should see the battery percentage printed to the console, like so:

Battery Percent:  85

No SDK, just plain old HTTP requests

Where we could, we chose 'boring' technology (opens in a new tab). All functionality is exposed via a simple set of HTTP endpoints, using only GET and PUT requests. See the API Reference for a complete list of endpoints and their usage.

Setting the Rearview's System Clock

Velovision Rearview is based on Raspberry Pi Zero 2W and does not have a battery powered system clock. This means if the device is powered off, it will lose track of time. This doesn't really matter for operations discussed in this tutorial but if you want to connect to the internet and download apt packages, for example, you must set the correct time. The following command run from your computer will set the clock on the Rearview:

ssh velovision-rearview.local "sudo timedatectl set-timezone UTC && sudo date -s \"$(date -u +"%Y-%m-%d %H:%M:%S")\""

Summary of Lesson 1: Getting Started

In this lesson, you learned how to connect to the Velovision Rearview and get some basic information using HTTP requests.

Are you ready for something more exciting, like actually seeing the video feed from the Rearview? Go to the next lesson:

Next up: Lesson 2: Video Streaming