Unformatted text preview:

Name & SID 1 :Name & SID 2:IntroductionPower SourceMotor DriverControl SoftwareSensingSoldering the SwitchesConnecting the SwitchesGradual MotionMotor Voltage BoosterEE40 Final Project-1 Smart CarName & SID 1 :Name & SID 2:IntroductionThe final project is to create an intelligent vehicle, better known as a robot. Youwill be provided with a chassis(motorized base), which has breadboard space foryou to build circuits, and a microcontroller. As in lab 6, you will be writing theprogram that tells the robot what to do, but you will also build the interfacecircuits that enable the microcontroller to control the robot's actions. Like anactual engineering job, you will plan the design of your circuits and gain theapproval of your boss (your GSI) before actually building your circuits.Power SourceBecause a robot must move around and availability of short cables, we can't usethe plug power that we usually do in the lab. This means we need to usebatteries to power everything on the robot. Since motors consume a lot morepower than the microcontroller, using separate batteries for the motors and themicrocontroller lets us use bigger batteries and higher voltages for the motorswithout damaging the microcontroller.Be extra careful to never short out the motor batteries. They have no "output off"setting and no current limit, and will happily try to melt any wires, breadboardrows, ICs, or tools you short their terminals with! Measure the resistance of themotor. Now based on this resistance value along with the voltage that the batterycan supply and the energy(mA.hour) that the battery provides, find out how longwould you expect the motor batteries to be able to continuously power the twomotors if they don't spin?(1pt)Motor ResistanceBattery VoltageBattery EnergyStand-by TimeMotor Driverif we run the motors from a separate power source, we can't connect the microcontroller directly to the motors, so an interface is required. We will be usinga classic motor interface design called an H-bridge, which can be bought as a single IC for convenience. It lets us run a motor in either direction easily.Figure 1. A basic Hbridge IC using MOSFETsDC motors like the ones we use have a sort of polarization. If the polarity of theapplied voltage is flipped, they will rotate in the opposite direction. An H-bridge isa convenient way of producing this polarity flip. By turning on one transistor oneach side, we can make the motor voltage Vm positive or negative. Can you seea problem with this simple design that can arise if we aren't careful with inputs?(1pt)We can avoid this problem by using a purpose-built motor driver chip that usesthe same general design but prevents problematic inputs from being possible inthe first place. We are using the SN754410, which contains four "sides" of anHbridge on a single chip. Each input on the chip controls whether thecorresponding output is connected to Vcc or ground. The major problem we havewith the SN754410 is that it cannot take its inputs directly from themicrocontroller. If you look at its data sheet, you will see that its minimum allowedinput voltage is larger than the maximum voltage that the microcontroller can putout.Figure 2. Pinout and function of the SN754410This problem can be solved by "translating" the 3V signals produced by themicrocontroller into higher-voltage signals. The motor batteries provide 4.8V,which is a sufficiently high voltage for this purpose. There are a variety of circuitscapable of achieving this; in this lab, we will use op-amps. We could build anamplifier, but that is actually more complicated than we need. Remember that anop-amp magnifies the difference between its inputs until its output reaches itssupply voltage. Can you use this property to design a simple circuit to convert a0-3V digital signal into a 0-4.8V digital signal, without using any feedback? Besure to include some tolerance for inputs that aren't exactly zero. This circuit iscalled a comparator. (2pt)Now, put it all together. Draw a schematic of one entire motor driving circuit, starting with two microcontroller pins (0 to 3 volt range, remember) and ending with a motor. This will form half of your robot's motion system. Be sure to connect every pin on the half of the SN754410 you're using. You'll be using LMC6482 dual op-amp chips for your operational amplifier needs. (1pt)Figure 3. Pinout of the LMC6482Get approval of your circuit from your GSI, then get the parts and build the circuit on your robot's breadboard. Control SoftwareHaving the hardware we need is nice. Now for the software. To start off, let'shave the robot only move forward, move backward, or stand still. Port 10's pinsare in a convenient place on the microcontroller board, so we'll use them to drivethe motors. To do this, we need to both set up the pins we need as outputs, andcreate functions to move the robot around. The following code configures Port10, pins 0 through 3 as outputs:P10OUT &= ~(BIT0+BIT1+BIT2+BIT3); // P10.0-3 lowP10SEL = 0x00; // All of port 10 set up for digital I/OP10DIR |= BIT0+BIT1+BIT2+BIT3; // configure P10.0 as outputNow create functions you can use to move the robot around. All these functionsneed to do is move the motors in the right directions; your main() function candecide what to do after that. Don't forget, the motors might already be moving!void forward() (1pt){}void backward() (1pt){}void left() (1pt){}void right() (1pt){} A stop() function would probably also be useful.Now that you can program your robot to move around, have it do something neat:move back and forth, spin around, whatever you like. You may find it useful toadd the old delay() function to your code and use it to control the length of time that the robot moves in a given direction:void delay(unsigned int n) { while (n > 0) n--; }Once you've put together a routine for your robot, show it to the GSI.SensingWe now have a fairly basic motorized vehicle. However, this is not much of arobot - it has no ability to observe the world and react. We will add this abilitywith the pair of switches on the front.First we need to add the code that enables the microcontroller to detect the stateof the switches. If they are connected to pins 6 and 7 of Port 10, that code is:P10OUT |= BIT6+BIT7; // set P10.6-7 highP10DIR &= ~(BIT6+BIT7); //


View Full Document

Berkeley ELENG 40 - EE40 Final Project

Documents in this Course
Lecture 3

Lecture 3

73 pages

Lecture 1

Lecture 1

84 pages

Guide 4

Guide 4

8 pages

Diodes

Diodes

7 pages

Quiz

Quiz

9 pages

Load more
Download EE40 Final Project
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view EE40 Final Project and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view EE40 Final Project 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?