* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download TeamCommonGroundPhas2 - Department of Applied
Pulse-width modulation wikipedia , lookup
Power engineering wikipedia , lookup
Power inverter wikipedia , lookup
Electric battery wikipedia , lookup
Stepper motor wikipedia , lookup
Three-phase electric power wikipedia , lookup
Electrical ballast wikipedia , lookup
Electrical substation wikipedia , lookup
Immunity-aware programming wikipedia , lookup
Variable-frequency drive wikipedia , lookup
Current source wikipedia , lookup
History of electric power transmission wikipedia , lookup
Rechargeable battery wikipedia , lookup
Distribution management system wikipedia , lookup
Integrating ADC wikipedia , lookup
Power MOSFET wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Power electronics wikipedia , lookup
Schmitt trigger wikipedia , lookup
Surge protector wikipedia , lookup
Buck converter wikipedia , lookup
Opto-isolator wikipedia , lookup
Stray voltage wikipedia , lookup
Analog-to-digital converter wikipedia , lookup
Switched-mode power supply wikipedia , lookup
National Electrical Code wikipedia , lookup
Alternating current wikipedia , lookup
Voltage optimisation wikipedia , lookup
California University of Pennsylvania Department of Applied Engineering & Technology Electrical Engineering Technology CET 360: Microprocessor Engineering Team: Common Ground Smart Car Power Systems Cody Morr Kausthub Rao Justin Winterhalter Greg Zick Detailed Task Description To control and monitor the power consumption of a radio controlled Smartcar. Specific Requirements To apply the correct voltage levels, using the LM2940 or L4941 5 volt regulators, to the line sensing, steering, and drive systems, along with the Firebird 32 MCU. Also to use the MCP1702 3.3 volt regulator to monitor 3.3 volt radio frequency communications systems. And finally, to monitor the 7.2 Volt NiCad battery life. Proposed Hardware Solution On the MC33926 Motor Driver Carrier you want to find pin 1 that says Vin. From Vin we will be getting all of the battery voltage, which can range from 0 to 10 volts. Since the battery can charge higher than what the processor is rated for there needs to be a regulator. The ColdFire needs 5 volts which is the maximum number of volts for it. By using an LM2940 LDO regulator it takes the 10 volts from the battery and drops it down to 5 at a maximum current output of 1 amp. This regulator will drive the ColdFire and also the steering servomotor. This regulator has reverse battery protection and has a low dropout voltage at .5 volts. This means the input voltage from the battery has to be 5.05 volts for it to operate. The regulator has a very low voltage drop out. Most are not this low. The 3.3 volt regulator input pin needs to be connected to the output pin of the 5 volt regulator. This is an MCP1702 regulator that will take the 5 volts down to 3.3 volts with a maximum current output of 250mA. This will power the XBee which is the serial communications receiver, but the regulator has a low dropout voltage of 2.8 volts. Next comes the reading of the battery voltage. The battery can be 10 volts. However, thatโs too much for the ADC port pin of the ColdFire port PTD4 which was selected for ADC conversion. The solution that the team had was to use a voltage divider. This is a linear circuit that outputs a fraction of its input. By using two 10k ohm resistors, the divider circuit will cut the voltage in half thereby making the batteriesโ voltage VBATT/2. The formula that was used to find out what resistors ๐ 2 were needed was (๐ 1+๐ 2) โ ๐๐๐. The way to wire a voltage divider is to set up a resistor coming in from Vin, and then another resistor wired in series to ground. The 5 volt power supply is wired in the junction where the two resistors meet. And this voltage is then sent to the port pin for the ADC and read by the ColdFire MCF51JM128. Proposed Software Solution The software aspect was a challenge because of the manipulation of the ADC. It was necessary to research the way in which we had previously manipulated the ADC in our CET 335 course last semester. While looking through CET 335 notes, in particular lab 7, there was a method which dealt with the issue of manipulating the ADC. This was of course done in assembly language but we were able to gather useful hints on how to address this problem in C++. We also found hints to manipulate the ADC in chapter 21 of the reference manual. The first thing that needed to be done was to define VBATTMIN: This is a variable we used to compare our voltages. Due to the hardware setup, VBATT is actually VBATT/2, so we are only comparing half of the actual VBATT voltage in the code. Here is the code that allows us to do this: #define VBATTMIN66. The next thing that needed to be done was to initialize the ADC. We have already initialized the ADC in the code but we still do need the following line of code: APCTL2 |= APCTL2_ADPC11. This line of code allows PTD4 to be disabled as GPIO. Then we set the channel to the appropriate port. Now the ADC is already initialized, but it does need to know which port we are using. To do this, we used the following code: ADCSC1 = 11. By using this line, we set the ADC to channel 11 where PTD4 lives. We must also wait for the COCO flag which will tell the ADC that a conversion has been completed. code: WAITFOR(ADCSC1_COCO). Thus we now require this line of We used the following line of code to determine the battery voltage: VBATT/2 = ((ADC result register) * 500)/1024: This is an important line of code that we researched and found by looking into lab 7 of CET 335. This is basically a "scalability" equation used to get our resulting voltage in a form we can use. Of course, the equation is open to change depending on the bit mode and if we want our voltage in volts, millivolts, etc. Finally, we used this line of code: VBATT/2 < VBATTMIN. This is our comparison. It is also the only part of the code that runs through an if / else statement. If VBATT/2 < VBATTMIN, then the battery is no longer supplying the car with the proper voltage. When, and if this happens, we want to turn on a red LED, turn off the motor, and also stop running the code. If VBATT/2 > VBATTMIN, then we just want to turn on a green led. We used the following code to determine the outcome if VBATT < VBATTMIN: if (VBATT < VBATTMIN) { FB_RGB_BLUE = 1; FB_RGB_GREEN = 1; FB_RGB_RED = 0; motorDC = 0; FOREVER { } } else { FB_RGB_BLUE = 1; FB_RGB_RED = 1; FB_RGB_GREEN = 0; } The code that is used to turn off the motor is this: MotorDC=0. We also used the forever loop to keep the processor from sending and transmitting data to the car once the voltage drops below this threshold. Resources and References ๏ "250 MA Low Quiescent Current LDO Regulator." Microchip Technology Inc. Microchip Technology Inc., n.d. Web. 11 Mar. 2014. ๏ "ALIMENTAZIONE." ALIMENTAZIONE. N.p., n.d. Web. 11 Mar. 2014. ๏ "L4941 Very Low Drop 1A Regulator." STMicroelectronics, n.d. Web. 11 Mar. 2014. ๏ "LM2940/LM2940C 1A Low Dropout Regulator." Texas Instruments. Texas Instruments, n.d. Web. 11 Mar. 2014. ๏ "Nickelโcadmium Battery." Wikipedia. Wikimedia Foundation, 28 Feb. 2014. Web. 11 Mar. 2014. ๏ "PDIP | ChipKIT Development Platform." ChipKIT Development Platform. N.p., n.d. Web. 11 Mar. 2014. ๏ "Voltage Divider." Wikipedia. Wikimedia Foundation, 03 JulY2014. Web. 11 Mar. 2014. ๏ MCF51JM128 Reference Manual ๏ Notebook reference CET 335 lab 7 Analog to Digital Input