NAKED LOAD
Context
● You are developing an embedded application using one or more members of the 8051 family of microcontrollers.
● You are designing an appropriate hardware foundation for your application.
Problem
How do you connect a piece of low-voltage (≤ 5V), low-power (≤ 100 mW) DC equip- ment to one of the port pins on your (8051-based) application?
Background
See NAKED LED [page 110] for general background material.
Solution
In NAKED LED [page 110] we considered how to connect an LED to a port pin of an 8051 microcontroller. In this pattern we consider a more general situation where we wish to control any small DC ‘load’ (Figure 7.6).
This shows a general (unspecified) load connected to the port pin.
The main difference between the general load and the LED is that the required voltage drop across the load will (typically) be 5V (in a 5V system: 3V in a 3V system),
rather than the 2V seen in the case of LEDs. In these circumstances, the resistor may be omitted, since the required resistance value will be:
Hardware resource implications
Every implementation of this pattern uses at least one port pin.
Reliability and safety implications
IC BUFFER [page 107] discusses techniques for buffering LEDs and other small loads. This can increase the reliability of some applications.
Portability
All microcontrollers can control small loads in this way.
Overall strengths and weaknesses
The techniques discussed in this pattern allow small loads to be driven from a microcontroller port with a minimum of external hardware.
This is a low-cost solution.
Only applicable for small loads (and small numbers of very small loads), other- wise a buffer will be required: see IC BUFFER [page 118].
Related patterns and alternative solutions
See PORT I / O [page 174] for software details.
See the pattern IC BUFFER [page 118] for techniques suitable for driving two or more small loads from a single microcontroller.
See the patterns BJT DRIVER [page 124], IC DRIVER [page 134] and MOSFET DRIVER
[page 139] for techniques suitable for driving higher powered DC loads.
Example: Buzzer
A range of piezoelectric buzzers are available that generate very loud (~70 dB) tones at microcontroller port voltages (they will operate from 3V to 12V) and currents (they require around 3 mA). These make excellent warning devices, even in battery- powered applications (see Figure 7.7).
As we discussed in ‘Solution’, this 5V load requires no series resistor.
Further reading
Horowitz, P. and Hill, W. (1989) The Art of Electronics, 2nd edn, Cambridge University Press, Cambridge, UK.