New microsoft word document (3)

388 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
388
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

New microsoft word document (3)

  1. 1. Designing a microcontroller-drivenalternator voltage regulatorDavid Swanson9/20/2005 6:25 PM EDTRemember the days when, if your car’s alternator died, you could hit the regulator witha hammer and get it working again? Those were the days. Back then the regulator was asteel box mounted on the fender well. Inside, was a normally closed contact that openedup when the battery voltage exceeded some predetermined level. It was a simple circuitcontaining a few electronic components and a relay. As the relay wore out occasionallythe contacts would not connect. You could whack the thing and jar the contacts justenough to get it working again. This was an easy fix and an early warning at the sametime. You knew the alternator voltage regulator would stop working again so you wouldreplace it at your earliest convenience (for me, when I could afford it). This was a simplesystem that worked for many years. Why, then, do we need a microcontroller?Why take an alternator voltage regulator from the simplicity of a relay and a few parts tosomething with more computing power than NASA had on the first Apollo moon shot?The answer lies with the potential for extended battery life, improved gas mileage, loweremissions, stability at lower engine idles, and most importantly, flexibility.Many low-volume charging-system applications beg for features but are stuck with whateveryone else is using. For the OEMs that make these devices, microcontrolled regulatorsenable them to first prototype a potential customer’s configuration quickly and thenprovide low-volume products without enormous tooling charges.A more universal principle is in play as well. It seems that nothing conceived by mankindremains simple for long. If man can make it, man can make it more complicated--allunder the guise of “we can make it better.” In this case, alternator voltage regulation is noexception.A microprocessor-based alternator voltage regulator seems, at first glance, to be asimple project to complete. After all, anything done with a relay can’t be all that taxingon a microcontroller. Well, sometimes ignorance is bliss. The smarter the controller, themore difficult it becomes to keep the alternator voltage regulator stable.An alternator, such as the one shown in Figure 1, is a current-mode machine. You put acurrent in and, with some help from a mechanical input (a pulley), you get a gainedcurrent out. But, you say, isn’t this an alternator voltage regulator? Yes, and this iswhere the problems begin. To control the output of a current-mode machine by looking at
  2. 2. its voltage, knowing that the loads can vary in type (or phase) and amplitude at any time,is quite a challenge.Figure 1: Visteon alternator in a Ford TaurusThe advantage of the old relay-driven system was that it was slow. Its poor response timeand built-in hysteresis allowed for some voltage variation with load but kept the systemfairly stable regardless of load.Quick reviewThe input to a charging system is both mechanical and electrical. The mechanical part isthe pulley that rotates the field (or the rotor in Figure 2) inside the stator, and theelectrical part is the field current. The rotation generates the current “gain” in the system.Without rotation, there is no output current.Figure 2: Cutaway of Delphi alternator
  3. 3. The output of the charging system is a product of rectifying the stator current, as shownin Figure 3. The rotating magnetic field inside the stator winding generates a sinusoidalwaveform. This waveform is rectified to provide a direct current, which is a function ofthe input, or field current, and the field rotation. Since we want to regulate an outputvoltage, not a current, the load is involved in the regulation algorithm. As a result,stability is based on the response time of the alternator as well as the reaction time of theload it drives. In the end, the charging-system regulation loop now includes all of thevehicle electronics, not just the alternator and its mechanical inputs.Figure 3: Electrical diagram of an alternator
  4. 4. With electronic controls automotive engineers can add neat features beyond simpleoutput-voltage regulation. Remember man’s quest for complexity? Once the engineersdecide to use a microcontroller-based system, these added features can help justify theadded cost. The bonus features include field duty-cycle slew-rate limiting, soft start, autostart, and serial communications with the engine controller. With serial communications,engineers can also include higher level diagnostics such as no rotation, faulted rectifier-diode detection, as well as shorted or open field windings.Ensuring system stabilityBefore the design engineer can start adding on all the glitter that makes a microcontrolledsystem cost effective, the charging system must be stable at regulating the outputvoltage. So, the first algorithm of any importance is the regulation algorithm. Regulationconsists of sensing the battery voltage with adequate filtering to remove unwantedinformation and then responding with an appropriate current level for the field.Sensing and filteringThe output-voltage waveform of an alternator is not so flat. Figure 4 shows that therectified sinusoidal waveform has a ripple voltage or ripple current associated with it.This ripple can be quite large, even when we include the 1F capacitance of the battery.The peak-to-peak ripple voltage out of an alternator can be as much as 4 to 6V at highoutput currents.Figure 4: Alternator voltages at 100A output and 6,000RPM
  5. 5. This peak-to-peak ripple voltage can be overcome without large filters by synchronouslysampling the output voltage with a phase signal. The ripple is periodic with the phase, sothis technique is quite effective. We can effectively filter out most of the periodic noisegenerated by the stator phasing. That noise is over 90% of what needs to be filtered out,with most of it in the lower frequency range.Filtering of higher frequencies can be done by placing some simple RC networks in frontof the analog-to-digital (A/D) converter. You have to do some level shifting anyway tobring the battery setpoint voltage of about 14.5V to below the 5V level of most A/Dconverters. We can do further filtering in software by a rolling average of the sensedvoltage. A four- to eight-sample averaging seems to work well.Those who are familiar with system dynamics can also understand that system poles andzeros can shift depending on load, load type, engine RPM (gain), and regulation setpoint.With that little bit of information, we realize that our regulation must have a very low-frequency dominant pole (less than 50Hz) and produce a fairly low–unity-gain bandwidth(less than 3kHz) to keep things from getting out of hand. The more time we take todecide on what to respond to, the lower that pole becomes. Also, the speed at which wereact to a step change in output voltage determines our unity-gain bandwidth. This bringsme to the next topic.RespondingResponse comes in the form of providing an appropriate field current to maintainregulation. The field current is typically regulated by driving a transistor switch at a dutycycle to attain a desired current, as shown in Figure 3. This technique is called voltagecontrol of the field-current input. (Seems appropriate, don’t you think? After all, you’reregulating a current-mode machine by looking at its voltage.) The two generally accepted
  6. 6. ways of regulating the alternator are through a fixed-frequency duty cycle or a variable-frequency duty cycle.The variable-frequency systems are dependent on the load and the response time of thesystem (alternator and loads). They tend to be high-gain systems. As a result they tend tobe more accurate in maintaining a fixed setpoint voltage at the output while havinginherent instability problems.Variable-frequency systems work by the old standard-relay method: turn on the fieldcurrent when the output voltage is below a setpoint and turn it off when the setpoint isexceeded. The hope is that the system is so dynamic that it only stays in one point for amoment. Thus if the system finds an unstable point, it would only operate there for amoment, and the battery would help mask those brief, infrequent moments.The fixed-frequency systems are more stable in both input waveform and output control.These systems tend to use a lower-gain system allowing the setpoint voltage to vary byas much as 200 to 300mV over the load range.Fixed-frequency systems are easier to manipulate if you want to do other things like soft-start or load-response control. They are less dependent on the load dynamics and quite abit more stable than the variable-frequency method.A few hundred millivolts compared with a 6V ripple is not very much. So the differencebetween the variable-frequency and fixed-frequency system is not critical, at least to myway of thinking. However, some engineers feel that a few hundred millivolts can make asignificant difference in battery longevity. I’m not so convinced.To summarize, with the variable-frequency method, the decision to turn on or off thefield driver is made with each sample. With the fixed-frequency method, the duty cycle isdetermined by where in the setpoint window the sample is, as shown in Figure 5.Figure 5: Setpoint band for determining field duty cycle. (The setpoint is typicallyaround 14.5V at 25C.)
  7. 7. I have worked with both systems and find that fixed-frequency systems are much morestable and predictable—especially when considering the extended feature set madepossible with a microcontroller.Regulation bandLet’s go into a design of a simple microcontrolled system in detail. Figure 6 shows abasic block diagram for a microcontroller-based alternator voltage regulator. Since thefixed-frequency system is much more stable and easier to work with, we’ll focus on thisapproach.Figure 6: Basic block diagram of an alternator voltage regulatorThe fixed-frequency method has a regulation band as shown in Figure 5. Within theregulation band, a specific duty cycle is associated with a specific voltage. At the lowend of the band, the duty cycle is the highest. This point corresponds to the highestloading on the system. At the high end of the band, the duty cycle is the lowest, whichcorresponds to the lightest load the system can tolerate.
  8. 8. We want to make this band as narrow as possible without making the system unstable.As you can imagine, when the window is narrowed, the gain increases. With higher gain,we have trouble keeping the low-frequency dominant pole or the low-frequency–gainbandwidth product. Typical systems on the market today that use this method havearound a 200 to 300mV range from full field to no field current.We can’t possibly look directly at 14.5V with a micro A/D converter, and simplydividing this voltage down loses a lot of information as well. A 200mV window dividedby four ends up with a 50mV spread to convert with the A/D converter. A 5V, 10-bit A/Dconverter gives 4.88mV per bit. This means I have a resolution of only 10 to 11 steps forregulation if I divide by four.This leaves us with building an offset amplifier with an accompanying gain stage asshown in Figure 7. The offset amplifier centers the setpoint to the middle of the A/Dconverter’s sensing voltage range. The gain amplifier then gains that up to get as muchout of the A/D conversion as possible and still stay within the boundaries of the range ofvoltages we need to regulate.Figure 7: Possible gain and offset amplifier circuitWith the proper biasing, the input is 14.5V +/-100mV and the output is somethingreasonable for the A/D converter to read. Biasing is a hardware issue, so we’ll let thehardware guys worry about that.The second issue with the regulation setpoint is temperature compensation. The battery’sability to accept a charge is dependent on ambient temperature. At -40C a typical carbattery can be charged to as much as 16V whereas at 125C, the charging voltage has tobe much lower to keep the battery from boiling over. The temperature-compensation
  9. 9. curve is totally dependent on what is best for battery life. Figure 8 shows a typicaltemperature compensation curve for some cars on the road today.Figure 8: Typical temperature compensation curveOddly enough, temperature-compensation curves vary from car manufacturer to carmanufacturer even though the battery technology does not change from car to car.Flexibility is one of the advantages of making a complex alternator voltage regulator,right?With the proper input offset and a total gain of two, the input to the A/D converter is0.5V to 4.5V. With a gain of two, the 200mV band is now 400mV to the A/D converter.Using the aforementioned 4.88mV per bit at the A/D converter translates to an actual2.4mV per step measured, or 81 steps over the 200mV window. With some averaging,this can easily be bumped up to 128 steps or 7 bits of resolution. This level of resolutionis plenty for what we need.Now we’re ready to convert data. We sample synchronously with one of the phases tominimize noise issues. We may be sampling every time the phase is switched, but weonly use the last sample that happened just prior to the field driver turning off. From that,an average is taken over a continuously running sample of four to six samples. Thefrequency of the alternator phase can be in the kilohertz range, while the field duty-cyclefrequency is typically between 100 and 400Hz. Again, slow is good. The lower the fieldduty-cycle frequency, the lower the electromagnetic interference and the lower the powerloss due to switching. Some regulators today work at less than 100Hz.The running average value is then compared with the values in a table that corresponds tothe temperature compensation your customer wants.Field duty-cycle slew rateQuite often, the load variation drops outside of the regulation window. When thishappens, the field duty cycle is commanded to go to 100% from wherever it was. Instant100% duty-cycle moments can cause stability issues in the engine at idle.
  10. 10. One feature that makes the microcontroller desirable is the ability to “feather in” electricloads into the mechanical system. Essentially, this technique limits the slew rate on thefield-current duty cycle. This limiting allows for lower engine idling, which affects gasmileage and emissions. The flowcharts in Figure 9 show this as RATE(up/dn).Figure 9: Phase interrupt and regulation loop routinesThe duty cycle is increased at a fixed slow rate at step increases in load. This rate is soslow, that some systems today can take as much as 10 seconds to go from 0% duty cycleto full field. Others can take around 2s to get to full field. The longer it takes, the longerthe battery must hold things up until the alternator catches up. One way in which you cansee this delay is by the momentary dimming of headlights every time the AC kicks in.A duty-cycle slew-rate generator is based on a simple timed counter that looks at themeasured setpoint results and counts up or down. Instead of the setpoint band directlysetting the duty cycle, a duty-cycle register that’s influenced by the setpoint results isused. The final value of the register should be the measured setpoint band value.Whatever is in this register is what is used to generate the duty cycle seen at the fielddriver.
  11. 11. For example, say the loading was such that the duty cycle was 50%. This would be rightin the center of the setpoint band as shown in Figure 8. A step increase in load occursrequiring an increase of the duty cycle to 75%. Without slew-rate control, the duty cyclewould change to 75% on the next period causing a step increase in mechanical load aswell. With slew-rate control, the duty cycle would increase at a fixed rate until thesystem was satisfied, e.g. the measured value matched the duty cycle register value. At a2 sec overall slew rate, a 25% increase in duty cycle would take a half a second to realize.There are some issues with over-voltage such that we cannot count down as slowly as wewould want to count up. The battery is more willing to go higher in voltage than it is todip under load. Also, over-voltage conditions are frowned upon. As a result, thealgorithm in Figure 9 bypasses the field duty-cycle register altogether when the measuredvoltage is above the setpoint band (~100mV above setpoint). I do not set the duty cycleregister to zero; instead, I turn off the field and let the duty-cycle register count downuntil the over-voltage condition has passed.With a duty-cycle slew-rate limiter, we are now slowing down the response of thealternator to step increases in load, thereby stabilizing the system. Effectively, we areover-damping the system to keep it more stable, while not allowing over-voltageconditions to occur.The main loopFor me, the main loop as shown in Figure 10 is basically a housekeeper and a watchdogof sorts. Everything of interest to me is run by interrupts, so the main loop is what themicro does when it has nothing else to do.Figure 10: Main routine
  12. 12. The main loop checks for loose ends, such as what the ambient temperature is, if thephase input is really working, and if the alternator has lost all ability to charge the battery.Since we use the phase input to look at the output voltage, if we lose phase, we have togenerate an artificial interrupt. That sort of thing.Dilbert cartoonist Scott Adams labeled the first week of a project the Wally Period.Wally explains that “most tasks become unnecessary within seven days.” In the case ofour alternator, most faults go away within one second. So, I put a delay of 1s in reportinga fault. Anything less than a second is not of concern, so we can ignore faults for thealternator’s Wally Period.Once we add serial communications, we can remove the lamp driver in place of high-level diagnostics. We can also add the ability to change the setpoint by commands fromthe engine controller. This capability is added today in many vehicles. Instead of lookingat the positive temperature-controlled resistor for temperature information, the enginecontroller sends a signal requesting a specific setpoint band. Some engine controllersinclude temperature compensation, while others do not.
  13. 13. Most systems today require more communication to the regulator than from it. There areopportunities for PWM (pulse width modulation) communications (where the PWM dutycycle commands the setpoint value), LIN (local interconnect network) buscommunications, “bit serial interface” communications as well as CAN (controller areanetwork) communications protocols.Waking up the alternatorWhen the ignition is turned on, the conditions of the regulator are fairly specific. At startup, ignition occurs with no phase voltage, and the setpoint has not been reached. Thebattery-rest voltage is always below the setpoint. With this condition present, theregulator knows that the system is waiting to start up.At this point, the regulator provides a lower duty cycle, between 10% and 25%, todetermine if the rotor is spinning without drawing too much current. Small amounts ofcurrent in a spinning rotor can generate enough voltage on the stator to be easily read bya microcontroller. The rotor is only spinning if the engine is running. Once a properphase voltage/frequency is sensed, the regulator can begin normal regulation.Soft start at wakeup essentially consists of slew-rate limiting the field duty cycle once theregulator has recognized that the system is starting up. We do this to prevent the enginefrom stalling due to an alternator loading before the engine-idle control system has had achance to stabilize. Some engineers just delay initiating the regulator for several secondsas the engine stabilizes. Either way it works.Auto start is another way of waking up the regulator assembly without using the ignitioninput. If the ignition-input connection is broken or disconnected, you can use a phaseinput to look for activity. Typically there is some residual magnetism in the rotor, suchthat if the engine is running, the stator will exhibit some low-level voltage. This voltageis typically a few hundred millivolts at a few thousand RPM in the alternator. Thisvoltage can be detected by using additional circuitry (such as op-amps) between thestator and the microcontroller. Without the auto-start feature, the phase input can be asimple resistor divider coupled with a zener clamp and capacitor. These low voltagestypically found on the sensed phase when the field is not excited require someamplification to be detected by a microcontroller.Let me say a little about a hardware watchdog. In an embedded microcontroller system,the ambient temperatures can sometimes get out of hand. With that said, we may notknow how the microcontroller will operate at such temperatures. A software watchdogor internal watchdog cannot be counted on under these adverse conditions. It’s kind oflike putting the fox in charge of the hen house. Instead, I use a voltage regulator that hasa built-in watchdog as shown in Figure 10. In the main routine, I toggle a bit that goes tothe watchdog. The watchdog looks for transitions. If it stops seeing transitions, it resetsthe micro and we start all over.The beauty of electronicsToday, electronics eliminates the option to make a regulator work just by hitting it. Of
  14. 14. course, electronics also eliminates the need to do so. Even the aftermarket versions ofthose old regulators are fully electronic today. One of the not-so-hidden benefits ofelectronics is that, even with all their complexity, they’re immensely more reliable thanthe mechanical systems they replaced.David Swanson is a principal engineer in STMicroelectronics’ Automotive BusinessUnit. David has worked with ST since 1987 in various roles. Prior to ST, David workedfor Delco Products Division of GM. He has a BSEE from North Carolina StateUniversity and holds many patents in several areas of automotive electronics. You canreach him at david.swanson@st.com.

×