Maplin auto electronics projects
Microcontrollers microcontroller in that it also has a second on-board CPU dedicated to controlling timer functions. This Time Processing Unit, or TPU, is in effect a microcontroller within a microcontroller! The TPU is used to handle al- most all of the interrupts associated with the timer channels, thus freeing the main CPU to spend more time on complex control calculations. At suitable points in the control cycle, the main CPU obtains new input read- ings from the TPU and presents new data for the TPU to calculate and schedule the output pulse timings. Vehicle alarms The huge increase in car-related crimes in the 1980/90s has been paralleled by an equally large increase in the demand for car alarms. Originally based on simple logic circuits and triggered directly from interior light switches, the complexity of alarms has grown to try and match the skill of the potential intruder. Figure 3.10 shows the schematic of a typical sophisticated MCU- based alarm system. Using a microcontroller in this application provides a great deal of sophistication within a very low component count, allowing the alarm to be small and thus easily concealed. An MCU chosen for this job should have a low power mode since the alarm must be powered up for long peri- ods of time without the engine running. It should also be possible to wake the device from this mode via several sources, so that a number of circuits can trigger the de- vice into sounding the alarm. A simple 8 or 16-bit on-chip timer is also desirable to time the output audio/visual warning pulses, and to reset the alarm after it has 97 Auto electronics projects 00 IC2q, IC3b TR6 Voltage drop Additional horn/ sensor I siren driver interface D1 TR1, R1, C1, ZD1. S1 Microcontroller, IC1 TR7, RL4 " 2 Φ ; | „ I TR8, », RL2, 3 Backup battery ™^_' 6 ^ I • I ^ J Central locking [= " 2κ ν// Y interface ΞΞ= TR5, RL1 w ι 8 _ Bit ι Peripheral/ \ | " [Vehicle immobilization| ω CPU memorv C 1 ^ ° 1 TR1Q Ι Ο ' A 1 1 control | m Electric window/sunroof ι Ï oo 1 driver interface Ignition security J V% 'Compuguard* I TR1 ·, circuit I ig control program ^ , ! 1 1 ^ L Siren interface Figure 3.10 A uC-based car alarm system Microcontrollers 99 D25. 26. R41, C7 Ι " Panic switch M 1 ° 39 · 4 °· 41 interface | Ν.Ο. security Ζ____ζ . 1 . switches η _, Λ η Oscillator IC2b, ΡΖ1, 2 I—— I RV1, IC3c ^ J D42, 43 Shock detector ' | N.C. security ΗΠΜ ' '°°Ρ 3 — TR3, 4, 14, IC3d yj^ j Ultrasonic sensor | | C9. 10 D27 33, TR12, 13 interface Sensor programming/ 1 arm/disarm module interface D20, TR15. 16 1 1 Electric cooling fan sensor Figure 3.10 Continued Auto electronics projects sounded for a set time — this is a legal requirement. The timer can also be used to arm the alarm after a defined period, if it is not armed via a remote control. A.B.S. The increased performance of everyday cars, along with their increasing numbers (and therefore greater density on the roads), has resulted in a continual improvement in braking performance. This trend has included the pro- gression from all-drum braking, drum/disc braking and ventilated disc/drums, through to the all-disc braking systems found on today's higher performance cars. The most recent improvement has been the introduction of ABS. The Antilock Brake System does not itself increase the braking capacity of the vehicle, but improves safety by maintaining optimum braking effort under all conditions. It does this by preventing the vehicle wheels from lock- ing, due to over-application of the brakes, and thus maintains steerability and reduces stopping distances when braking on difficult surfaces such as ice. ABS allows shorter stopping distances than with locked wheels, due to the friction or mu-slip characteristic of the tyre-to-road interface; as a wheel brakes, it slips rela- tive to the road surface producing a friction force. A typical mu-slip curve is depicted in Figure 3.11. This shows that peak friction occurs at about 10 to 20% slip, and then falls to approximately 30% of this value at 100% slip (locked wheel). 100 Microcontrollers mu 0.5H ι.οΗ ο 10 20 30 40 100 % Slip Fully locked Figure 3.11 A typical mu-slip characteristic for the tyre-to-road interface The aim of the ABS system is to control the braking force so as to stop the slip for any wheel exceeding this opti- mum value by more than an acceptable window. At the heart of all ABS systems (except the all- mechanical system implemented by Lucas) is an elec- tronic control unit (ECU) based around a powerful microcontroller. Figure 3.12 shows a block diagram of such a system. The solenoid valves that form part of the hydraulic modulator allow control of the pressure avail- able to the individual wheel brake cylinders, independent of the force supplied by the driver via the brake pedal. These three-way valves can connect the brake cylinders to: • the normal master cylinder circuit, so that the brak- ing pressure will be directly controlled by the driver, • the return pump and accumulator in the hydraulic modulator, so that the pressure in the brake cylinders will fall as the fluid returns to the master cylinder, 101 Auto electronics projects 102 r , Wheel 4 Broke 1 i I1 cylinder ~ I I I I Clock monitor clock Figure 3.12 Block diagram of an electronic ABS system Microcontrollers • neither of the above two circuits, thus isolating the brake cylinder so that the pressure will be maintained at the value immediately preceding the move to this po- sition. The control for these valves is supplied via drive cir- cuits from the output ports of the microcontroller. The basis for all electronic ABS systems is the microcontroller's ability to determine the speeds of the individual wheels (although some front-wheel drive ve- hicles share a common speed sensor for both rear wheels). It does this via an inductive sensor and toothed ring that produce an output waveform, the frequency of which represents the speed of the wheel. This arrange- ment is almost identical to the engine speed sensor discussed earlier, except that since no angular position information is required there are no missing or extra teeth. It follows from this that the explanation previously given on determining engine speed also applies to deter- mining wheel speeds in an ABS system. In this case, there are around 50 to 100 teeth on the en- coder ring, and this could result in a pulse frequency of 6000 Hz when the vehicle is travelling well in excess of 100 mph. As there can be a speed sensor on each of the 4 wheels, a total of 24,000 pulse edges have to be resolved every second. The solenoid valves in an ABS system typi- cally have a response time of 10 to 20 ms, and the microcontroller must be able to sample the inputs at least twice that often, to resolve lock-ups in 5 to 10 ms. Put another way, the microcontroller must be able to determine 4 independent wheel speeds from 6000 Hz 103 Auto electronics projects signals within a 5 ms window, and still have time to carry out processing on this data to determine the new valve states. These stringent timing requirements mean that ABS systems are the domain of high performance 16-bit microcontrollers that can respond quickly to interrupts from the timer system which is capturing the speed sen- sor edges. So far it has been stated that the microcontroller in an ABS system must prevent the wheel-slip value from ex- ceeding the optimum, and we have discussed how the μC measures the wheel speeds (angular velocity). How- ever, it may not be clear how these wheel speeds are related to the slip values that the system is attempting to control. The slip of any wheel can be defined as the difference between the angular velocity of the slipping and non-slipping wheels, divided by the angular veloc- ity of the non-slipping wheel. This makes sense and sounds quite simple, but for one problem; how to find a non-slipping wheel? The ABS algorithm searches for the fastest spinning wheel and uses this as the reference for calculating the slip values of the other wheels. If the slip value of a wheel is greater than the peak friction value by a certain margin (i.e. the wheel is heading towards a locked condition), then an ABS control cycle is executed on that wheel. First the microcontroller will isolate the wheel brake cylinder from the brake circuit to prevent further pres- sure increase. It will then recheck the slip and acceleration values to determine if the wheel is still de- celerating, and whether the slip value is still exceeding the desired value. If so, then the valve position is moved 104 Microcontrollers momentarily to the return position, reducing the brak- ing effort on that wheel. This pulsed release of pressure is continued until the microcontroller detects that the wheel acceleration is positive, at which point it stops reducing the pressure, and reconnects the wheel cylin- der to the brake circuit to prevent overshoot of the acceleration. This entire control cycle of holding/reduc- ing/increasing brake pressure is repeated until the slip value for the wheel has been brought back into the ac- ceptable window. This is obviously a simplified explanation of how ABS works and the algorithms are in fact very complex and will vary from one ABS implementation to another. When you remember that this algorithm must be executed on all wheels in just a few milliseconds, it is not surprising that ABS is among the most demanding microcontroller applications. An important point worth discussing about ABS is that it is one of the most safety critical processor applications in existence. The consequences of a faulty ABS system could be potentially disastrous if the brakes were pre- vented from operating, or were applied erroneously. For this reason ABS manufacturers take great care in the safety aspects of the system design. It is not uncommon for two identical microcontrollers to be implemented, running the same software in parallel and continually checking each other via a communication protocol for any erroneous operation. Another solution to this problem is to have a simpler (lower cost) slave (that acts as a watch-dog for the main ABS microcontroller. This slave device is pro- 105 Auto electronics projects grammed to monitor the major activities of the master and it has the ability to shut down the ABS system if a fault is detected, thus reverting full braking control to the driver. A subject worth mentioning here is traction control. Trac- tion control is a fairly recent development and can be thought of as applying ABS in reverse. The idea of trac- tion control is to prevent wheel-slip due to excess power on loose surfaces by applying a braking force to the slip- ping wheel (note that traction control is only implemented on the driven wheels). This feature is a natural progression for ABS, as all the necessary com- ponents and measurements required for traction control are inherent in the ABS system — except some means of applying a braking force when the driver is not depress- ing the brake pedal. This is usually achieved via an electric pump arrangement. With the considerable improvement in safety provided by ABS, there can be little doubt that the next few years will see this system becoming more popular, possibly becoming a standard feature on all but the lowest cost cars. The future Hopefully this chapter will have given the reader some insight into the fascinating and challenging applications for microcontrollers in automotive applications. It has, of course, been impossible to cover all of the applica- tions listed earlier in this chapter, or even to cover some 106 [...]... mon PCB DIL s o c k e t 18-pin b o x 301 zip wire 1 1 1 3 mtrs (GA19V) (HQ76H) (LL12N) (XR39N) Ρ clip 78 in 1 (JH21X) M3 χ V4 in s p a c e r M3 χ 16 mm s c r e w M3 nut q u i c k s t i c k pad 1 1 1 1 pkt (FG33L) pkt (JD16S) pkt (BF58N) strp (HB22Y) Semiconductors Dl-3 Miscellaneous 117 Auto electronics projects in-line fuse h o l d e r 1 7 4 in 100 mA fuse c o n s t r u c t o r s ' guide 1 mm PCB pins... s o u r c e (ICI pins 4 and 8 ) t o 1.9 V T h e upper end of t h e chain at ICI pin 6 is c o n n e c t e d t o a r e f e r e n c e s o u r c e output v o l t a g e of a p p r o x i m a t e l y 3.1 V from pin 7 T h e potential divider formed by R l and RV1 a t t e n u a t e s t h e supply voltage and p r o d u c e s t h e signal input to t h e c o m p a r a t o r , s u c h that a supply range of 9 -... e g r e e s at a point a p p r o x i m a t e l y 5 mm from t h e b o d y TR1 BC548 TOP view H i e t ci LM3914 R V1 D1-3 D4-7 08-10 TIL red orang* green 209 PIN VIEW BOARD OUTLINE Figure 4.1 C i r c u i t diagram 111 Auto electronics projects Figure 4.2 PCB ( s e e Figure 4 3 ) E a c h LED is i n s e r t e d from t h e c o m p o nent s i d e of t h e PCB t h e n s o l d e r e d in p o s i t i o n to... e i s an a p p a r e n t pos- s i b i l i t y of v e h i c l e s , present zener damage t o due to high on t h e s u p p l y diode may be the LM3914 voltage line* f i t t e d IC i n spikes some being The o p t i o n a l across the 15 V supply p r i n t e d c i r c u i t b o a r d p i n s a s shown i n F i g u r e 4 7 t o make s u r e t h i s d o e s n o t occur LOOOOOO 2D1 D D D D D 2 3 4 5 6 o m no... o p r o t e c t t h e b a t t e r y wiring in t h e e v e n t of a s h o r t c i r c u i t T h e unit is now c o m p l e t e and r e a d y for c a l i b r a t i o n 113 Auto electronics projects 12 , 12 20 (or γ—I IS Zip wire exit hole' PCB mounting Bock Front (insiovTbox) Hole dato: A - # 3mm Β *• # 3.5mm In mm C « 0 4.5mm Figure 4.4 Box d r i l l i n g details Lid Track side Back Figure 4 .5 Component... u i c k s t i c k pads are supplied with t h e kit t o mount t h e b o x o n t o t h e d a s h b o a r d if r e q u i r e d , and r e m e m b e r to s e c u r e t h e wiring away from hot or moving p a r t s using c a b l e t i e s ( o r d e r c o d e B F 9 1 Y ) as a c c i d e n t s c a n b e e x p e n s i v e if n o t d a n g e r o u s H a p p y motoring! 1 15 Auto electronics projects Take n o t... Alternatively, it could b e c o n n e c t e d to the ancillaries side of t h e ignition s w i t c h 109 Auto electronics projects T h e c a r b a t t e r y m o n i t o r will even reveal faults like a slipping fan-belt: a p r o b l e m which p r e v e n t s t h e b a t t e r y from c h a r g i n g p r o p e r l y , but l e a v e s t h e d a s h b o a r d b a t t e r y warning light off It will even s h... with M3 nuts ( s e e Figure 4 5 ) T h e zip wire s h o u l d now b e s o l d e r e d to t h e v e r o p i n s ; fit t h e Ρ clip t o t h e zip wire and s e c u r e it to t h e M3 χ 16 mm s c r e w using a s e c o n d M3 nut Having fitted t h e zip wire, i n s e r t t h e fuse h o l d e r in t h e p o s i t i v e (+) supply line as c l o s e t o t h e b a t t e r y as p o s s i b l e ; s e e Figure... rapid s p e e d c h a n g e s , and ( 2 ) m e t e r s tend t o b e s o m e w h a t fragile 119 Auto electronics projects T h e t a c h o m e t e r d e s c r i b e d h e r e o v e r c o m e s b o t h of t h e s e d i s a d v a n t a g e s by c o u n t i n g p u l s e s and displaying engine r e v o l u t i o n s o v e r a v e r y s h o r t time, as t h e digital display is c o n t i n u o u s l y u p. .. Γι% Γ\Λ ηκ ne > PCB Figure 4.7 116 Adding zener diode protection to the module Car battery monitor Car battery monitor parts list Resistors — 0.6 W 1% metal film RI 27 k 1 (M27K) R2 lk2 1 (M1K2) R3 15 k 1 (M15K) RV1 10 k hor e n d p r e s e t 1 (UH03D) RV2 47 k hor e n d p r e s e t 1 (UH05F) mini LED red 3 (WL32K) D4-7 mini LED o r a n g e 4 (WL34M) D8-10 mini LED Green 3 (WL33L) TRI BC548 1 (QB73Q) . lock-ups in 5 to 10 ms. Put another way, the microcontroller must be able to determine 4 independent wheel speeds from 6000 Hz 103 Auto electronics projects signals within a 5 ms window,. calibration. 113 Auto electronics projects Zip wire exit hole' 12 , γ—I Bock 20 (or PCB mounting (insiovTbox) Hole dato: A - # 3mm Β *• # 3.5mm C « 0 4.5mm Figure 4.4. (that acts as a watch-dog for the main ABS microcontroller. This slave device is pro- 1 05 Auto electronics projects grammed to monitor the major activities of the master and it has the ability