Download presentation
Presentation is loading. Please wait.
Published byHarriet Bridges Modified over 6 years ago
1
team toykO drift Team Members: RYAN WILSON: LEADER
ZACH JOHNSON: ASSISTANT JOE DAVIS: SOFTWARE SPECIALIST TYLER RICHARD: HARDWARE SPECIALIST
2
Motor Control Today we will be discussing with you all the implementation of motor control in the RC SmartCar project. The SmartCar motor control is a vital portion of the overall project and will require attention to detail and critical thinking to correctly establish. The motor control will allow us to properly maintain a speed at which the SmartCar will be running at.
3
Software overview The prime idea here is that we will be using a PWM to drive the motor through a driver chip. We will be using The Duty Cycle of that PWM to swing from to control speed This will be determined by using using an ADC to convert a voltage to a digital output.
4
Software I PWM NO ISR NO TPM1 ON-BOARD COUNTER TPM2
The Pulse Width Modulation we see in this lab will be similar to what was done in the last lab in the sense that it will have a heavy impact on our output. NO ISR Unlike last week we will not be using the ISR for interrupts. NO TPM1 We will be using an on-board timer but it will not be TPM1 as was used last week. ON-BOARD COUNTER TPM2 We will instead be using the TPM2 Clock The TPM2 clock can be used to generate the PWM signal needed for this motor drive lab while allowing TPM1 to continue to run interrupts for other segments of the project. Unlike last week, this week the Period will be determined by the overflow flag. There is a beautiful schematic in section of the reference manual showing exactly this.
5
SeE Section
6
SOFTWARE II The first thing we need to find is the mask for the mask we will need to use to allow TPM2SC to produce the proper signal from the BUSCLK In order to do this we STRONGLY suggest keeping the Coldfire MCF51M128 Reference manual on hand, specifically Sections 22.3 and 22.4 as these will be widely used for all software used in this lab. The proper way to derive the mask needed is to read each “Description” for each “Field” on chart 22-2 from section in the manual. This may be time consuming but it allows for a better understanding of how our answers came to be. Our resulting mask is 0x0A
7
SEE SECTION
8
SOFTWARE III Calculation the Modulo Register.
The calculation for the modulo register is next. To determine this we know We want a 1 ms period Therefor our frequency will be 1/period or 1kHz 1ms = 1000 us Multiply by 3 to account for the 3MHz Subtract one due to the TPM counter being (TPMxMODH:TPMxMODL -1) We end up with 2999 (base 10) as our initialization for TPM2MOD *Refer to section for all information regarding TPMxMOD registers. The TPM2C0V is the register we will use to determine where on this swing we trigger and it is this register that will eventually give us our Duty Cycle. For now we will set it at1500 as a baseline for half speed.
9
Software iv The final portion of the Clock we need to deal with is the TPM2C0SC This register will ensure our supply PWM will be an edge triggered, hi-true waveform This waveform will be derived in a similar fashion to the way that the TPM2SC was derived in the “SOFTWARE II” slide. By deriving each bit individually we are able to find the resulting mask for the register. Once again you are STRONGLY advised to refer to the reference manual to find all the information needed regarding this register. (Section ) Our mask for TPM2C0SC is 0x28
10
See section
11
Software v The final portion of the software is tying up any lose ends in the program and writing the small bit of code needed to drive the hardware. This should include a subroutine which returns an int and creates your duty cycle from the TPM2C0V register A function call to constrain the Motor Duty Cycle between 0 and 100 And a line of code to shift the Motor Duty Cycle into ms and account for the 3MHz Example: TPM2C0V = (MotorDC *30);
12
HARDWARE I The first and most important thing to note is that the hardware we used last week regarding the potentiometer to swing our voltage between 0 and 5 will be used again in the same manor so it can be rebuilt the exact same way for the motor driver as it was for the steering. A capacitor can be used to cancel out any noise interference gained from the raw voltage.
13
Hardware ii 10 PIN OUT PUT FOR UNH5019A-E IN I/O PORTS
What you see here is the 10 pin output bus attached to the motor driver chip wiring this hardware correctly will be vital to proper operation of the motor.
14
HARDWARE iii The First 6 pins of the 10 pin output bus.
INA and INB control the clockwise and counter-clockwise movement of the motor. Because we want our motor to spin clockwise and have no need for it to ever move counter- clockwise we can wire INA to +5V from the Coldfire chip and INB to ground. CS, ENA and ENB are getting their voltage (if needed) from the external voltage supplied to the Driver itself so nothing is needed to be done with them at this time. PWM needs to be tied directly to F4 of the Coldfire processor to retrieve the PWM signal generated by our software. *All of these can be found on the “Pinout” section of the Pololu-12A Driver datasheet.
15
HARDWARE IV Pins 7-10 are directly related to power.
Pin 7 VDD must be attatched to the +5 V of your Coldfire processor. Pins 8 and 10 are tied to ground. Pin 9 is labeled as Vout and is directly tied to Vin from the outside source.
16
See schematic
17
HARDWARE V This portion of the schematic is used to supply power to the driver and to output to the motor.
18
HARDWARE Vi MOTOR OVERVIEW The motor we are using is a RS380 motor
There is a schematic online for viewing. The only wiring involved with the motor is that of tying OUTA and OUTB of the driver with the + and – wires of the motor.
19
RESOURCES Motor schematic: motor.pdf Driver overview: 12Adriver-Datasheet.pdf Driver Schematic: 12Adriver-Schematic.pdf Coldfire Reference Manual: RefManual-v2.pdf
20
QUESTIONS?
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.