Pi Car Discovery

From ESE205 Wiki
Revision as of 15:05, 8 December 2018 by George (talk | contribs)
Jump to: navigation, search

[Weekly Logs Link]

Project Proposal

Project Overview

Nowadays, with the fast development of technology, artificial intelligence becomes highly valued and popular. High-tech companies have developed incredible technology. Some notable examples are Tesla with self-driving cars, Google has invented its instant translation machine, Apple has created Siri, etc. With all the excitement and hype of A.I, our group decided to study and explore the Raspberry Pi Car. The goal of this project is to build a model car and use Raspberry Pi to navigate through certain trails. For example, our preliminary goal is for the car to navigate a path clearly marked on a white floor with black tape. We will try some easy trails first, then we will attempt harder tasks as we achieve our goals. We can either increase the complexity of road or add more functions into the car.


Team Members

  • Yinghan Ma (James)
  • Jiaqi Li (George)
  • Zhimeng Gou (Zimon)
  • David Tekien (TA)
  • Jim Feher (instructor)


  • Build a pi car
  • Connect the car with Raspberry Pi wirelessly
  • Interface the Raspberry Pi and Arduino with sensors and actuators
  • Enable the car to move
  • Navigate the car by following a easy, straight path clearly marked on a white floor with black tape
  • Navigate the car by following a curved path
  • try some harder path with complex environment
  • Install Night Light into the car
  • Honk the horn when the car detecting barriers at the front


  • Learn how to use Raspberry Pi and how Pi interact with each electronical component
  • Code with Python.
  • Understand the meaning of the code in software section
  • Learn CAD and figure out how to 3D print accessories for Pi Car


Item Description Source URL Price/unit Quantity Shipping/Tax Total
Buggy Car Used as our pi car Link $99.99 1 $0 $99.99
Rotary Encoder Link $39.95 1 $0 39.95
Raspberry Pi [Provided] $0 1 $0 $0
32GB MicroSD Card [Provided] $0 1 $0 $0
IMU 9DoF Senor Stick Link $14.95 1 $0 $14.95
Raspberry Pi Camera Module V2 Link $29.95 1 $0 $29.95
Brushed ESC Motor Speed Controller Link $8.95 1 $0 $8.95
TowerPro SG90 Micro Servo Link $7.29 1 $0 $7.29
TFMini- Micro LiDAR Module Link $39.95 1 $0 $39.95
Current Sensors Link $6.39 6 $0 $38.34
Honk Link $11.99 1 $0 $11.99

Gantt Chart



Pi Car Project

Pi Car Lab

Arduino Tutorial

Serial Communication

Design and Solutions

Build the car

Extra Materials that we need:

  • 3D printed layers
  • 3D printed frame for fixing the encoder and the car
  • Gear that fix the encoder
  • Some plastic central plastic gears for back up (since they broke easily)

The first thing we have to do is to remove the original parts from the Buggy car. More instructions can be found in Pi Car Project.

Pi Arduino communication

We used serial communication first. It can be done easily by plugging in USB wire from Pi to Arduino. However, later on, we found I2C communication is better. Thus we switched to I2C communication in the end.

Install Arduino software on the pi and follow this useful website: Serial Communication.

Serial Communication code:

  • Arduino communicated with Raspberry Pi

  • Pi communicated with Arduino

I2C communication approach:


ESC & Motor & Encoder & Arduino Connection

Here is how we connect the ESC, motor, encoder, and Arduino.


(1st step) Make the car move

  • Run WASD file to make the motor move.
  • Simpletimer was not included in the library.
  • Thus we created simpletimer.h by ourselves.

Here is the simpletimer.h code:

(2nd step) Make the car move stably

  • Encoder did not work very well. It did not control the speed as it supposed to be.
  • Thus we made some changes in the WASD.ino.


Line tracking

Follow our tutorials: Line Tracking and OpenCV.

Combine OpenCV and WASD

Comine line tracking with python file.


  • Build the car:

  • I2C communication:

  • ESC Motor Encoder Arduino connection:
  • Make the car move:

  • Make the servo move:

  • Line detection:

  • Test drive:


Overall, the project was successful. We met most of the objectives as we set up at the beginning of the semester. The car is moving smoothly and it can detect shapes and follow lines easily. Although the encoder does not work very well, we can still control the speed by modifying the WASD code.

What we did not do well is we underestimate the difficulty of our project. At the beginning, we thought this project should be done smoothly since there are many materials online. We even thought about doing self-parking. However, we met so many difficulties throughout this semester: the WASD file did not have simpletimer library; the encoder did not work very well; OpenCV has a lot of bugs; camera can easily be disturbed by surroundings; Pi and battery died in the final week. Thus, we did not finish the self-parking and add the fancy decorations (such as nightlight, honk, etc) in our project.

The obstacles can be concluded into two areas: lack of knowledge and experience in computer programming and good quality materials. We could further improve the OpenCV by ignoring the surrounding edges, and only focusing on the ground. Besides, we could fixed the bugs in the code more efficiently if we have more experience in computer programming. Thus we can also finish the project much faster and dive into much harder problems. As for good quality materials, if we have a extended length of pi camera, there will be a better effect in shape detection. If materials are in good shape, we will not procrastinate during the final week, and some more progress might be done.