GithubHelp home page GithubHelp logo

salmanatif / raspberry-pi-car Goto Github PK

View Code? Open in Web Editor NEW

This project forked from retromelon/raspberry-pi-car

0.0 2.0 0.0 3.21 MB

The software used to create a browser-based remote control car with live video and speech synthesis.

License: MIT License

Shell 5.43% JavaScript 73.17% HTML 21.39%

raspberry-pi-car's Introduction

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:

  • node.js - serves the webpage to the user. It also recieves messages about the controls and activates the gpio ports on the raspberry pi accordingly. (access the server over port 8090 by default)

  • mjpg-streamer - provides a streaming jpg image which is embedded in the webpage that is served to the user. This allows the user to see through the webcam attached to the robot. (streams over port 8091)

  • pi-blaster - allows the node.js server to send PWM signals to the GPIO pins on the raspberry pi. PWM has advantages over simple high and low signals because it allows us to control the speeds of each motor, allowing for dynamic turning/speed changes. It should be noted that if speech synthesis is required, the pi-blaster software should be started in PCM mode as opposed to PWM mode to prevent interference with audio output on the pi. PCM mode is enabled by the startrobot script.

  • festival - the node.js server runs bash commands which in turn use festival to synthesize speech.

##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.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.