Skip to content

xsollwa/bob-on-runaway

Repository files navigation

bob-on-runaway

Bob runs from you -- Undercity Demo video: https://youtu.be/lwRu8U_wSio?si=23ed8yJiRMO9bLki

//note: this got approved as shipped for undercity:D

//athena link: https://hackclub.slack.com/archives/C06T17NQB0B/p1754317969589009

A Raspberry Pi based robot that uses a webcam to detect human faces and run away from them while avoiding obstacles.

Bob is a tiny robot that runs away from people. It spots your face with a webcam, turns to look at you, and if you get too close, it backs off while dodging anything in its way. It’s powered by a Raspberry Pi and uses face detection (OpenCV), distance sensors, and stepper motors to move smartly.

We made Bob because we wanted to try something fun but and learn more about computer vision. We used OpenCV for face tracking, ultrasonic sensors to measure distance, and wrote Python code to tie everything together. The frame was 3D printed and the circuit built on a perf board. None of us worked on perf boards before so we were excited to try that out as well.

It wasn’t smooth process at all... Some struggles we faced were mainly mechanical. The sourcing in SF was challenging, our buck converter broke mid-run, and we had to bus to Target just to find wheels (we ended up tearing apart an RC car).

Created by: Ryan Davis, Ruzanna Gaboyan and Philip Golczak
Date: July 14, 2025

Features: What It Does

  • Detects human faces using OpenCV
  • Rotates the webcam toward the face using a servo motor
  • Measures how close the person is using an ultrasonic sensor
  • If the person is within 1 meter, Bob runs away and
  • Avoids bumping into objects using 3 other ultrasonic sensors

Pictures

3d Model

sure_2025-Jul-14_11-35-04AM-000_CustomizedView6653682117 Screenshot 2025-07-14 042921

Circuit board

IMG_4653

Wiring Diagram image

Final Assembly

IMG_4654

IMG_4655

Materials: How It Works

Bill of Materials

Component Description
Raspberry Pi 4 Main controller (runs the code)
USB Webcam (Logitech C270) Captures video for face detection using OpenCV
Servo Motor (9g) Rotates the camera to follow the face
Stepper Motors x2 Drive the robot left, right, or backward
Ultrasonic Sensors x3 Detect people and obstacles (front, left, right)
Buck Converter Steps down battery voltage (7.4V to 5V for Pi)
Battery Pack (7.4V and 6V) Powers motors and Pi (via buck converter)
Perf Board For mounting and soldering sensor/motor connections
Resistors x6 Protect GPIO

Setup Instructions

1. Raspberry Pi OS

  • Flash Raspberry Pi OS to a microSD card
  • SSH into Pi and configure network settings if necesary
  • Install VNC via SSH
  • Exit and VCN into pi
  • Install ffmpeg for video viewing, use command ffview /dev/video0

2. Install Python Dependencies

sudo apt update sudo apt upgrade -y sudo apt install -y
python3-opencv
python3-pip
python3-numpy
python3-rpi.gpio
libatlas-base-dev
libhdf5-dev
libhdf5-103
libjasper-dev
libqtgui4
libqt4-test
wget
thonny

pip3 install numpy RPi.GPIO wget https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml -O ~/haarcascade_frontalface_default.xml

About

Bob runs from you -- Undercity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages