Embedded Control Systems Design/Hardware peripherals
This chapter looks at the hardware components (except the processor architectures, discussed in another chapter) that occur in the embedded control systems this book focuses on. More and more, the components discussed in this chapter are not pure hardware anymore, but become embedded systems in themselves, with a growing amount of software functionalities.
The focus is not on the technical details of how this hardware works, but on the information that the systems design engineer needs to make appropriate choices.
- Buses (electrical, EMC, protocols)
- Digital IO (input, output)
- PWM (Pulse Width Modulation)
- Motor amplifier
- Encoders, resolvers, Hall sensor
- 1 I/O modules
- 2 Signal converters
- 3 Sensors
- 4 Filters
- 5 Actuators
- 6 Practical aspects of hardware interfacing
- 6.1 Sources of noise
- 6.2 Input section isolation
- 6.3 Tips and tricks
- 6.4 further reading
- 6.5 References
In most embedded systems a lot of different types of hardware are all connected to each other. This connection is usually done either mechanically or by using a voltage (sometimes also current) signal over a cable. Typical embedded systems tend to have a lot of different cables with signals, coming from different locations, but going to the same controller. These controllers, on the other hand, only have a few I/O ports. I/O modules have a large number of (mostly digital) inputs and outputs, depending on the type. Communication between the I/O module and the controller occurs through one connection over which both the inputs and the outputs are sent. The I/O module doesn't change the signals on this connection, it only edits them (in a reversible way) such that they can be sent using only one connection. Depending on the type of I/O module, the signals should first go through a ADC/DAC, before being passed on to the I/O module.
The I/O module and the controller typically communicate over a "twisted pair" of wires. The other kinds of connections, and the technical details of the signaling protocol, are outside the scope of this book. If you want more details, see Embedded Control Systems Design/Field busses, Robotics: Computer Control: The Interface: Networks, and the serial communications bookshelf.
Analog-to-digital converters (or ADCs) convert an analog input signal (generally a voltage signal) to a digital number. This is a crucial step in hardware interfacing. The practical choice of a converter depends on the desired resolution (mostly 6-24 bits). ADCs are usually preceded by a sample and hold circuit, which samples the input voltage (at the sampling rate) defined by the clock signal and then holds that value for a short time.
Several sampling errors may occur, but can be easily avoided by looking up the device's specifications. Quantization noise is caused by the finite resolution of the ADC. It is an unavoidable kind of noise, but can be reduced to almost any level by using a higher resolution. Thus the signal-to-noise (quantisation noise at least) ratio depends entirely on the resolution.
A second common error is aliasing. Aliasing is due to the finite sampling rate of the sample and hold circuit. If high frequency content is present in the signal (and there always is high frequency noise, for example) then the ADC can not deal with this correctly. When aliasing occurs, this high frequency content, which one might expect to be cut off, will alter the low frequency (and thus desired) content of the signal. In principle, aliasing is avoided when the sampling frequency is higher than the Nyquist frequency (twice the bandwidth of the input signal). To avoid influence by high frequency noise, and to make the ADC more robust, the input signal can also be low-pass filtered before the conversion takes place.
Digital-to-analog conversion is a lot like analog-to-digital conversion.
Bandwidth restrictions are determined by the maximum switching speed, and thus the maximum speed at which a digital signal can be processed. These restrictions are entirely due to the nature of the circuit, and cannot be altered. The DAC output is usually a piecewise constant function (zero-order hold). The output value is determined by the digital input and the clock signal. It is held during a clock period, which leads to sharp corners, and thus high-frequency content. The DAC is followed by a low-pass filter.
Digital-to-digital conversion is another possibility. With or without getting a clock signal supplied from the controller, small converters can perform a lot of simple operations on digital signals. Changing the bit depth or sample rate are among the possibilities. Whether or not there is a need for a separate wire to the controller for the clock signal depends on the type of operation, and also on the line code. Not having to draw a wire to every digital to digital converter in the system can be quite an advantage. Manchester code for example allows for easy extraction of the clock signal, and can thus be used in digital to digital converters that perform virtually any type of operation. This type of coding (or supplying a clock signal) can be used to perform complex calculations and operations far beyond a simple conversion.
Sensors measure the system outputs and present them as inputs to the controller. Often the signal that a sensor generates is too weak, or needs to be modified before it can be transmitted. Effects to be taken into consideration are the in-and output impedances, the linearity of the sensors and the amplifiers, limiting the influence of cable length and other disturbances, etc. Different types of circuitry have been built to deal with these issues. A lot of sensors are bundled with this equipment, often in the same housing. Commercial packages are also available that contain the required devices to hook up to the sensor. These (mostly) electronic devices are mostly made out of operational amplifiers, transistors and RLC circuitry. Comparators, high, low and band-pass filters, source-followers and all kinds of amplifiers are made out of these components.
There are two types of rotary encoders: absolute and incremental encoders.
Absolute rotary encoders
An absolute encoder measures the angular displacement. Its output is a digital signal. The resolution is restricted and determines the accuracy of the complete embedded control system. This encoder can be directly connected to the controller (because of its digital output). Analog versions, such as potentiometers, output an analog signal and thus require an ADC between their output and the controller.
Incremental rotary rotary encoders
These encoders measure the relative angular displacement. The resolution is, as always, restricted. They output a pulse each time a certain angular displacement takes place. The resulting signal is analog, and has a DC-component. The output is unclocked, which means the sample frequency is not predefined. The rotational speed is measured by the distance between the output pulses. An additional counter that counts the pulses and generates a digital output signal is needed. Several (more expensive) encoders come with this extra piece of hardware built-in. They are as easily connected to the controller as encoders of the absolute type.
Both types of rotary encoders require a feeding signal, on which the output amplitude depends. A digital output signal is relatively insensitive to noise, which means a small amplitude will do the trick.
Resolvers do exactly the same as absolute digital encoders, but output an analog signal.
Tachometers (Hall effect sensors)
A Hall effect sensor is a type of tachometer, used for measuring angular speed. Both the output voltage and frequency are proportional to the angular velocity. It thus produces an analog output signal, more or less like that of incremental encoders.
Other types of tachometers include, for instance, a simple DC-generator, which generates a voltage, proportional to the motor angular velocity, across its main leads.
Proximity sensors allow the user to measure the distance to or the presence of an object. Proximity sensor work in a lot of different ways.
Types of sensors
Hardware filters are used to reject noise from a measured signal. Most common are low-pass, high-pass, band-pass and band-stop filters. Filtering obviously only improves the signal-to-noise ratio when the frequency range of the signal differs from that of the noise.
Electrical motor drives
Commercial motor drives are easily configured. A drive can be analog or digital. A software version that runs on the controller's microprocessor is another possibility. There is always need for a module that converts the feeding signal according to the (small) input signal. Commercial drives have these built-in. Several types of these modules exist: pulse width modulators, choppers. These modules make use of thyristor/transistor switches. In the past, thyristors were more widely used, but now transistors (MOSFET/IGBT) are more popular (in low and medium power applications, that is). Thyristor circuits are still frequently used in more powerful applications (in the order of several megawatts), though. E.g.: wind turbines.
The feeding signal may need to be transformed and converted to DC, or shifted in phase, before it is presented to the motor itself.
The start-up of alternate current induction motors leads to a large current peak. This is never the case in normal use, but it might cause problems after a sudden power shut-down. A special start-up device that is switched off when a certain speed is reached, can resolve this possible problem. It may also be considered within the control system itself. The hardware then remains unchanged. Both the input signal and the feeding signal can be filtered to avoid excessive motor noise.
Stepper motors are often used in positioning systems. The controller sends the desired number of steps to the motor, in which transistor switches are turned on or off in the appropriate order.
Pneumatics and hydraulics
Pneumatic and hydraulic circuits make use of fluids (resp. gasses and liquids) under pressure. These can be present outside of the control system and fed to it. The pump or compressor can also be a part of the embedded system itself. It is then controlled by the controller. Pneumatic and hydraulic circuits consist out of valves that are driven by a mechanism, an electrical current (solenoid valve) or another pneumatic/hydraulic circuit.
Mechanism driven valves
Pneumatic/hydraulic valves can be driven by a mechanism or a cam-follower system. The mechanism's purely mechanical structure forms the base of a self-controlling scheme. There is little interaction with the controller. The rotational speed of the cam, or a given movement of a branch in the mechanism can be controlled, but the shape of the cam or the mechanism determines the movements of the valves. E.g.: a pneumatic Finite State Machine. The dynamics are restricted by the bandwidth of the spring (in a cam-follower system) and/or the valves themselves (depending on the type).
Solenoid valves can also be used. A fast response, and thus, a large force, is often desired. This leads to large currents. A certain feeding signal is required. This is taken care of by a power circuit with, among many other devices, a current transformer in it. The currents used are large, but the power is not. These circuits are thus different from the ones used in motor drives, where the power consumption is much higher. The dynamics are restricted by the bandwidth of the valves, which is a lot lower than that of the electrical components.
When dealing with high pressures and large flows, several cascaded valves are used. The first one is then driven electrically or mechanically, and then, in its turn, uses the fluid under pressure to drive the next one.
Driving of the valves
Most of the time, the valve blocks are driven by the central controller, through busses and substations. This is especially the case in larger, industrial systems. Such a hierarchical system is quite clear and allows for the design of very complex structures. There is also the possibility of a real mini-ECS: a controller with 'built-in' valve block. This last solution is compact and works on its own. E.g.: the anti-lock braking system (ABS) in cars.
Practical aspects of hardware interfacing
In order to clearly decouple the useful data from noise, good interfacing is necessary. When cabling is done improperly, electrical noise from the nearby environment can easily be introduced in the circuit. Therefore much attention is needed when making interconnections. In this text, the reader can get a feeling with some common problems about interfacing. At the end, there is a section with some general tips.
Sources of noise
Interference noise due to a common impedance
If two circuits have a current path in common, that common path could couple signals of those circuits due to its impedance. This often happens when several circuits use one single path to return current to their power supplies.
A current transient in a digital circuit (when switching logic state) will briefly shift the “ground” reference for the analog circuits.This problem is more important in analog circuits, because of the absence of "noise immunity". Digital systems are -upon a certain level- less sensitive for these effects.
Interference noise due to capacitive or electrostatic coupling
Between any two conductors in a system, there exists a capacitance if the space between them is filled with a dielectric insulator. If the receiving circuit has a large resistive impedance, the related noise signal is affected by the noise signal of the source. This effect is more important at high frequencies. To avoid this electrostatic coupling, the best method is to use an electrostatic shield. In this way the entire circuit is enclosed by a metal screen. From the principle of the 'Faraday cage' follows that the influence of external voltages will be zero inside the shield. A problem is that there will be a stray capacitance from this shield to every conductor within. This reduces its effectiveness. It is clear that this problem will not occur when the digital and analog grounds are kept separate.
Interference noise due to inductive coupling
Two conductors which are close together may have a significant mutual inductance between them. An alternating current in the power circuit then induces a series mode interference voltage in the input circuit. This inductance depends on the geometry of the two circuits, namely on the overlapping length and separation. Inductive coupling will occur even if the measurement circuit is completely isolated from earth. To twist the conductors is the simplest way to reduce the effects of inductive coupling to an external interference. This arrangement is commonly known as twisted pairs. The magnitude of the interference voltage induced in a given loop is proportional to the area of the loop and the rate of change of the external magnetic field. The sign of the induced voltage depends on the orientation of the conductors. In the ideal case of both loops having the same area and experiencing the same magnetic fields, there is a zero resultant induced voltage.
Input section isolation
Isolation amplifying is often used in combination with sensors, because sensors are often weak and sensitive components. An isolation amplifier has a fixed differential gain over a wide range of frequencies, high input impedance, and low output impedance. In addition to that, an isolation amplifier's input is separated from its output and power supply. This way the sensitive and weak input component is secured. Often used techniques for isolation are electromagnetic isolation and optical isolation.
An electromagnetic isolation couples an amplified signal between circuits through an air-core transformer. The signal is first modulated on a higher frequency. The air-core transformer blocks the low frequency components (like the DC and 50Hz power supply). After the signal is transmitted through the transformer, it is demodulated and amplified again. In addition a second transformer can be used to supply the first circuit of power, this way no batteries are needed.
When optical isolation is used, the transmitted signal is first modulated and then send by a solid-state photo emitter to the photo detector of the second circuit. This way, both circuits are completely electrically decoupled. But this approach requires a battery to be included in the emitting circuit.
Tips and tricks
- Since mutual inductances and coupling capacitances between measurement and power circuits are inversely proportional to the distance between them, this distance should be as large as possible.
- Every current that comes from a power source must go back to that power source
- Every conductor has a finite resistance and impedance, this means that a 'ground' conductor could contain a DC shift and voltage spikes.
- Check your power supply for voltage spikes with an oscilloscope while the circuit is running.
- Circuit boards can have a 'ground plane', use it as a electromagnetic shield and not as a conductor to return current.
- The power supply should be heavily wired to minimize voltage drops.
- Use capacitors (from 1 to 100 microF) between the power supply conductors and their ground return conductors. Hereby the supply voltage is stabilized for external interference (50Hz to 1MHZ) and short voltage drops.
- Use Mylar capacitors across voltage supplies of digital circuits to minimize the effect of short surges of current. Put them also across analog chips that have to be protected form these surges.
- Embedded Systems/High-Voltage Circuits
- Analog and Digital Conversion
- Practical Electronics/PCB Layout
- PMinMO wiki describes controlling machines, typically CNC machines, from a standard desktop computer. Has a lot of information about motors, motor drivers, and mechanics.
- Open Circuits has motor driver information.
- Stephen E. Derenzo, “Practical interfacing in the laboratory”, Cambridge University Press, 2003.
- Harold S. Stone, “Microcomputer interfacing”, Addison-Wesley Publishing Company, 1982
- John P. Bentley, “Principles of measurement systems”, Pearson Prentice Hall, 2005