Solutions for Digital Controllers
We live in an era of electronics where multiple voltage levels are commonplace in any system design. That means voltage level translation is a constant issue to resolve. In this article, Wolfgang focuses on voltage translation between digital controllers and their application environment. He discusses the principal problems and provides examples.
Broadly speaking, a digital controller can be defined as a device or module built with digital ICs that acts as a control unit in a real-world application environment. It can be, for example, an industrial PC, a microcontroller (MCU)-based programmable logic controller (PLC) or a purpose-built device based on CPLDs or FPGAs. Inevitably, the digital controller and the circuitry of the application environment have different supply voltages and signal levels. Therefore, connecting both requires solving problems of level translation.
The interfaces of the application circuits operate with voltages in the magnitude of some tens of volts—24V is considered a typical industry standard. Even higher voltages—like in the electric grid—are in a different league of power electronics and we won’t look at those here. In the digital controller, we assume voltage levels of 5V down to less than 1V. Given his wide range of voltage levels, we may expect level translation even within the digital controller’s circuitry.
Voltage-level translation between digital circuits—in other words, within the digital controller platform—has been discussed by Robert Lacoste in his comprehensive article “Voltage-Level Translation Techniques” (Circuit Cellar 365, December 2020) . IC manufacturers provide an abundance of datasheets, application notes, whitepapers and webinars with information on the subject. But here we will concentrate on level translation between the digital controller and the application environment. We will discuss principal problems and design rationale. Our examples will be small projects—aptly dubbed 24V MCU and 24V CPLD systems. Apart from being easy to comprehend, these could be of some value in real-world applications as well. More details may be found in the accompanying material provided on Circuit Cellar’s article materials webpage.
SCOPE OF THE PROBLEM
A digital controller—basically a computer platform—is connected to an application environment as shown in Figure 1. Such arrangements come in many flavors of size, performance, complexity and form factor. To discuss our topic in detail, we’ll concentrate on three form factor examples: the industrial PC (IPC), the compact programmable logic controller (PLC) and the purpose-built embedded system.
The development of industrial PCs began with PCs in rugged cases, equipped with dedicated I/O adapter boards. Cables from the factory floor are attached to racks in the controller’s cabinet . Computer and racks are connected via ribbon cables (Figure 2). Probably the most common format of legacy computer interface comprises up to 24 programmable digital I/O lines. The number 24 is because the peripheral IC then preferred was the Intel 8255, supporting three 8-bit ports. The supply voltage is 5V, the signal levels are TTL-compatible . Such racks are populated with input and output modules, one module per I/O signal. It is the modules that perform the level translation. They are chosen according to the requirements of the application environment. Further development led to miniaturized computer platforms. Therefore, racks as shown in Figure 2 can be equipped with their own computer modules .
Initially, programmable logic controllers (PLCs) were designed for applications that did not require a full-fledged computer. The first PLCs were essentially Boolean processors to emulate relay-based controllers. Today, they are compact self-contained computing platforms for all kinds of control tasks (Figure 3;  to ). Purpose-built embedded systems belong to the same category. The essential difference is that they are designed to fit into their particular application environment (for example, a household appliance) instead of being clipped onto DIN rails or mounted on racks. Both have in common that the level-translation circuitry is closely adjacent to the information-processing ICs, like MCUs, CPLDs and FPGAs.
More often than not, all those components are located on the same PCB. When you are developing such a dedicated embedded controller, cost will be your primary design criterion. When developing an industrial PLC, priorities will be reliability, versatility and compliance to various standards and regulations. With regard to level translation, all those digital controllers, as different as they are, may be represented by one block diagram (Figure 4). The main difference is only in packaging or compactness, respectively.
Adapting the application environment is done by appropriate wiring. Systems based on pluggable modules, as shown in Figure 2, provide for some flexibility. It is the module that makes the associated terminal an input or an output. In typical compact PLCs, however, the inputs and outputs are rigidly determined by design. A limit switch must be connected to a digital input, a relay to a digital output, a sensor to an analog input, and so on.
In the past, level translation problems were often solved by discrete components or small-scale (SSI) integrated circuits. Meanwhile, the magnitude and importance of the level-translation tasks have caused the semiconductor manufacturers to provide a broad portfolio of specific level-translation ICs. They differ mainly in the number of signals, the interface to the digital circuitry, ranges of signal levels and supply voltages, and which directions of signal flow they support.
Industry-grade translation ICs come in two flavors: with a parallel or a serial interface. The latter is typically an SPI interface or a purpose-designed shift-register interface. In PLCs centered around an MCU, serial interfaces are preferred (Figure 5), thereby reducing the number of signal paths and required MCU pins.
REASONS FOR MULTIPLE LEVELS
To affect something in the real world, we need power. Power equals voltage times current. So, a certain amount of power can be brought on by a lower voltage and a higher current or vice versa. The permissible voltage depends on insulation, the permissible current on the conductor’s cross-section. In other words, higher voltages require better insulation or wider distances between conductors, higher currents require more copper. This the most important reason to prefer higher voltages. Anyone who is somewhat interested in antique cars will know that, in bygone times, the electrical system worked with only 6V (or three 2V lead-acid cells). Later, improved insulation materials allowed for 12V, 24V or (in present day) even 48V.
The voltage, however, cannot be increased limitlessly. An upper voltage limit is given by the maximum voltage the insulation and the switching devices (like relays or transistors) can withstand. Plainly said, higher voltages may require wider distances between PCB traces, larger terminal strips, bigger relays, wires with thicker sleeves and so on.
A further requirement is electrical safety . Supply voltages and signal levels must be in a range posing no threat to humans. A voltage in this range is dubbed SELF (Safety Extra Low Voltage) or PELV (Protective Extra Low Voltage). The difference is that PELV circuits are grounded, and SELV circuits are not. The maximum admissible voltage is 50V AC or 120V DC.
Such considerations led to the industry-standard 24V in control systems. It will pose no particular problem to apply such a voltage on PCBs populated with information processing circuits (digital and analog). Everything operating with more than 24V is in the realm of power electronics. They need to be attached outside or requires special care when components are placed and traces routed.
Digital ICs have much lower supply voltages and signal levels. Over decades, 5V was the dominant industry standard. Nowadays, voltages seem to decrease with each new circuit generation. They are down to somewhat around 1V or even less. This follows from shrinking geometries. It is easy to see that the insulation between densely adjacent conductors—nowadays we speak of nanometers here—can withstand only very low voltages. On PCBs or in cables, however, signal levels thus low are not sufficiently above the inevitable noise caused by crosstalk, ground shift, power line interference, and so on. Therefore, such ICs have at least two supply voltages, the core voltage supplying the logic circuity within, and the I/O voltage powering the I/O stages. Typical I/O levels are in the range between 2.4V and 3.3V.
24V ISN’T ALWAYS 24V
Traditionally, 24V circuitry in industrial control equipment is not powered by a regulated supply voltage. Instead, power is provided via a transformer, bridge rectifier and filter capacitor. Such straightforward power supplies will cause the nominal 24V to vary over a wide range. The supply voltage may be as low as 18V to 21V. On the other end, we should expect up to 36V to 40V. Level-translation circuits have to cope with this range (Table 1).
The voltage range depends above all on the fluctuations of the grid voltage and the load regulation of the transformer. In industrial circuitry, special types of transformers are used, the so-called industrial control transformers, showing a load regulation of not more than 10% .
Load regulation is the percent change in output voltage when the load goes from full load (VFL) to no load (VNL).
The voltage ratio of a typical control transformer is 0.2 for the 115V grid and 0.1 for the 230V grid, respectively.
Principally, the output voltage equals input voltage times voltage ratio. The particular value, however, depends on the load. If the transformer is fully loaded, the output voltage corresponds to the root mean square1 (RMS). If the transformer runs idle, the output voltage is nearly equal to the peak voltage, being approximately VRMS times 1.4.
The worst cases are (1) lowest grid voltage and full load and (2) highest grid voltage and no load. The admissible range of the grid voltage equals the nominal value ±8.7% (105V to 125V or 210V to 250V, respectively). For example, full load corresponds to 105V × 0.2, yielding 21V; no load corresponds to 125V × 0.2 × 1.1 (regulation) × 1.4 (peak value), yielding 38.5V.
THE IEC 61131-2 STANDARD
The numbers given in Table 1 for the low level, threshold voltage, and high level are typical legacy values. Contemporary industrial equipment is expected to comply with the standard IEC 61131-2. This standard embraces the logic levels of 24V digital inputs. There are three types. Type 1 concerns mechanical contacts and 3-wire sensors drawing a comparatively high quiescent current. Type 2 relates to 2-wire sensors, type 3 to 2- and 3-wire sensors with reduced power consumption. The logic levels are shown in Table 2, the operating regions in Figure 6.
The specifications of voltages and currents are somewhat intricate. If you want to develop a compliant device, you may have no other choice than to study the IEC standard  and the corresponding knowledge base. For insights, see  through . For a beginner, however, it should suffice to remember the basic voltage ranges: Low (OFF) corresponds to –3V to 5V, High (ON) to 11V to 30V.
Small 24V projects: To begin developing a fully-fledged, industrial-grade PLC, would be way too much. It is not the principles of operation posing insurmountable difficulties but intricate details, like crosstalk, isolation voltages, overvoltage and ESD protection and grounding. However, most of the development effort is probably to be spent to comply with the plethora of standards and regulations (in , for example, you will find a list of such regulations together with their corresponding logos). Consequently, to solve a real-world application task, you will have no choice but to buy modules or complete systems, as shown in Figure 1, Figure 2 and Figure 3. On the other hand, such projects become feasible when we neglect the tougher requirements—as is the case in the typical tinkering ecosystems like Arduino or Raspberry Pi.
24V MCUs and CPLDs: This idea arose when contemplating small IoT Projects. Signal levels should be sufficiently above the noise floor, caused by crosstalk, ground shift, and power line interference. Outside of a single PCB, cables could be as long as 5’ (1.5 meters) or more. In such an environment (as illustrated by Figures 1 and 2), the well-known 5V may be considered a proven minimum. It is not without reason that 5V MCUs are still manufactured and even new devices developed. So, it is only a logical stepto imagine a MCU with 24V supply voltage and signal levels. Further practical considerations led to the supplementing idea of a 24V CPLD. Both may become useful building blocks for Internet-of-Things (IoT) projects (Figure 7).
What impedes casting such an idea in silicon is, to put it simply, the size of transistors and the resulting die size. The processor core of a small (8-bit) MCU requires a few thousand transistors, the memories much more. When all components are laid out to cope with 24V, then the die would be much too large. So, it makes sense to distribute the tasks of processing and 24V I/O on different dies and to provide for the necessary level translation.
It’s possible that the emergence of chiplet technologies will lead to 24V IoT systems in a single package. Today’s projects, however, must be implemented on PCBs. Our 24V device would be a small PCB containing an off-the-shelf MCU or CPLD together with industrial-grade level translation and 24V I/O ICs, accompanied by the necessary power supply circuits. Boards of this kind will be typically small, having only a few inputs and outputs. Overvoltage and ESD protection depend solely on the provisions built into the level-translation circuits.
WHAT’S A 24V CPLD GOOD FOR?
A 24V CLPD could be a solution for the problem of implementing logic functions at the 24V level. Sometimes, there is a need for such functions, for example, for diagnostic purposes or because they are necessary to comply with safety requirements. For example, relay X must not be energized if one of the switches A or B is closed and relay contact C is open. You may think this could be done by appropriate programming. However, we know that programs may fail, not to speak of malfunctions caused intentionally by injecting malware via network connections.
Yes, safety in industrial controls is a science in itself, and one could buy appropriate solutions. However, sometimes the simplest solution would be best, hard-wired logic that will not be affected by a software crash and cannot be sabotaged via the Internet. Occasionally, such problems have been solved, for example, by 24V logic based on diodes and transistors. It goes without saying that we can implement only very elementary functions this way. In comparison, a CPLD can support logic (Boolean) functions of nearly unlimited complexity.
With appropriate 24V devices, we could add a new layer of safety and diagnostic functions based on pure logic, far above the capabilities of a few gates. Perhaps, such functions are useful to augment and supervise artificial intelligence. A perspicacious example is traffic control. You can easily imagine controlling traffic lights through artificial intelligence (AI). Such systems will learn and adapt to provide for an even more smooth flow of traffic.
Under no circumstances, however, is it acceptable to switch on the green lights for intersecting lanes simultaneously. It is easy to see that such restrictions can be described in terms of Boolean functions. In practice, they may be by far not as straightforward as in the example. By computing such functions, the decisions of the AI algorithms may be checked and supervised. The salient point is that modules of the kind proposed here should be, in such applications, totally independent of the IoT infrastructure and software. That ensures that safety and diagnostic functions cannot be impaired by faulty programming or attacks from outside.
TWO FLAVORS OF A 24V CPLD
The purpose of our device is to implement combinational and sequential Boolean functions. This can be done by providing a real CPLD connected to level-translating circuitry. To program CPLDs and FPGAs, however, we need dedicated design software, such as the systems delivered by the circuit manufacturers. After the design has been entered—as a schematic or in a hardware description language—a process will be run called Boolean synthesis. Synthesizing a circuit out of a description, however, may be a time-consuming process. Even after the simplest design change the synthesis must be executed again.
A CLPD is very fast, switching in nanoseconds. In contrast, typical 24V circuitry operates far slower. Here we speak of milliseconds. This fact leads quite naturally to the idea to do without the CPLD and, instead, to emulate the Boolean functions on an MCU. Such a 24V CPLD would be a 24V MCU appropriately programmed. So, each engineering change would be a straightforward software update.
To combine both on one PCB is an obvious idea, too. It goes without saying that FPGAs would be the next logical step to implement even more sophisticated devices. It is, however, a much tougher design challenge. For our small, humble devices, however, it may be more purposeful to combine two components that are inexpensive and comparatively easy to work with. For more along those lines, check out the addendum to this article on Circuit Cellar’s article materials webpage.
The I/O pins of a MCU or CPLD can be programmed individually to be inputs or outputs or bidirectional bus lines. The primary reason behind programmable I/Os is not the bidirectional bus but to provide versatile integrated circuits that can be adapted easily to various application requirements. The ability to change direction on the fly is only an occasionally useful side effect.
An IC’s package is one of the most expensive parts of a chip. In comparison, registers, gates and transistors are much cheaper. Consequently, IC manufacturers strive to get by with a small package and a minimum number of pins usable for different functions. To this end, they invest heavily into the fabric of I/O circuitry. The reference manuals of the MCU families show the respective block diagrams. It is quite impressive how much logic circuitry is provided to support each individual I/O pin.
TRUE (BIDIRECTIONAL) 24V I/O?
Is there any need for true (bidirectional) 24-V I/O? One reason could be to read the outgoing signals back, for example, for diagnostics. However, a bidirectional stage cannot keep the signal energized if switched to the input direction. So readback can be implemented only by connecting the output to an input (loopback). Another reason is flexibility. Cables run from the factory floor to the controller’s cabinet. They are connected to terminal blocks, as shown in Figure 2 and Figure 3.
Now imagine that something is modified or changed. For example, consider a cable that was previously connected to a limit switch is now to be attached to a relay, thus changing from an input to an output. An industrial PC system, as depicted in Figure 2, may be changed by swapping the module assigned to this wire and modifying the software. A PLC, as shown in Figure 3, would require moving the wire from the input to an output terminal.
In larger installations, the cables from the factory floor end in racks or panels separate from the PLC hardware. The connections are made by patch or marshalling cables . Changing connections is confined to the controller`s cabinets, somewhat similar to the patch panels and switches of the local networks.
This way, the field wiring—being cost- and labor-intensive—remains fixed. Nevertheless, changes require manual intervention. True I/O stages, their direction being programmable, could alleviate this problem. The cable attachments remain, the direction will be changed by software as required. Appropriate ICs are available.
In PLCs like those shown in Figure 3, in pluggable modules or our 24V projects, it is a question of optimization. Bidirectional programmable I/O will make the device more flexible but certainly somewhat more expensive. It will be also more laborious to use. If inputs and outputs are rigidly assigned to particular terminals, a new device can be simply unwrapped, fastened and connected. Programmable I/O, however, must be programmed before use.
STAGES OF LEVEL TRANSLATION
When a comparatively small die is to be populated with a vast number of transistors, the supply voltage must be kept low. Therefore, the more advanced MCUs, CPLDs, and FPGAs have at least two supply voltages, the internal core voltage, and the I/O voltage.
While core voltages may be circuit-specific, I/O voltages correspond typically to an industry standard. 3.3V are suitable for connections on a PCB, even if a somewhat larger, and with adjacent PCBs. 5V is the venerable industry standard for logic signal in racks and cabinets, 24V for the field wiring on the factory floor. Accordingly, level translation is done in stages, as shown in Figure 8. For example, 5V signalization allows you to attach racks and modules as shown in Figure 2. On PCBs, 3.3V signalization is adequate. For translation between these stages and even lower voltage levels, I refer you again to Robert Lacoste’s article .
Typically, the requirements of the 24V interfaces (for example, to comply with IEC 61131-2) will be the starting point when selecting suitable level-translating components. At the other end is the MCU (or CPLD or FPGA), chosen according to other considerations, for example, performance or compatibility. With these requirements in mind, you will have to shop for appropriate components.
The most straightforward solution would be using simply a 5V MCU and relegating more complex processing functions to other devices (for example, via an Ethernet link). In my article “Emulating Legacy Interfaces” (Circuit Cellar 327, October 2017 ) I described how MCUs may emulate legacy bus interfaces like ISA or PCI. In that case, readily available PC/104 modules and add-in boards for industrial PCs may be employed. To avoid these legacy devices, you may design the I/O circuitry yourself and attach it directly to the MCU. However, when doing so, think of the standards and regulations your hardware has to comply with.
INTEGRATED LEVEL TRANSLATORS
Figure 9 through Figure 17 each illustrate some characteristic features of ICs translating signal levels between 5V or 3.3V and 24V. Such circuits comply with various standards concerning the signal levels of ones and zeros, overvoltage, and ESD protection. All these Figures are generic block diagrams extracted from various data sheets and application notes. Moreover, they are heavily simplified. The designations and signal identifiers are generic, too. Here, we can only introduce the very basics.
When you intend to use such components in your projects, you will have quite a lot to read. There is no other way than to devour the manufacturer’s documentation and to study its knowledge base. To get a first impression, refer, for example, to  to . We start off with Figure 9, which shows a generic multi-channel input translator, and Figure 10, which shows a generic industrial driver/switch.
There are ICs with a parallel or a serial interface. Parallel interfaces have as much data signals at the logic side as at the 24V side. They may be supplemented by control and status or fault-indicating signals. Typical serial interfaces adhere mostly to the SPI industry standard or are straightforward shift register interfaces, as shown in Figure 11. Those interfaces allow for daisy-chaining multiple level-conversion ICs. The serial interface is not confined to data transfer. It allows accessing configuration and diagnostic registers, too.
When developing a 24V MCU, we may prefer serial interfaces to reduce the number of MCU pins required. On the other hand, when a CPLD is the core of our device, parallel interfaces may be better suited because serial interfaces need serializers, deserializers and state machines to control them, thus eating up precious CPLD macrocells.
Power supply and monitoring: Many level-translation ICs contain a low-voltage regulator, delivering a supply voltage according to the logic signal level they support, for example, 5V or 3.3V. Internal reference voltages are derived from the primary 24V supply voltage, too. The voltages are embraced by monitoring. The monitoring circuits deliver signals indicating whether a voltage, the die temperature and so on are within admissible limits or not. Typically, these signals are combined to a single output, indicating a fault condition or the state of readiness (Figure 12).
Sensing 24V inputs: To detect to which region an input voltage corresponds requires comparing it with appropriate reference voltages. To be compliant with IEC 61131-2, however, the current must be evaluated, too. Figure 13 illustrates a typical signal flow. The 24V input is connected to current and voltage sensing circuitry. Both outputs are AND-ed together to deliver a logic input signal. In some ICs, this signal is run via a low-pass filter to eliminate glitches (debouncing).
Figure 14 shows some more details, especially related to current sensing and an optional LED. The level-translator’s input is a current sink. The current comes from the attached sensor. So that a current can flow, a current path must be provided. It leads from the sensor’s output via a current clamp to ground. In this path, a LED may be inserted, thus showing the level of the 24V signal immediately. If the LED is to be omitted, the corresponding IC pin must be connected to ground (to close the return path).
Output switches: Manufacturers offer level-conversion switches in all of the typical configurations: low-side, high-side, push-pull, and even bidirectional, the latter programmable to act as inputs. The output channels (as shown in Figure 10) drive the power transistors and monitor fault conditions, like thermal overload, overcurrent, overvoltage, and open wire (load disconnected). Figure 15 shows comparatively simple output channels driving a low-side or a high-side switch, respectively. The channel of Figure 16 allows the selection of various configurations: high-side, push-pull, high impedance (somewhat similar to the venerable tri-state drivers) or input modes according to one of the IEC 61131-2 types.
IC packages and PCB design: This issue is bad news for occasional and low-budget projects. Many ICs come in extremely miniaturized packages, requiring reflow soldering (Figure 17). To dissipate heat, they have a so-called exposed part (EP) at their backside. This is intended to conduct heat from a large part of the die area to an appropriate ground pad on the PCB. Multiple vias connect it to a corresponding area at the other side of the PCB, where a heat sink can be mounted. Signal traces should be short and without vias, thus keeping inductance low. More often than not, such components will not work when employed a tinkerer’s way. Having learned this by experience, we can only recommend studying the manufacturer’s PCB design guidelines carefully—for examples see  and .
Isolation: Isolation between the information-processing platforms and the field wiring is a hot topic in industrial control systems. This we can easily recognize from the comprehensive assortment of isolation circuits the semiconductor manufacturers offer, supplementing and even superseding the venerable optocoupler. Their datasheets and application notes contain numerous examples. Mostly, the isolation ICs are inserted in the logic interface between level conversion and information processing. Concerning our small modules, however, it could be often more expedient to connect the complete device to the field wiring ground and to isolate the communications interface. See details in the addendum on Circuit Cellar’s article materials webpage.
Level translation with discrete or SSI components: Occasionally, this will be a viable idea, even today and not only for tinkering but for high-volume manufacturing too. For instance, think of a household appliance where the MCU has to energize four relays and to sense two limit switches. Discrete components are inexpensive. They are not that demanding with regard to PCB design. Often two layers will suffice. Using SMT parts, not that much PCB area will be occupied, and automated manufacturing will keep cost low. Table 3 gives an overview of some suitable components. Figure 18 illustrates a few examples. More details, references, and links you will find in the additional material on the Internet.
SUMMARY AND SUGGESTIONS
In this article, our inquiry was aimed at understanding the rationale of level translation and becoming acquainted with appropriate components and circuits. Semiconductor manufacturers offer a varied range of dedicated level-translation integrated circuits providing built-in protection and diagnostic features. They are, however, somewhat demanding concerning PCB layout. With that in mind, sometimes we may prefer SSI or even discrete components—especially if only a few signals are to be translated and minimum cost is the primary objective.
We introduced the notion of 24V MCUs and CPLDs. In the proper sense, they can be thought of as extremely minimized PLCs. Besides being educational examples, they may be developed further, becoming companions of IoT devices or even viable IoT modules in themselves. As companion devices, they may, for example, serve purposes of safety, emergency backup, supervision and diagnostics.
For detailed article references and additional resources go to:
References  through  as marked in the article can be found there.
A special ADDENDUM to this article is provided there also.
PUBLISHED IN CIRCUIT CELLAR MAGAZINE • OCTOBER 2021 #375 – Get a PDF of the issueSponsor this Article
Wolfgang Matthes has developed peripheral subsystems for mainframe computers and conducted research related to special-purpose and universal computer architectures for more than 20 years. He has also taught Microcontroller Design, Computer Architecture and Electronics (both digital and analog) at the University of Applied Sciences in Dortmund, Germany, since 1992. Wolfgang’s research interests include advanced computer architecture and embedded systems design. He has filed over 50 patent applications and written seven books. (www.realcomputerprojects.dev and