2019 Capstone

Revision as of 19:04, 16 May 2019 by Coloneltoast339 (Talk | contribs) (Using a 9V Battery)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Motor Driver Datasheet: http://www.st.com/web/en/resource/technical/document/datasheet/CD00000059.pdf

PID & Motor Control Lecture: https://docs.google.com/presentation/d/1n4hJfv52p-P3TtfBUEjtKd306GumaMZcRkFn3nFRQxQ/edit?usp=sharing

Project Overview

This project will be much more challenging than the previous ones as breadboard space (aside from the soldering for your PCBs, there will be no other soldering required for this project) will be very limited, and design constraints are more open-ended allowing you to make some design decisions.

You will be making a Rodent or RC Car in groups of 2-3 people. This project is intended to help prepare you for one of IEEE's competitions next year, and as a way for you to apply the skills you've learned in a creative application.


In order to get checked off for this project (aka COMPLETE OPS AND GET YOUR MONEY BACK), you must meet the following criteria:


  • Avoid crashing into walls or straying completely from the line using a control loop
  • Design your controller so your path is close to straight
  • Turn left or right at a corner and continue straight
  • Successfully navigate a path

You must either implement a PI, PD, or full PID controller as long as it behaves according to the requirement. As for the status LED, it is good practice to have some way of observing where your MCU is in its program. For example, you would like to know if it is calibrating sensors or simply stuck in place.

RC Car

  • Use the radio in conjunction with the IMU to tilt-control the car
  • Design your controller so the car can stay still
  • Turn left or right at a corner and continue straight
  • Successfully navigate a path

Capstone Competition

At the end of the year, we will have a mini-social/competition! This is your chance to show off your accomplishments. It is also where you will be getting your deposits and free T-Shirts, if you qualify. The goal is to navigate the path in the lowest time. Winners get bragging rights and a small prize!

There will be prizes for 1st, 2nd, and 3rd place teams (Subject to change) to be announced soon!

Also, winning this competition is something you can brag about to your EE peers.

Rodent: Calibrating the Sensors and Measuring Error

Establishing a base value against which your errors can be calculated is important. Because our sensors are not shielded to ambient interference, we must assume that they are not identical. This leads to the need for two measured error values: left error and right error.

We will use a simple averaging method to find our ideal sensor reading. This consists of initializing a sum variable to zero, adding a user defined number of analogRead samples from the desired sensor, and dividing by this number of samples. This will yield the target value for a sensor measurement. The averaging method should be called twice in the setup function to establish both the left and right sensor targets.

In our actual control loop, we will want to check our position relative to where we should be: the averaged target value. Because our motors will vary in speed due to manufacturing error, drift will occur. In each iteration of the control loop, we need to sample measurements from both sensors (again, take an average of a few values to reduce noise) and find the difference between the target. This will give us error values for both the left and right sides. Because our motors and the errors are coupled, that is, changing one motor affects both errors, it would be unwise to output two separate correction values for the motors. Instead, you can find a total error by taking the difference between the left and right errors. This gives us a fairly good position about which we can correct to zero.

Note: Error propagation is negligible for this project.

Motor Driver: L293D H-Bridge

Project 7

An H-Bridge is a class of motor driver circuits, and we have an IC version that makes it easy to breadboard.
IN1, IN2, IN3, and IN4 signals control the direction of rotation. To control the speed of the motors, send PWM signals to the EN (enable) pins (in other words, disregard what the image says about PWM).

Using a 9V Battery

Relying on the 3.7V Li-Po battery will make your robot move, but it will be extremely sluggish. To give the rodent a boost, you'll need to use the 9V battery to power the motors. Do not connect the 9V battery to a random pin on the Arduino. It will die and you will be sad. Connect the 9V only to Vin of the H-Bridge and te Vin of the Arduino (please only connect the battery to the Vin pin when connecting it to the Arduino, do not use any other pin!), and use your Arduino's 5V Output for everything else.

As for speeding up the motors, connect 9V to Vs pin on the H-Bridge motor driver, and connect 5V to the Vss pin. This will allow the driver to power the motors with 9V, and communicate with the Arduino with a standard 3.3V OR 5V logic level.



What orientation do the LED and Phototransistor go in?
For the LED, on the board, the footprint has a flat side to the circle outline. On the LED, there is also a flat side that matches with the footprint. For the phototransistor, you will have to refer to the datasheet and the schematic for your board. On the datasheet, there is a diagram which shows you what the longer and shorter pins are.

What value resistors should I use for R1 and R2 on the IR sensor board?
The resistor connected to the IR LED should be 130 Ohms, and the one connected to the IR Phototransistor should be 10 kOhms. Refer to your Eagle schematic and board design to determine which resistor is which. Remember that SMD Resistors have an orientation while SMD capacitors do not.

How do I attach the motors and ball caster to the breadboard?

The back of the breadboard has an adhesive that the motors and ball caster can be stuck to. You have to remove the paper that is covering the adhesive.