Article Materials and Resources

October (issue #375) Circuit Cellar

Click here for the Circuit Cellar article code archive

p.6: Building the COSMAC ELF Microcomputer: Retro Design Reloaded, By Scott Weber

[1] “Retro-Computing Takes to the Cloud,” by Todd Wade — Circuit Cellar 359, June 2020
[2] “Understanding Proper PCB Design (Part 1): 4-Layer Board Design,” By Robert Lacoste — Circuit Cellar 367, February 2021

Be sure the check on the code for this article on Circuit Cellar’s article code & files webpage

KiCad |
Microchip Technology |
Pico Technology |

p.14: Ultraviolet: The Next LED Frontier: Hurdles and Hopes Examined, By Faiz Rahman

[1] Zinc oxide light-emitting diodes: a review
Optical Engineering (OE) published peer-reviewed papers reporting on research, development, and applications of optics, photonics, and imaging science and engineering.
[2]  Effect of DUV on pathogens and human cells.
GMS Hygiene and Infection Control. 2021; 16: Doc07.

p.18: Build a Power Supply Monitoring and Control System: Using the ESP32 MCU, By Anuj Justus Rajappa and Vairamani Kanagavel

[1] ESP32 development board description, Link
ESP32 development board schematic diagram, Link
[2] ESP32 Series datasheet, Link
[3] ESP-IDF Programming guide, Link
[4] LM338T datasheet, Link
[5] INA219B power monitor sensor datasheet, Link
INA219 DC Current Sensor Breakout board schematics, Link
[7] Sitronix ST7789V driver
[8] L7805CV datasheet, Link

Espressif Systems |
Sitronix |
STMicroelectronics |
Texas Instruments |

p.26: Voltage-Level Translation in MCU Projects: Solutions for Digital Controllers, By Wolfgang Matthes

Editor’s Note: Because this article has so many References and other resources, we’ve placed them all at the end of this webpage. This article also includes an extensive ADDENDUM, which is also provided at the end of this webpage.

p.36: Cache Coherence and the ACE Protocol: Snooping and Synching, By Nishant Mittal

[1] “Understanding the AMBA AXI4 Spec” (Circuit Cellar 370, May 2021),

Arm Developer |

p.41: Intelligent Vision Systems Leverage Embedded Tech: Smart Cameras, Software and Box-Level Systems, By Jeff Child

ADLINK Technology |
Allied Vision Technologies |
Axiomtek |
eCapture |
Imago Technologies |
IOTech |
Maxim Integrated |
OnLogic |
Teledyne DALSA |
Vecow |

p.48: RISC-V Shakes Up the Embedded Processor Space: Open ISA Era Is Here, By Jeff Child

Aldec |
Espressif Systems |
Green Hills Software |
IAR Systems |
Microchip Technology |
Renesas Electronics |
SEGGER Microcontroller |
SiFive |

p.54: DATASHEET: Sensor ICs: Integration and Performance, By Jeff Child

Bourns |
Infineon Technologies |
Maxim Integrated |
NevadaNano |
ON Semiconductor |
Renesas Electronics |
STMicroelectronics |
TDK-Micronas |
Texas Instruments |

Infineon Technologies
Maxim Integrated
ON Semiconductor
Renesas Electronics
Texas Instruments

p.58: EMBEDDED IN THIN SLICES: FreeRTOS (Part 6): FreeRTOS Security, By Bob Japenga

[1] For more about phone phreaking see:
[2] For more on this see:
Also find out how Captain Crunch was instrumental in launching Apple.
[3] For a high-level review of the Stuxnet worm hack, see:
[4] This is the website of the company that uncovered the 11 vulnerabilities in VxWorks.
[5] See Bob’s article from Circuit Cellar Issue 315 from October 2016 Internet of Things series: “Security Vulnerabilities from OWASP”. The OWASP Foundation maintains a list of the top ten vulnerabilities for Web based devices.
NIST maintains one list of existing vulnerabilities in real systems at
[6] MITRE maintains a Common Weakness Enumeration list to identify common software security weaknesses.
[7] “An Analysis of Embedded Software Vulnerabilities and Related Security Solutions”
“Depending on the scheduling policies used by the OS, an attacker could lead low-priority tasks to steal execution time of higher priority tasks.”
[8] See Bob’s article “The Internet of Things (Part 5): IoT Security,” (Circuit Cellar 307, February 2016)
[9] Based on the Common Criteria, the Security Evaluation Standard for IoT Platforms provides a set of tests for evaluating how secure a software system is. See
[10] See Bob’s Circuit Cellar article from August 2018 (Issue 337) “Internet of Things Security Part 4” where he introduces Common Criteria

FreeRTOS |
Infineon Technologies |
NXP Semiconductors |

p.62: THE DARKER SIDE: Blocking and Interference Rejection: Signals and Sensitivity, By Robert Lacoste

[1] ADF7030-1 integrated transceiver (Analog Devices)
[2] CEPT ECC report 207
Adjacent band co-existence of SRDs in the band 863-870 MHz in light of the LTE usage below 862MHz

Analog Devices |

p.68: FROM THE BENCH: How Gun-Style IR Thermometers Work (Part 2): Time for Temperature Tests, By Jeff Bachiochi

[1]  “How Gun-Style IR Thermometers Work (Part 1)” Circuit Cellar 374, September 2021
[2]  MLX90614 Data Sheet
[3]  Human Body Temperature (Table of normal temperatures for men and women, measured by different techniques)
[4] Chen, H.-Y.; Chen, A.; Chen, C. “Investigation of the Impact of Infrared Sensors on Core Body Temperature Monitoring by Comparing Measurement Sites.” Sensors 2020, 20, 2885.

Melexis |

p.79: The Future of Massive IoT: Massive IoT and the Internet of Transformation, By Tom Nelson


Everynet |

References and other resources for (p.6:) Voltage-Level Translation in MCU Projects: Solutions for Digital Controllers, By Wolfgang Matthes

[1] “Voltage-Level Translation Techniques: Managing Mixed-Voltages,” By Robert Lacoste— Circuit Cellar 365, December 2020

Industrial PCs and I/O modules:

[2] Generation 4 Digital I/O Family Data Book. Form 727-190521. Opto 22, 2019.
[3] Titus, Jon; O’Hanlan, Tom: The Digital I/O Handbook. A Practical Guide to Industrial Input & Output Applications. Sealevel Systems, Inc., 2004.
[4] Pamux User’s Guide. Form 726-080118. Opto 22, 2008.


[5] PLC Handbook. Practical Guide to Programmable Logic Controllers. Automation Direct.
[6] Elavsky, Tom: A Condensed Guide to Automation Control. System Specification, Design and Installation. Whitepaper. AutomationDirect
[7] Kopczyk, Jonathan: Engineering Essentials: A Closer Look at the I’s and O’s of VFDs. Making use of the inputs and outputs on a VFD can prove very beneficial to an application. Machine Design, June 01, 2018.
[8] Purvis, Damon: The PLC Breaks Out! A new architecture takes advantage of technological advances to boost performance. Machine Design, April 30, 2021.
[9] Controller PFC200 Data Sheet. Wago, 2019.


[10] Directive 2014/35/EU, Electrical safety: low-voltage electrical equipment / IEC 60950:1991-09.

Industrial control transformers:

[11] Distribution Dry-Type Transformers – Low Voltage 19.0-1. Eaton, 2016. (Contains a glossary of transformer terms.)

IEC 61131:

[12] International Standard IEC 61131-2 Preview Edition 4.0. International Electrotechnical Commission, 2017.
[13] Beckhoff I/O systems: Digital inputs for 2-wire and 3-wire sensors according to EN 61131-2.
Application Note DK9222-0909-0008. Beckhoff Automation GmbH, September 2009.
[14] Connection of Encoder Types in Compliance with IEC 61131-2 to DI Modules. Siemens AG, 2015.
[15] Laupheimer, Peter: CLT3-4BT6 Factory Automation Seminar 2007.
[16] CLT3-4 termination in industrial automation logic inputs. Application Note AN2527. ST Microelectronics, 2007.
[17] CLT3-4B current limited over-voltage protected quad digital termination. Data Sheet. ST Microelectronics, 2007.
[18] PCLT (Programmable current limited termination). Application Note AN2482. ST Microelectronics, 2007.
[19] Hofman, Milos: Self-Powered Digital Input with CLT03-2Q3.  ST Microelectronics, 2020.
[20] Rossetti, Nazareno; Partow, Tony: Efficient I/O Interfaces Dramatically Reduce Heat Generation in Your PLC Digital I/O Module. Design Solutions 9. Maxim Integrated, 2016.

Bidirectional I/O:

[21] Finally – Digital IO Means Digital IO! Design Solutions 46. Maxim Integrated, 2016.
[22] Long, Sean; Jackson, Michael: Use Configurable Digital IO to Give Your Industrial Controller the Edge. Design Solutions 7349. Maxim Integrated, 2020.
[23] “Emulating Legacy Interfaces. Do it with Microcontrollers,” By Wolfgang Matthes— Circuit Cellar 327, October 2017.

Integrated level translators:

[24] Industrial Digital Inputs: They’re Not Quite as Simple as Counting from 0 to 1. Design Solutions 111. Maxim Integrated, 2018.
[25] Design Guide for PLC Digital Input Modules Using the Si838x. Application Note AN970. Silicon Labs, 2019.
[26] Programmable Logic Control (PLC) Solutions Guide SLYY041a. Texas Instruments, 2013.
[27] Voltage Translation Buying Guide SLYY165a. Texas Instruments, 2021.
[28] 8-Channel Digital Input Module for Programmable Logic Controllers (PLCs). Reference Design TIDU196A. Texas Instruments, 2014.
[29] Kamath, Anant: How To Simplify Isolated 24-V PLC Digital Input Module Designs. TI Tech Notes SLLA370B. Texas Instruments, 2018.

IC Packages:

[30] SMT Assembly and PCB Design Guidelines for Maxim’s Standard Wire-Bonded Quad Flatpack, No Leads (QFN) Packages. Application Note 6382. Maxim Integrated, 2014.
[31] Thomas, Shasta; Quach, Bill: Layout Considerations for High-Power Circuits. Tutorial 5389 Maxim Integrated, 2012.

Some Data Sheets:

The corresponding Internet links have been omitted here because it is easy to find the data sheets on the manufacturer’s websites. If not, searching the web may help.

[D1] MAX31910 Ultra-Low Power Industrial, Octal, Digital Input Translator/Serializer. Data Sheet.  Maxim Integrated, 2014.
[D2] MAX31912 Ultra-Low Power Industrial, Octal, Digital Input Translator/Serializer.  Data Sheet.  Maxim Integrated, 2015.
[D3] MAX31914 Ultra-Low Power Industrial, Octal, Digital Input Translator/Serializer.  Data Sheet.  Maxim Integrated, 2015.
[D4] MAX31911 Industrial, Octal, Digital Input Translator/Serializer.  Data Sheet.  Maxim Integrated, 2017.
[D5] MAX31913 Industrial, Octal, Digital Input Translator/Serializer. Data Sheet.  Maxim Integrated, 2015.
[D6] MAX31915 Industrial, Octal, Digital Input Translator/Serializer. Data Sheet.  Maxim Integrated, 2015.
[D7] MAX14900E Octal, High Speed, Industrial, High-side Switch.  Data Sheet.  Maxim Integrated, 2015.
[D8] MAX14914 High-Side Switch with Settable Current-Limiting, Push-Pull Driver Option, and Digital Input Configuration.  Data Sheet.  Maxim Integrated, 2020.
[D9] MAX22190 Octal Industrial Digital Input with Diagnostics.  Data Sheet.  Maxim Integrated, 2020.
[D10] MAX14906 Quad-Channel Industrial Digital Output, Digital Input.  Data Sheet.  Maxim Integrated, 2020.
[D11] MAX14483 6-Channel, Low-Power, 3.75kVRMS SPI Digital Isolator.  Data Sheet.  Maxim Integrated, 2020.
[D12] Si838x Data Sheet.  Bipolar Digital Field Inputs for PLCs and Industrial I/O Modules. Silicon Labs, 2019.
[D13] SN65HVS880 24 V, Eight-Channel Digital-Input Serializer. Data Sheet SLAS592C. Texas Instruments, 2018.
[D14] SN65HVS881 Industrial 8-Digital-Input Serializer with Diagnostics. Data Sheet SLAS642. Texas Instruments, 2009.
[D15] SN65HVS88534 V Digital-Input Serializer for 5V Systems. Data Sheet SLAS638. Texas Instruments, 2009.
[D16] DRV8806 Quad Serial Interface Low-Side Driver IC. Data Sheet SLVSBA3B. Texas Instruments, 2014.
[D17] DRV8860 8 Channel Serial Interface Low-Side Driver. Data Sheet SLRS065B. Texas Instruments, 2014.
[D18] SN74LVC8T245 8-Bit Dual-Supply Bus Transceiver with Configurable Voltage Translation and 3-State Outputs. Data Sheet SCES584B. Texas Instruments, 2014.


The author’s project homepages:

Datasheets, application notes, reference designs, tutorials and so on:

Some manufacturers of I/O modules and industrial PCs:
Opto22: Opto22 has pioneered what would be called nowadays the ecosystem of industrial PC applications. The adapter boards shown in Figure 1 and 2 come from Opto22.
Dataforth Corporation:
Selavel Systems, Inc. :
ADL Embedded Solutions, Inc.:
Advanced Micro Peripherals Ltd.:
Advantech Co., Ltd.:
Measurement Computing:

Embedded and industrial PCs:


Steele, Denny: Cut Power 100X Using CPLD Coprocessors in Portable Applications. Altera, 2007.
Six Ways to Replace a Microcontroller  with a CPLD. White Paper WP-01041. Altera, 2007.
Using Zero-Power CPLDs to Substantially Lower Power Consumption in Portable Applications.  White Paper WP-01042. Altera, 2007.

Sources of pictures:

– Addendum –

Voltage-Level Translation in MCU Projects: Solutions for Digital Controllers, By Wolfgang Matthes

3-wire and 2-wire sensors

The 3-wire sensor is easy to understand. It is a device powered by a 24-V supply voltage and energizing a digital output signal to be connected to an input of the level-translating circuitry. A 2-wire sensor is only connected to a 24-V wire and the signal wire. To power such a sensor, some current must always flow.

Figure A1. 3-wire and 2-wire sensors.

Simple and IEC-compliant 24-V inputs

A simple input senses only the voltage level. Contact sensors (e.g., limit switches) are the most straightforward examples.

Figure A2. This 3-wire sensor switches the input signal between 24 V (or somewhat below due to the voltage drop over R1) and 0 V. Only the signal level is to be translated. It can be done by a few discrete components.

An IEC-compliant sensor, however, always behaves as a current source. Current flows from the 24-V terminal through the sensor and the signal wire and the input circuitry of the translating device to ground.

Figure A3. Here, some internals of the MAX22190 Octal Industrial Digital Input IC are shown ([222]). The circuitry resembles Figure 14 in the printed article. However, it is supplemented by provisions to detect a broken wire or a short to ground. The sensor must source some current, even if in the OFF state. Hence the contact is paralleled by a resistor RS, ensuring a minimum current flow. So, no current at all will indicate a wire break fault condition.

How to power the circuitry in a contactless 2-wire sensor (e.g., in a proximity switch)? Power is supplied by letting a current flow from the 24-V terminal via the input wire to ground. Therefore, the translation circuitry must behave as a current sink. In the OFF state, the signal must not rise above 5 V. In the ON state, it must be at 11 V or above. According to the IEC type, a current of up to 15 or even 30 mA may flow through the sensor.

Figure A4. Powering a 2-wire sensor. The sensor’s circuitry may be seen as an equivalent series resistance causing a voltage drop because of the flowing current. This is the sensor’s supply voltage (VDD).

A simple worst-case analysis

It will be something like a calculation on the back of an envelope. Let us assume a 24-V supply voltage varying between 18 and 40 V and a current limit of 5 mA. To make things not too complicated, we will furthermore neglect the input series resistors RINX (that are mandatory for these ICs).

In the OFF state, the current flows only through the equivalent series resistance RES. The voltage drop must be large enough so that the voltage at the input terminal is well below the maximum VIN_OFF (VIL) voltage of 5 V (as stipulated in IEC61131-2). The worst case occurs if the sensor is fed with 40 V. Thus the voltage drop must become 35 V, yielding an RES = 35 V  : 5 mA = 7 kOhm.

In the ON state, the sensor’s circuitry will activate an additional parallel resistance RP to decrease the voltage drop. It must be reduced so that the voltage at the input terminal is well above the minimum VIN_ON (VIH) voltage of 11 V (as stipulated in IEC61131-2). The worst case occurs if the sensor is fed with 18 V. To guarantee a voltage drop of not more than 7 V, the resistance of the sensor must be reduced to 7 V : 5 mA = 1.4 kOhm. To this end, the sensor must activate a parallel Resistor RP of approx. 1.75 kOhm.

The sensor’s circuitry must be content with an intensively varying power supply. In our example, the supply voltage (VDD) corresponds to the voltage drop varying between 7 and 35 V and the current may plummet down to somewhat around 2 mA. 

The power requirement of the sensor and the current-sinking capability of the translation device must fit together. For example, it will not work if the current clamp within the translation IC limits the input current to 2 mA while the sensor needs 5 mA.

IEC 61131-2 sensor types and operating regions

Figure A5. IEC 61131-2 type 1 operating regions. Type 1 concerns mechanical contacts and 3-wire sensors drawing a comparatively high quiescent current.
Figure A6. IEC 61131-2 type 2 operating regions. Type 2 relates to 2-wire sensors with a somewhat increased power consumption, for example, 2-wire proximity switches according to IEC 60947-5-2.
Figure A7. IEC 61131-2 Type 1 operating regions. Type 3 has been defined to support 2- and 3-wire sensors with reduced power consumption.

The microcontroller-CPLD combo

Figure A8. Sometimes, it may be advantageous to employ a CPLD as the first stage of level conversion outside of the microcontroller. Refer, for example, to [32] to [34].

The IOs of some CPLDs are grouped in banks having their own VIO supply voltage. Thus, for example, the 1.8-V or 2.4-V signals of the microcontroller can be translated to 2.5-V LVCMOS levels, 3.3-V LVTTL levels, and so on. Besides, the CPLD may swallow up most of the glue logic that otherwise would be spread over the PCB. Occasionally, the CPLD may accommodate even a coprocessor.                                                       

Figure A9. Combining a microcontroller and a CPLD. Here, an evident, straightforward architecture is shown.

The principal question is which device is the master. In the first variant, it is the CPLD. The microcontroller is only used for initialization, diagnostics, communication, and the human-machine interface (for example, implemented by an LCD together with some keys and LEDs). In a second variant, the microcontroller is the master. It executes the application-specific software. The CPLD is merely an auxiliary device for level translation, marshalling, glue logic, and so on.  Occasionally, it may accommodate even an accelerator or coprocessor.

The most straightforward approach is to connect all the microcontroller’s signals that are to be translated to the CPLD, regardless of whether they belong to an industry-standard or peripheral interface (think of SPI, asynchronous interfaces, or the IOs of a counter-timer unit) or are to be used as programmable IOs. Thus the CPLD will be something like a patch or marshalling panel. It is, however,  just as obvious to connect interface signals directly to the translation circuits.

Concerning the programmable IOs connecting the microcontroller to the CPLD, I recommend contemplating some sort of architecture (in contrast to pure application-specific wiring, like between the components on a conventional PCB). Typical examples would be a data bus accompanied by some control and status signals or a simple shift register interface. The details may be application-specific; the basic ideas could be adopted from the typical bus systems of the early microprocessors (think, for example, of Intel’s 8051 or Motorola’s 6800), from asynchronous SRAMs, and the like. For simple shift register interfaces, see also Figure 11 in the printed article.

The rationale behind this recommendation is that you will have to work with two different development environments, and you would certainly not want to be urged to modify the microcontroller software when changing something in the CPLD and vice versa. It goes without saying that true hardware-software co-design is state of the art. To be able to switch seamlessly between hardware and software requires, however,  to move to FPGAs and their development environments, which are considerably more demanding (and expensive).           

The 24-V companion – an educational example

A 24-V microcontroller or CPLD would be a densely packed small PCB. When the basic architecture has been defined and the functional units developed, it is only a question of PCB design and manufacturing. Therefore, my own experiments had begun not with a tiny IOT module but with somewhat larger PCBs,  one for each basic functional unit. The philosophy behind this approach and some of the modules I have described already in Circuit Cellar articles ([35], [36]).

Figure A10. An experimental IoT platform assembled from a microcontroller module (1), a CPLD module (2), and a voltage-translation module (3) dubbed the 24-V companion, connected to a 24-V indicator board (4). To run loopback tests, a cable connects an output port to the indicator board and an input port.

The microcontroller module carries an operating and display panel, thus constituting an HMI device. The CPLD module contains a Xilinx CoolRunner XC2C384 CPLD and an SRAM 256k • 16. The 24-V companion supports 24 inputs and 24 outputs, grouped in six 8-bit ports. The companion has a parallel logic interface, comprising 48 signals, that can be, via the so-called multi-purpose connector, attached to the CPLD module or appropriate microcontroller modules. The multi-purpose connector has been mentioned in my article [35]. The interface between the microcontroller and the CPLD comprises 16 signals that may be used for application-specific wiring. I prefer, however, a somewhat architected solution with an 8-bit data bus and up to 8 control and status signals. The 24-V indicator board is a purpose-built auxiliary device displaying the status of 24 output signals, grouped in three ports of eight. It consists essentially of 24-V LED signal lamps wired to headers. All components are mounted in the front panel of a sloped enclosure.

Figure A11. One of the companion’s three input ports. The RT outputs may be connected to LEDs. Without LEDs, they must be connected to ground to close the current return paths. The translator’s configuration is to be set via jumpers on the PCB. DB0CONF, DB1CONF select the time constant of the glitch filter. VTCONF selects the input trip point (CMOS or IEC61131-2). REFCONF1 to 3 are connected to reference resistors for current limiting. The current limit may be set between 0.5 and 6 mA.

Input translation is done in two stages, from 24 V to 5 V by a MAX31915 ([D6]) and from 5 V to 3.3 V by a 74LV8T245 ([D19]). Translation ICs with parallel interfaces have been chosen because the companion should preferably be attached to a CPLD.

Figure A12. One of the three output ports.

The output stages are straightforward ULN2803 Darlington drivers. To ensure definite signal levels even when no module or load is attached, the logic and 24-V signals are connected to pull-down and pull-up resistors, respectively.

Integrated level translators

Our block diagrams – in the printed article and here – are based on actual data sheets. They have been, however, considerably simplified and redrawn to illustrate the essential principles of operation. Who wants to know more, we refer to the data sheets, whitepapers, and application notes of the semiconductor manufacturers. The references [24] to [31] and [D1] to [D19] are thought of as introductory examples.

Simple 24-V logic

Some decades ago (we speak of the Fifties and Sixties), control equipment manufacturers offered transistorized pluggable modules performing logic functions, like gates, flip-flops, counters, and so on. The modern equivalents are essentially very small PLCs, down to programmable relays. Occasionally, however,  the need arises to implement hard-wired logic functions at the 24-V level without resorting to PLC programming. The problem can be solved by developing application-specific modules or by  tinkering with diodes, transistors,  driver modules, and so on. Manufacturers know this need and offer appropriate building blocks. As an alternative solution, we propose the 24-V CPLD.

Figure A13. Diode logic to implement AND and OR functions. The V330 is a quad high-side driver IC (smart power solid state relay), driving resistive or inductive loads connected to ground ([D20]). To invert signals, we can make use of transistor stages, low-side driver ICs or solid-state relay modules.
Figure A14. Only a few examples of appropriate modules (from Weidmueller, Wago, and Appoldt). Above all, they are mechanical building blocks to clip onto DIN rails. More or less craftwork is required to implement the desired functions. (a) and  (b) show modules with diodes. (c) connects a pluggable PCB to the field wiring. (d) is an uncommitted module to accommodate application-specific components. The rear connector of (e) allows to insert an application-specific PCB or to attach external circuitry via a ribbon cable. A 24-V CPLD may have, for example, a form factor similar to (a) or (c).
Figure A15. Supervising traffic light control – a considerably simplified but plausible example of 24-V logic. NS = North/South, WE = West/East.

A sophisticated AI-based system controls the traffic lights on an intersection. What must never occur is that all the green lights on the intersection lanes switch on simultaneously. Here, all red lights will switch on if this fault occurs. Improvements are obvious. For example, a timing relay could, after an appropriate time period, disable all the lights. Thus the traffic may resume whereby the drivers have to heed the right of way as stipulated in the traffic regulations. A microcontroller-CPLD combo could do much more than a few logic gates. For example, it could take over the traffic light control and keep the traffic going by an unsophisticated and stupid but guaranteed error-free algorithm.


IC manufacturers recommend inserting the isolation between the translator circuits and the processing platform (which is typically a microcontroller or an FPGA).

Figure A16. A parallel interface with isolation devices inserted. For an example refer to [D10].
Figure A17. This input translator has an SPI interface confined to read the input states (input serializer). Isolation is done by one IC supporting both SPI signal directions. For an example refer to [D1].
Figure A18. This is an example of a shift register interface, supplemented by further inputs and outputs. Here, the isolation circuitry is shown as one building block. In practice, it must be implemented by two or more appropriate ICs. For examples of shift register interfaces refer to [D14] to [D16].
Figure A19. When designing tiny modules, like our 24-V microcontrollers and CPLDs, the number of components is to be minimized to keep the PCB small and to ensure high reliability. Therefore, it may be advantageous to connect the whole module to the field wiring ground and isolate only the power supply and the external interfaces. In some cases, the transformers of the DC/DC converters and the Ethernet PHY could provide sufficient isolation.

Translation with discrete components

Level translation problems can be solved with discrete or SSI components, such as Zener diodes, bipolar junction transistors (BJTs), field-effect transistors (FETs), and comparators. Zener diodes and MOSFETs are well-suited to translate 24-V to logic signals (down to 3.3 V or below). BJTs and comparators may be employed in both directions.

Designing with discrete components is an art in itself. Regrettably, today it is only seldom taught. Even textbooks which are otherwise excellent, deal with those topics quite sketchily. Here, we can only touch a few of the most basic circuits. For more, we refer to appropriate sources provided by the semiconductor manufacturers and the vintage literature.

Figure A20. An IEC 61131-2 compliant input translated using Zener diodes ([37]).

The 4.7-V Zener begins to conduct if the input voltage exceeds approx. 5 V, thus guaranteeing a LOW level as long as the input voltage is less than 5 V. The 2.7-V Zener limits the input voltage of the 7414 Schmitt trigger. The 10k/2n2 combo acts as a low-pass or de-glitching filter.

Watch out for anomalous conditions at the inputs

More intricate problems like ESD, power line interference, crosstalk, and so on we cannot discuss here. They are typical of true factory floor environments. When pursuing humble hobbyist or educational projects, the environment will not be that harsh. There are, however, two conditions you should consider even under those benign circumstances: The first is no signal at all, that is, an open input. The second is a high-impedance (tri-stated) signal. This condition may occur during initialization or as a consequence of faults. A microcontroller running self-tests, communicating via the network, and the like before initializing its output ports may cause such signals to float for a prolonged time. Under both conditions, you should guarantee your translation circuit sees a definite LOW or HIGH input level. Which of both levels to choose as the default depends on the particular application.

How to drive a BJT

The decisive data sheet value is the Base-Emitter Saturation Voltage VBE(sat). Small-signal BJTs are rated typically between 0.7 V and somewhat above 1 V.  To keep the transistor safely in the OFF state, the base-to-emitter-voltage should be kept well beyond VBE(sat), say, for example, at approx. 0.3 V. To switch it on, the signal source should deliver a voltage well above 1 V. Then the current path from the base to the emitter will behave like a diode operated in forward direction. Therefore, it is necessary to limit the base current. When no anomalous conditions will occur, especially when the signal source is a CMOS logic output, then the current–limiting resistor alone may suffice. It’s value according to a proven rule of thumb:

(Signal voltage – VBE(sat)) divided by a tenth of the output current.

For 24-V inputs, however, you would be better off with the voltage divider, eventually combined with a Zener-based voltage limiter.

Figure A21. Employing a BJT. The two most basic circuits. Some manufacturers offer transistors with a built-in current-limiting resistor or coupling/bleeder resistor combo ([38]).
Figure A22. An application circuit translating 3.3-V signals to 24 V ([37]). The pull-up resistor keeps the transistor switched ON when the input is floating. Consequently, the VN330 will not energize the attached load.

The BJT switched ON

The most important parameter is the Collector-Emitter Saturation Voltage VCE(sat).  Small-signal BJTs have typical data sheet values around 0.2 V. However, to keep the voltage this low, the transistor must be operated in saturation, that is, overdriven by a base current sufficiently high. (Hence we divide the output current by 10 and not by the current-gain parameter h21E or Beta in the data sheet.)

How to drive a MOSFET

In contrast to the BJT, which is controlled by the base current, the MOSFET is controlled by the gate voltage. To keep the transistor safely in the OFF state, the gate-to-source voltage should be kept well below the Gate-Source Threshold Voltage VGS(th). Typical values are between somewhat under 1 V up to somewhat around 5 V. To switch the transistor on, you have to consider the minimum gate voltage that guarantees the data sheet value of the Drain-Source Resistance RDS(on). 10 V is a common value. Observe that the VGS(th) data sheet value relates not to a transistor completely switched ON but to the transitional range between OFF and ON. VGS(th) is often specified as a gate voltage permitting a mere weak drain current to flow (for example, as low as 250 µA).                                                           

Figure A23. Employing a MOSFET. The most basic circuit.

The MOSFET switched ON

FETs are voltage-controlled variable resistors. The voltage drop VDS between drain and source results from the drain current flowing through the drain-to-source resistance (VDS = ID • RDS(on)). So keep the gate voltage high enough and the drain current only as high as necessary.

Level translation with comparators

The comparator is a high-gain, non-feedback differential amplifier. The output should assume only one of two levels (Low or High), depending on the voltage difference VDIFF between the inputs. Many comparator ICs have open-collector or open-drain outputs. The output voltage swing may be as large as the appropriate data sheet parameter permits; it does not depend on the comparator’s supply voltage. Thus, for example, a comparator supplied with 24 V may output 3.3-V signals.

Figure A24. Employing a comparator with an open-drain or open-collector output. The most basic circuit. The comparator’s supply voltage VDDin corresponds to the input signal level.

It seems straightforward to employ a comparator. Connect one input to the signal to be translated and the other input to an appropriate reference voltage, which may be provided by a simple voltage divider. There are, however, a few caveats. Here, we will only mention the two most important: the slew rate of the input signal and the input common-mode range.

A comparator has no built-in snap-action mechanism. The threshold effect results solely from the high voltage gain, causing even a small difference in input voltages to overdrive the amplifier.  If this difference is very small, however, there will be no overdriving. Parasitic feedback effects could cause the output even to oscillate. On the other hand, if this so-called linear region is traversed fast enough, the comparator will find no opportunity to switch back and forth. Hence only a single signal edge will occur. Thus you have to consider the rise and fall times of the input signal. If they may be too slow, the simple circuit will not work properly. Well-proven remedies you will find in the literature, for example, the Schmitt-trigger circuit or to introduce a particular input behavior, called hysteresis ([39], [40]).

The input common-mode range is typically somewhat smaller (at least some hundreds of millivolts) than the voltage difference between both power supply terminals. This may be a problem if the negative power terminal is connected to the ground (single-ended operation). If the LOW level of your input signal is nearly equal to 0 V (for example, if it is driven by a CMOS logic output switching rail-to-rail), you should prefer a comparator that will function properly in such a case. This property is termed ground sensing in single-ended applications (or something like that).

References (for Addendum only):

Microcontrollers and CPLDs:
[32] Steele, Denny: Cut Power 100X Using CPLD Coprocessors in Portable Applications. Altera, 2007.
[33] Six Ways to Replace a Microcontroller  with a CPLD. White Paper WP-01041. Altera, 2007.
[34] Using Zero-Power CPLDs to Substantially Lower Power Consumption in Portable Applications.  White Paper WP-01042. Altera, 2007

Mechanical design and level translation with discrete components:

[35] Matthes, Wolfgang: Creative Mechanical Ideas for Embedded Systems. Professional Style Projects. Circuit Cellar, Issue 358, May 2020, p. 28-35.
[36] Matthes, Wolfgang: Microcontroller Modules for the Ambitious. Circuit Cellar, Issue 312, July 2016, p. 34-42.
[37] IEC 61131-2 compatible inputs and outputs at the SC1x3 Controller. Application Note AN_SC1X3_IO_V1.PDF. Beck IPC GmbH, n. d.
[38] Such transistors are dubbed Digital Transistors or BRTs = Base Resistor Transistors.
Understanding a Digital Transistor Datasheet. Application Note AND9129/D. ON Semiconductor, 2013.
[39]  Kay, Art; Claycomb, Timothy: Comparator with Hysteresis Reference Design. TIDU020A. Texas Instruments Incorporated, 2013–2014.
[40] Guide to Adding Extra Hysteresis to Comparators. Application Note 3616. Maxim Integrated Products,  2005.

Keep up-to-date with our FREE Weekly Newsletter!

Don't miss out on upcoming issues of Circuit Cellar.

Note: We’ve made the Dec 2022 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.
Sponsor this Article
Website | + posts

Circuit Cellar's editorial team comprises professional engineers, technical editors, and digital media specialists. You can reach the Editorial Department at, @circuitcellar, and

Supporting Companies

Upcoming Events

Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2024 KCK Media Corp.

October (issue #375) Circuit Cellar

by Circuit Cellar Staff time to read: 26 min