Skip to content

A remotely controlled car built on Arduino Uno and Raspberry Pi.

License

Notifications You must be signed in to change notification settings

max-degterev/bebop

Repository files navigation

bebop

Finished build

beepboop - a remotely controlled robocar. Connect it to your WiFi and let your friends drive it around the house through the power of the interwebs. Written in Javascript with some native tools doing the heavy lifting. Read the story of how it was built.

Features

  • Connects to your local home/office WiFi
  • Live video feed
  • Optional live audio feed
  • Lights
  • Simple sounds with buzzer
  • Display messages via OLED
  • Standby mode for low battery consumption (~3h of active use)
  • OTA updates
  • Remote shutdown via web interface

Hardware

You can run this software with minor modifications on almost any Raspberry Pi based system. It relies on a combination of Arduino Uno and Raspberry Pi plus some additional IO. You can skip using some of the hardware by updating adapters without removing all of the code. The software for the Arduino Uno can be found in the board folder.

I used the following as my setup:

Of course you can use any compatible parts, these are here just for reference. I stripped away the line tracking, bluetooth and ultrasonic from the car as I didn't need them. The car should be connected to the Raspberry Pi using a simple USB connection. The GPIO should be connected this way:

GPIO Setup

How to prepare the Raspberry Pi

  1. Download Raspberry Pi Imager and flash "Raspberry Pi OS Lite (32 Bit)" located in Raspberry Pi OS (other)
  2. Re-plug the SD card to mount the boot volume and create 2 files in the root:
  • an empty ssh file: this will enable ssh access on boot

  • a wpa_supplicant.conf: this will allow your Raspberry Pi to connect to your WiFi on boot

    Example:

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=DE
    
    network={
      ssid="My WiFi"
      psk="My WiFi password"
      id_str="mywifi"
    }
    

    You can add multiple network sections for multiple networks (e.g. home and office).

    OPTIONAL: you can also comment out in your config.txt:

    #dtoverlay=vc4-fkms-v3d
    #max_framebuffers=2
    

    These are not needed unless you want to attach a screen.

    OPTIONAL: you can add this to your config.txt

    gpu_mem=256
    

    This should improve FFMPEG performance, but I personally didn't notice any difference.

  1. Turn on your Raspberry Pi and connect via ssh: ssh pi@raspberrypi.local with password raspberry, configure SSH keys and the rest of the OS as you like. Make sure to rename your Raspberry Pi's network name to bebop. Otherwise edit package.json and ecosystem.config.js with your Raspberry Pi hostname/IP address. If you don't do this some of the deployment actions will fail. The rest of the documentation assumes you have your Raspberry Pi available as bebop.local. Reconnect the network or reboot the system for the network name change to take effect: sudo reboot

  2. Update your system

  • Run sudo raspi-config and choose "8 Update"
  • Run
    sudo apt-get update -y
    sudo apt-get upgrade -y
    
  1. Configure your hardware IO following these instructions:
  1. Install necessary software:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

sudo apt-get install -y git
sudo apt-get install -y pigpio
sudo apt-get install -y nodejs
sudo apt-get install -y ffmpeg

You can check if the installation was successful like this:

git --version
pigpiod -v
node -v
npm -v
ffmpeg --help
  1. OPTIONAL: Configure NPM to have a more verbose output:
sudo npm -g config set progress false
sudo npm -g config set loglevel http
  1. OPTIONAL: The onboard Raspberry Pi camera can be made available as V4L2 device by loading a kernel module: sudo modprobe bcm2835-v4l2. Check this thread to add it on boot. If you're using USB Webcam this is not necessary, so just carry on to the next step.

  2. Set up the deployment folder:

mkdir ~/app

Clone this repository to your development machine. Then run from the root of the repository:

npm install
npm run remote:setup
npm run remote:deploy

Later on if you only want to update some local files run npm run remote:push. If you want to recompile web client run npm run remote:publish.

  1. Now back to the Raspberry Pi - setting up autostart. We used a module called PM2 to manage deployments. However we can't use it to autostart the application. Authors of PM2 refuse to allow you to run your node process with sudo and without it we won't get access to the hardware. Because of this we will use systemd. On Raspberry Pi run:
sudo ln -s /home/pi/app/current/etc/bebop.service /etc/systemd/system/bebop.service
sudo systemctl enable bebop.service
sudo systemctl start bebop.service
  1. OPTIONAL: Back up your work (Mac OS instructions):

Fix your OS permissions by giving Disk Utility Full Disk Access, then shut down your Raspberry Pi, unplug the SD card and make a backup copy.

This is it! Power up your system and navigate your browser to bebop.local! You should see something like this: Interface

Have fun!

License

MIT © Max Degterev

About

A remotely controlled car built on Arduino Uno and Raspberry Pi.

Resources

License

Stars

Watchers

Forks