Self driving car

From Advanced Projects Lab
Revision as of 13:01, 10 March 2017 by Aplstudent (talk | contribs)
Jump to: navigation, search

The goal of this project is to create a car that can move on it's own using sensor input. Writing from early 2017 self driving cars are still in development. Nevertheless many, including everyone is this lab, believe that they are the future. For the moment our car is a little RC car that has a $4 electric motor. We are using a pair of Raspberry Pi 3's for the brain of the car and are using varies sensors to act as the eyes, ears, and balance for the car. This wiki will serve as a guide for work that has been completed so far and work that is left.


Completed So Far

Raspberry Pi's (RP): For this project we have two RP's that will connect all our sensors, process their input, and make decisions on where to go, when to stop, when to turn, etc.

Slave-Master: The RP's are setup in a slave/master pair. The master node will connect all our sensors and will run the majority of our code. The slave node will be used to enhance the computing power of the master node. The two are hooked up through a WiFi signal.

WiFi enabled: Currently the RP's are configured to automatically send out a WiFi signal on start up. From this signal we can connect to the RP's from any WiFi enabled device (right now we are using a laptop).

RC: Out of the box the RC works by a radio frequency signal from an external controller. We are not planning on using the controller for our car. Instead we plan on feeding in our own voltages from the RPs to tell the car when to move, stop and turn. Using a multimeter and a oscilloscope we measured the various voltages applied to the RC from the logic chip in the housing. The motor is in the back of the car and only has two wires going into the engine. We measured the voltages applied with red on red and black on black. When it is moving forward we measured about 9.4V and for backwards about -8.5V. The front of the car uses a servo motor to turn the front wheels. Measuring the red and black wires we see that turning to the right we get a postive voltage and left is negative. Measuring the white, brown and blue cables we found that when there is no turn signal the voltage is roughly 1.5. When the wheels turn to the right the voltage goes up to about 3V and when it is left it is roughly 0V.

Sonar: Following this tutorial we were able to hook up the sonar system. Important note: Our set up differs from this guide in that ours is plugged into GPIO pin GPIO05 instead of GPIO23 and GPIO12 instead of GPIO24. These pins were set up differently in the code (TRIG = 5 and ECHO = 12) but otherwise everything is identical to the guide.

GPS: The GPS is an Adafruit Ultimate GPS Breakout. Following this guide we were able to get the GPS working in the atrium. We have hooked it up through a USB to TTL cable. We also have the optional antenna for it which helps pick up a signal in about 2 minutes (as opposed to about 15 minutes). The end of the antenna is magnetic which helps if you need to place it up high somewhere that is metal.

Compass/accelerometer: The details for the device can be found here. We are using some code provided on git_hub which has been installed and runs great. This sensor is very sensitive, it can detect going up and down an elevator, running, turning, and stopping. However, that also means that small vibrations on the sensor are picked up. All of this is to say however the sensor is being used it needs to be firmly mounted as to not pick up more noise than necessary. For the moment the compass isn't really being used, it works well though so if/when we need to use it we will have it.

To Do

RC: The next thing we need to do with the RC is get a mount that will fit all our sensors and our RPs on. John from the machine shop said that a student would probably be able to make a mount in a couple of hours. Whoever makes the mount can either use poly acrylic glass or aluminum but acrylic will probably be best. The mount will probably use the holes that were used to hold the covers in place. There are 8 holes in total. Afterwards we need to wire the RPs into the RC. We think we can use either the GPIOs or maybe one of the USBs. We're planning on just using voltages from the Pis and fine tuning the outputs to control the car rather than using the pre-built logic chip.

Sonar: When we tested the sonar it had a range of about 1 meter before the data got to gargled. In general though the data is pretty noisy. One solution would be to write code that acts as a high/low pass filter for the times the sensor goes way off track.

GPS: The GPS works great, what we need to do is write our own code to grab the data and store it. The guide for the GPS has some example python code that shows how the GPS works.

Compass/accelerometer: We have yet to write our own novel code for this sensor. The example python function (found in /mirror/git_stuff/LSM303_RPi/examples) will run the sensor and hopefully be helpful in writing our own code for the sensor.

Helpful Links

Besides what has been posted above there are a few links that will be helpful in this project

RP3 GPIO pins: This links to a comprehensive guide about the pins on the RP3. This will prove helpful when connecting future devices or reconnecting current ones in a different configuration.

Learn Python: All our sensors use python to operate. If you are not familiar with python Code Academy is a good way to learn the basics