RetroMelon / Raspberry-Pi-Car

The software used to create a browser-based remote control car with live video and speech synthesis.
MIT License
24 stars 6 forks source link

Raspberry-Pi-Car

The software used to create a browser-based remote control car with joystick control, live video and speech synthesis. A youtube video demonstrating this robot is available at https://www.youtube.com/watch?v=F3hmwtnsWZA.

Raspberry Pi Car

PS. This project uses the awesome virtualjoystick.js and jQuery (Both of which are licensed under the MIT license).

How The Software Works

The robot uses the following pieces of software in the following ways:

Physical Setup of the Robot

The robot uses 4 GPIO pins for output to the motors, and the ground port on the raspberry pi. The gpio pins used are as follows

Right motor - 4, 17
Left motor - 22, 23
flashlight - 24

Trial and error is the easiest way to determine which way round the pins should go to spin the motors in the correct directions.

Scripts and Their Purposes

There are 4 scripts in the main directory which start all of the software required for the robot to run. They have the following purposes:

mjpgserverrunner.sh - runs the mjpgserver. The contents of the script can be altered to change the resolution that the mjpg streams at (default: 320x240)

piblasterpcm.sh - changes pi-blaster from PWM to PCM mode so that it doesn't interfere with audio output on the raspberry pi.

nodeserverrunner.sh - runs the node.js server with the app nodeserver/app.js.

startrobot - this script simply runs all of the other scripts in the correct order. It calls the scripts in the following order: piblasterpcm.sh, mjpgserverrunner.sh, nodeserverrunner.sh

Software installation

All of the install scripts made reference to can be found in the "Installation" folder.

  1. Install node.js and the following modules:
    • socket.io
    • node-static
    • sleep
    • pi-blaster.js
    • optimist

(Install the raspberry pi specific version from the repo. don't use apt-get - you might run in to compilation problems when installing or using modules.)

(NOTE: The NODESERVERRUNNER.SH script relies on the node executable being in a specific directory. In your setup the serverrunner script will likely not point to the right place. simply change the appropriate line within the script to point to your node executable.)

  1. Make sure you have autoconf installed (use apt-get). Run the pi-blaster installation script. This will install pi-blaster in to the parent directory in the folder pi-blaster.

(NOTE: The PIBLASTERPCM.SH script relies on the pi-blaster executable being in a specific directory /home/pi/pi-blaster/pi-blaster.sh. If it can't be found as this location, change the script to point to the right place.)

  1. Run the mjpgsetup.sh script in the installation folder. It will install the server so it can be accessed system-wide with the command mjpg_streamer.

  2. to use voice synthesis, install festival voice synthesis using apt-get.

  3. run the startrobot script to start all software components necessary for the robot to function.

(NOTE: The startrobot command relies on the password for the current user being "raspberry" (default for a raspberry pi). If it is not this, change te script accordingly.)