Close
0%
0%

Raspberry Pi based Robot with web controls

This Raspberry Pi based Robot uses a web interface for remote control and Google assistant for voice control

Public Chat
Similar projects worth following
887 views
0 followers
This Raspberry Pi based Zumo Robot runs Apache web server for providing web interface for remote control and uses Adafruit voice bonnet for getting audio input to run Google assistant for voice control. The robot also uses a pi camera v2 for getting camera feed which is then displayed on the webpage. The web interface provides controls for motor control, taking pictures with pi camera, text-to-speech, voice playback and also playing youtube audio!

The Raspberry Pi Zero W used in this project is running the latest Raspberry Pi OS Lite 32-bit version on a SanDisk 64GB micro sdcard. Once the image is burned into the sdcard. Insert the sdcard into the pi zero. Connect the monitor to the pi and turn on the power.

Once the pi boots up enter the username ("pi" in my case) and password. Login to the pi using the username and password.

Once you are logged in to the terminal, setup wireless network on the pi by running the following command

sudo raspi-config

Enter your wireless access point name and password under "Wireless LAN" section. Also enable SSH under "Interface Options" for connecting to the pi over SSH later. 

Also enable "Legacy camera" in "Interface Options".

By default pi connects to wireless network using dynamic ip addressing in which the ip address of the pi changes each time the pi reboots. This is not ideal when connecting to it remotely over SSH as we don't know the ip address of the pi. Assign static IP on the pi by editing /etc/dhcpcd.conf by running the following command

sudo nano /etc/dhcpcd.conf

 Insert the following lines to the end of the file

interface wlan0
static ip_address=192.168.1.25/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8

where 192.168.1.25 is the newly assigned static ip of the pi and 192.168.1.1 is the gateway address of the router. 

Save the file.

Reboot the pi by running the following command

sudo reboot 

 Once the pi reboots run the following command to see the ip address of your pi

hostname -I

 You should see the static ip address we assigned before. 

Run the following command to check internet connectivity on the pi

ping www.google.com

Now we have the pi set up for remotely connecting over SSH.

Once you have the zumo robot built and wired. Turn on the power.

Connect to pi@192.168.1.25 by running an SSH application from another computer connected to the same wireless network as the pi. 

Once you have the remote terminal of the pi upgrade the packages to the latest version using the following command.

sudo apt-get update
sudo apt-get upgrade

Install Apache webserver and php using the following command

sudo apt-get install apache2 php libapache2-mod-php

Enable apache2 at startup and start the webserver using the command

sudo systemctl enable apache2
sudo systemctl start apache2

Install pigpio GPIO pin control using the command 

sudo apt install pigpio

Enable pigpio daemon on startup by editing /etc/rc.local and inserting the following line just before exit 0.

pigpiod -t0

 We are using -t0 to use PWM instead of PCM. PCM is being used by voice bonnet speaker out.

Install espeak-ng (used for text-to-speech) using the following command

sudo apt-get install espeak-ng 

Install imagemagick (used for embedding timestamp on pi camera photo) using the following command 

sudo apt-get install imagemagick 

Recording voice from webpage using javascript requires having a secure http connection.  So SSL needs to be enabled on apache2. 

By default Apache executes shell commands using the 'www-data' user. So user 'www-data' needs to be added to the 'video' group for taking pictures from the pi camera. For text-to-speech to work using espeak-ng  we need to add 'www-data' to 'audio' group. Run the following commands to do so.

sudo usermod -a -G video www-data
sudo usermod -a -G audio www-data

Install Voice bonnet drivers using this guide - https://learn.adafruit.com/adafruit-voice-bonnet/

Install Google assistant on the pi using this guide - https://learn.adafruit.com/using-google-assistant-on-the-braincraft-hat

Clone the zumo-robot github repository using the following command

git clone https://www.github.com/ps-nithin/zumo-robot

Copy the contents of zumo-robot/zumo-web/ to your apache web root directory using the following command.

sudo...
Read more »

  • 1 × Raspberry Pi Zero W
  • 1 × Adafruit voice bonnet
  • 1 × Pololu Zumo chassis
  • 1 × Pololu DRV8833 motor controller
  • 1 × Raspberry Pi camera module v2

View all 12 components

  • 1
    Robot build

    As you can see from the build image, the power bank is attached on top of the zumo chassis using  double sided tape. On top of the power bank attach a piece of rectangular aluminium section cut to the width of the chassis to hold the pi and the pi camera in place. Pi and the pi camera is also attached in place using double sided tape.

    Find files for 3D printing the robot body here -> https://www.thingiverse.com/thing:6025164

  • 2
    Wiring

    We are using GPIO23, GPIO24, GPIO22, GPIO27 and ground pins  for motor control.

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates