# Difference between revisions of "Networking Cars"

## Overview

The goal of this project is to build a remote-controlled car which can be toggled to home to a stationary base. This project is the spiritual first step to creating a network of remote-controlled vehicles which can also autonomously move and do specific work. The base car of this project is a Pi Car, an open source remote controlled car project developed by Prof. Xuan Zhang and her lab. The Pi Car platform, which is a remote-controllable car chassis with power and steering that can be connected to an Arduino/Raspberry Pi in order to complete complex objectives. For our modification, we installed an Arduino Uno and an IR beacon (and other auxiliary sensors) then wrote code to enable the homing functionality. As part of our stretch goals, we decided to add an additional line following function as well as enabling a toggle to control the car via a standard 2.4 GHz RC Controller.

## Features

Home to IR Beacon
This is the default mode. When the car is in line of sight of the IR "Home" beacon it will automatically drive towards the beacon until it reaches the approved parking zone (as indicated by black floor markings). It is also capable of following a dynamic target.

• Alternatively, with the simple repositioning of the sensors tracking the floor markings, the car can be modified to park based on object collision detection. Instead of looking for black floor markings, the car would instead look for a solid object in its path, then stop accordingly once in range.

Once toggled to RC Mode, the car is able to receive radio from a 2.4 GHz controller and act as a traditional remote-controlled car.

• With a slight modification to the code, the RC Mode can also be enabled to have collision or floor sensors although we chose to disable them for ease-of-use.

Line Follower
Without any additional hardware, the car is capable of basic line following. The turning radius and reliability of the following is limited by the turn radius of the car (Most line following robots are driven by two separate servo motors, allowing 90-degree turns). In order to compensate for the disadvantage of a 4 wheel design, additional sensors can be easily added and calibrated to enhance the car's following precision and reliability.

• This functionality becomes even more useful when it is used to designate allowed areas, and with a change from simple IR to a color sensor, this could be used to designate multiple different zones beyond black and white.

## Team Members

Curtis Hoffman
Deep Jyoti
Andrew O'Sullivan (TA)

## Objectives

• Design sensor system to communicate relative location between two objects.
• Integrate sensors in order to allow Pi Car to interpret signals into usable commands.
• Assemble Pi Car Chassis with Arduino and all required sensors mounted.
• Build install killswitch mechanisms for safety.
• Add code to enable the car to toggle back and forth from being remotely controlled to autonomously run.
• Assemble the sensors and code into an easily scalable package that can be modified and enhanced upon with the addition of hardware or straightforward coding.

## Hardware Set-Up

### Arduino Pin Out:

#### Voltage Out

 * Pololu IR Transceiver
* Steering Servo
* Right IR Sensor
* Left IR Sensor


#### Ground

 * Pololu IR Transceiver
* Steering Servo
* Right IR Sensor
* Left IR Sensor


#### Data

 13. Motor ESC
12. Steering Servo
11.
10.
7. Right IR Sensor
6. Left IR Sensor
5. IR North
4. IR South
3. IR East
2. IR West
1.
0.


## Challenges

Safety
DC Motor Accelerates and Drives too Quickly
Solution:

• Program the ESC to artificially limit the speed and acceleration of the DC motor
• Create a manual override killswitch, so a human operator can stop the car remotely with the RC Controller

Ease of Use
Implement Reliable Communication with the Pi Car
Solution:

• Program the ESC throttle, neutral, and brake functions with the RC Controller
• Use the RC Controller and receiver to communicate with the Arduino, and Interpret inputs as commands.
• Interpret PWM output from the receiver, and remap the outputs to a value that can be used by the ESC.
• Add a toggle function between remote control and homing modes, create a switch condition that can be sent from the RC Controller.
• Optimize killswitch and toggle to work reliably and quickly at any time

Form and Function
Not All Components are Properly Powered
Solution:

• DC Motor and ESC are on a separate battery than the Arduino and connected sensors.
• Switched 9V battery with a LiPo battery for better capacity and amperage (The Arduino would occasionally lose power when too many actions were called simultaneously).
• Limited the number of sensors we used on the car to help regulate the power use.

Implement Homing Function
Solution:

• Mount IR Sensor above the car with line of sight in all directions. Route wires so there are no obstructions to the sensors.
• Solder all connections to IR sensor, and make secure to reduce any chance for interference or jitter.
• Add IR Sensors to bottom of chassis to use as black line sensors, then marked the "home zone" with black tape.

## Budget

Total Cost: \$168.06

## Gantt Chart

Gantt Chart For Networking Pi Cars