Skip to content

Project of a robotic car with raspberry pi as controller

License

Notifications You must be signed in to change notification settings

nostromo-1/robotic-car-Pi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robotic Car

Project of a robotic car with Raspberry Pi as control unit

This project is about building a hobby robotic car. It is a 4WD or 2WD car, with a raspberry pi as MCU, and controlled by a wiimote. It needs some external electronics. Communication with the robot is achieved via bluetooth (the wiimote) and wifi (start/stop program, error and status messages).

Robotic car

Features

  • 4WD or 2WD robotic car (depending on chasis)
  • It can operate under the control of a Wiimote or in autonomous mode
  • The Wiimote can be used to:
    • Move forward (A button) or backward (B button)
    • Turn right (RIGHT button) or left (LEFT button)
    • Increase ('+' button) or decrease speed ('-' button). Speed is signalled in the leds of the Wiimote
    • Activate a buzzer sound (DOWN button)
    • Play a police siren (UP button) over a loudspeaker. If you push again the UP button while still playing, it stops playing
    • Increase (button ´1´ + button '+') or decrease (button '1' + button '-') volume of sound
  • It can detect collisions via the inertial measurement unit. If it crashes, it tries to avoid the obstacle.
  • It continuously monitors distance to an obstacle in the front side. If an obstacle is near, it will drive around it by turning until no obstacle is found. If it detects a stall (like in undetected obstacles, due to a non straight position with respect to the sonar), it will move a little backwards and turn to avoid it
  • It monitors battery voltage and current consumption and shows them in the display, also showing a battery status symbol in the display. If battery is too low, it powers off the raspberry
  • If the scan button is pressed, it starts scanning for wiimotes and connects to one. A long press powers off the raspberry
  • If a pi-camera is attached, it can be used to display the image in a web browser (using https://github.com/silvanmelchior/RPi_Cam_Web_Interface)
  • It displays status messages in a display. It also shows its orientation (roll, pitch and yaw angles).
  • It features a KARR-type scanner :-)

Parts

The following parts are needed to build it:

Software

The robot runs on raspbian, I have tested it on releases from mid 2016. It is programmed in C. It makes use of the pigpio library for GPIO access, allowing it to play sound and use PWM at the same time, and behave quasi-realtime. It also needs the bluetooth and alsa libraries. The program avoids active loops in order to make a light use of CPU: its CPU usage is about 7% (which is due to pigpio). It is implemented in a multi-threaded program with shared variables and makes use of atomic semantics to avoid races.

The following packages need to be installed on plain raspbian lite (sudo apt-get install):

  • pigpio
  • libbluetooth3 libbluetooth-dev
  • libcwiid1 libcwiid-dev
  • libasound2-dev

After installing them copy the Makefile, the src directory and the sounds directory, and run make robot. After compiling, run it with ./robot -b -s. If wheel encoders are used, add -e to activate the PID control loop. It is a SUID program, but it drops privileges at the beginning of execution.

About

Project of a robotic car with raspberry pi as controller

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages