Skip to content
Thomas Anker edited this page May 18, 2019 · 13 revisions

Welcome to the Robot car with raspberry pi project Wiki page!

This repository provides python software and information for a remote controlled robot car consisting of a 2-motors-3-wheels-chassis, raspberry pi 3, motor control L293D, bluetooth xbox controller as remote control and an ultrasonic distance sensor.

HW componentes

  1. Raspberry Pi Modell 3B with memory card powered by a power bank
  2. Robot Car Chassis Kit with 3 wheels (e.g. amazon)
  3. Motor controller IC L293D (e.g. amazon)
  4. Ultra sonic distance sensor modul HC-SR04 (e.g. amazon)
  5. xbox game controller bluetooth (e.g. amazon)
  6. IC sockets, resistor 1 and 2 kOhm, female connector strip and cable

Wiring Diagram

Used SW components

  1. python3.6
  2. python evdev module
  3. python RPi.GPIO module
  4. python asyncio module
  5. xpadneo driver for the xbox controller

The project is tested on a raspberry pi 3B, Kernel 4.14.98-v7+, System Raspbian GNU/Linux 9 (stretch) and python3.6.

Installation

First Python3.6 must be installed (necessary for asyncio). The instruction github.com/dschep worked very well for me.

Next the xpadneo driver must be installed (necessary for rumble support of the xbox controller). Follow the instructions given in github.com/atar-axis/xpadneo and cross your fingers :-)

To install the necessary python modules, please use pip3.6.

Install evdev with sudo pip3.6 install evdev.

Install RPi.GPIO with sudo pip3.6 install RPi.GPIO.

Description of the python modules in the repository

motor_control.py

To control a dc-motor with the IC L293D and Software-PWM is very well explained in www.knight-of-pi.org/simple-dc-motor-board-for-the-raspberry-pi-with-ic-l293-and-software-pulse-width-modulation. This motor control is implemented in class Motor:. The class motor_control: allows then to comfortably set the speed and direction of the car using the speed and direction parameter with range [-1, 1] for backward/forward and left/right movement.

Calling the module directly with sudo python3.6 motor_control.py will start a short test which shows the use of the module.