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

References:
[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 | www.kicad.org
Microchip Technology | www.microchip.com
Pico Technology | www.picotech.com

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

References:
[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.
https://www.spiedigitallibrary.org/journals/optical-engineering/volume-58/issue-01/010901/Zinc-oxide-light-emitting-diodes-a-review/10.1117/1.OE.58.1.010901.full?SSO=1
[2]  Effect of DUV on pathogens and human cells.
GMS Hygiene and Infection Control. 2021; 16: Doc07.
https://www.egms.de/static/pdf/journals/dgkh/2021-16/dgkh000378.pdf

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

References:
[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 https://www.sitronix.com.tw/en/products/display-driver-ic
[8] L7805CV datasheet, Link

Espressif Systems | www.espressif.com
LILYGO | www.lilygo.cn
Sitronix | www.sitronix.com.tw
STMicroelectronics | www.st.com
Texas Instruments | www.ti.com

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

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

Arm Developer | https://developer.arm.com

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

ADLINK Technology | www.adlinktech.com
Allied Vision Technologies | www.alliedvision.com
Axiomtek | www.axiomtek.com
eCapture | www.ecapturecamera.com
Imago Technologies | www.imago-technologies.com
IOTech | www.iotechsys.com
Maxim Integrated | www.maximintegrated.com
OnLogic | www.onlogic.com
Teledyne DALSA | www.teledynedalsa.com/mv
Vecow | www.vecow.com

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

Aldec | www.aldec.com
Espressif Systems | www.espressif.com
Green Hills Software | www.ghs.com
IAR Systems | www.iar.com
Microchip Technology | www.microchip.com
Renesas Electronics | www.renesas.com
SEGGER Microcontroller | www.segger.com
SiFive | www.sifive.com

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

Bourns | www.bourns.com
Infineon Technologies | www.infineon.com
Maxim Integrated | www.maximintegrated.com
NevadaNano | www.nevadanano.com
ON Semiconductor | www.onsemi.com
Renesas Electronics | www.renesas.com
STMicroelectronics | www.st.com
TDK-Micronas | www.micronas.tdk.com
Texas Instruments | www.ti.com

DATASHEET URLS:
Bourns www.bourns.com/docs/product-datasheets/bps240.pdf
Infineon Technologies https://edit.infineon.com/cms/en/product/sensor/current-sensors/tli4971-a120t5-e0001
Maxim Integrated www.maximintegrated.com/en/products/sensors/MAX25405.html#online-ds
NevadaNano www.nevadanano.com/mps-refrigerant-sensors
ON Semiconductor www.onsemi.com/products/sensors/image-sensors/xgs-16000
Renesas Electronics www.renesas.com/us/en/document/dst/zmod4510-datasheet
STMicroelectronics www.st.com/en/imaging-and-photonics-solutions/vl53l5cx.html
TDK-Micronas www.micronas.tdk.com/en/products/direct-angle-sensors/hal-39xy
Texas Instruments www.ti.com/lit/ds/symlink/hdc3020.pdf

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

References:
[1] For more about phone phreaking see: https://www.theatlantic.com/technology/archive/2013/02/whatever-happened-to-the-phone-phreaks/273332
[2] For more on this see: https://www.atlasobscura.com/articles/capn-crunch-whistle
Also find out how Captain Crunch was instrumental in launching Apple.
[3] For a high-level review of the Stuxnet worm hack, see:
  https://www.businessinsider.com/stuxnet-was-far-more-dangerous-than-previous-thought-2013-11
[4] This is the website of the company that uncovered the 11 vulnerabilities in VxWorks.  https://www.armis.com/research/urgent11
[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. https://owasp.org/www-project-top-ten
NIST maintains one list of existing vulnerabilities in real systems at  https://nvd.nist.gov/vuln/full-listing
[6] MITRE maintains a Common Weakness Enumeration list to identify common software security weaknesses.  https://cwe.mitre.org
[7] “An Analysis of Embedded Software Vulnerabilities and Related Security Solutions” https://kth.diva-portal.org/smash/get/diva2:1149047/FULLTEXT01.pdf
“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 https://www.freertos.org/2021/03/why-sesip-certification-for-freertos-matters.html
[10] See Bob’s Circuit Cellar article from August 2018 (Issue 337) “Internet of Things Security Part 4” where he introduces Common Criteria
[11] https://www.psacertified.org/products/freertos
[12] https://nvd.nist.gov/vuln/search/results?form_type=Basic&results_type=overview&query=FreeRTOS&search_type=all

FreeRTOS | www.freertos.org
Infineon Technologies | www.infineon.com
NXP Semiconductors | www.nxp.com

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

References:
[1] ADF7030-1 integrated transceiver (Analog Devices)
https://www.analog.com/en/products/adf7030-1.html
[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
https://docdb.cept.org/download/1067

Analog Devices | www.analog.com

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

References:
[1]  “How Gun-Style IR Thermometers Work (Part 1)” Circuit Cellar 374, September 2021
[2]  MLX90614 Data Sheet
https://www.melexis.com/en/documents/documentation/datasheets/datasheet-mlx90614
[3]  Human Body Temperature (Table of normal temperatures for men and women, measured by different techniques)
https://en.wikipedia.org/wiki/Human_body_temperature
[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.
https://doi.org/10.3390/s20102885

Melexis | www.melexis.com

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

References:
[1] www.usda.gov/foodwaste/faqs
[2] www.palletcentral.com/page/DidYouKnow

Everynet | www.everynet.com


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.
https://www.opto22.com/products/product-families/g4-i-o-family
https://www.opto22.com/support/resources-tools/documents/0727-g4-digital-i-o-data-book
https://documents.opto22.com/0727_G4_Digital_IO_Data_Book.pdf
[3] Titus, Jon; O’Hanlan, Tom: The Digital I/O Handbook. A Practical Guide to Industrial Input & Output Applications. Sealevel Systems, Inc., 2004.
https://www.sealevel.com/product/ref101-the-digital-i-o-handbook-a-practical-guide-to-industrial-input-and-output-applications
[4] Pamux User’s Guide. Form 726-080118. Opto 22, 2008.
https://www.opto22.com/support/resources-tools/documents/0726-pamux-user-s-guide
https://documents.opto22.com/0726_Pamux_Manual.pdf

PLCs:

[5] PLC Handbook. Practical Guide to Programmable Logic Controllers. Automation Direct.
https://images.assetsdes.endeavorb2b.com/Web/PentonDES/%7B8b73761c-f553-49af-bcf0-4c62a178427d%7D_PLC_Handbook.pdf
[6] Elavsky, Tom: A Condensed Guide to Automation Control. System Specification, Design and Installation. Whitepaper. AutomationDirect
https://cdn.automationdirect.com/static/press/Control-System-Design-white-paper.pdf
[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.
https://www.machinedesign.com/mechanical-motion-systems/article/21836794/engineering-essentials-a-closer-look-at-the-is-and-os-of-vfds
[8] Purvis, Damon: The PLC Breaks Out! A new architecture takes advantage of technological advances to boost performance. Machine Design, April 30, 2021.
https://www.machinedesign.com/automation-iiot/article/21162916/automationdirect-the-plc-breaks-out
[9] Controller PFC200 Data Sheet. Wago, 2019.
https://www.wago.com/us/controllers-bus-couplers-i-o/controller-pfc200/p/750-8212
https://www.galco.com/techdoc/wago/750-8212_dat.pdf

SELV/PELV:

[10] Directive 2014/35/EU, Electrical safety: low-voltage electrical equipment / IEC 60950:1991-09.
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=celex%3A32014L0035
https://webstore.iec.ch/publication/18578

Industrial control transformers:

[11] Distribution Dry-Type Transformers – Low Voltage 19.0-1. Eaton, 2016. (Contains a glossary of transformer terms.)
https://www.scribd.com/document/341288829/TB00900004E-Tab-19-pdf
https://de.scribd.com/document/53721225/tb00900004e
https://www.eaton.com/us/en-us.html

IEC 61131:

[12] International Standard IEC 61131-2 Preview Edition 4.0. International Electrotechnical Commission, 2017.
https://plcopen.org/sites/default/files/downloads/iec_61131-2_preview.pdf
[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.
http://ftp.beckhoff.com/download/Document/Application_Notes/DK9222-0909-0008.pdf
[14] Connection of Encoder Types in Compliance with IEC 61131-2 to DI Modules. Siemens AG, 2015.
https://support.industry.siemens.com/dl/files/921/109477921/att_863631/v2/109477921_Compliance_IEC_61131-2_DI_module_en.pdf
[15] Laupheimer, Peter: CLT3-4BT6 Factory Automation Seminar 2007.
http://www.bdtic.com/download/ST/steval-ifp008v1_presentation.pdf
[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.
https://www.st.com/content/st_com/en/products/protection-devices/current-limiters/clt3-4b.html
https://www.st.com/resource/en/datasheet/clt3-4b.pdf
[18] PCLT (Programmable current limited termination). Application Note AN2482. ST Microelectronics, 2007.
https://www.stmicroelectronics.com.cn/resource/en/application_note/cd00147591-pclt-programmable-current-limited-termination-stmicroelectronics.pdf
[19] Hofman, Milos: Self-Powered Digital Input with CLT03-2Q3.  ST Microelectronics, 2020.
https://www.st.com/content/ccc/resource/sales_and_marketing/presentation/product_presentation/group0/98/13/4b/3f/73/5f/46/82/Self-powered_Digital_Inputs_with_CLT03-2Q3_Narrated_English/files/Self-powered_Digital_Inputs_with_CLT03-2Q3_Narrated_English.pdf/jcr:content/translations/en.Self-powered_Digital_Inputs_with_CLT03-2Q3_Narrated_English.pdf
[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.
https://www.powersystemsdesign.com/efficient-io-drastically-reduces-heat/90

Bidirectional I/O:

[21] Finally – Digital IO Means Digital IO! Design Solutions 46. Maxim Integrated, 2016. https://www.mouser.com/pdfDocs/ds46-finally-digial-io-means-digial-io1.pdf
[22] Long, Sean; Jackson, Michael: Use Configurable Digital IO to Give Your Industrial Controller the Edge. Design Solutions 7349. Maxim Integrated, 2020.
https://www.maximintegrated.com/en/design/technical-documents/design-solutions/7/7349.html
[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.
https://www.maximintegrated.com/en/design/technical-documents/design-solutions/7/7367.html
[25] Design Guide for PLC Digital Input Modules Using the Si838x. Application Note AN970. Silicon Labs, 2019.
https://www.silabs.com/isolation/industrial-io/si838x-digital-isolators
https://www.silabs.com/documents/public/application-notes/AN970.pdf
[26] Programmable Logic Control (PLC) Solutions Guide SLYY041a. Texas Instruments, 2013.
[27] Voltage Translation Buying Guide SLYY165a. Texas Instruments, 2021.
https://www.ti.com/lit/sg/slyy165a/slyy165a.pdf?ts=1620377039360&ref_url=https%253A%252F%252Fwww.ti.com%252Flogic-circuit%252Fvoltage-level-translation%252Foverview.html
https://www.ti.com/lit/pdf/slyy165
[28] 8-Channel Digital Input Module for Programmable Logic Controllers (PLCs). Reference Design TIDU196A. Texas Instruments, 2014.
https://www.ti.com/lit/ug/tidu196a/tidu196a.pdf?ts=1620370237241&ref_url=https%253A%252F%252Fwww.ti.com%252Ftool%252FTIDA-00017
https://www.ti.com/lit/pdf/tidu196
[29] Kamath, Anant: How To Simplify Isolated 24-V PLC Digital Input Module Designs. TI Tech Notes SLLA370B. Texas Instruments, 2018.
https://www.ti.com/lit/an/slla370b/slla370b.pdf?ts=1620376677928&ref_url=https%253A%252F%252Fwww.google.com%252F

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.
https://www.maximintegrated.com/en/design/technical-documents/app-notes/6/6382.html
https://pdfserv.maximintegrated.com/en/an/AN6382.pdf
[31] Thomas, Shasta; Quach, Bill: Layout Considerations for High-Power Circuits. Tutorial 5389 Maxim Integrated, 2012.
https://www.maximintegrated.com/en/design/technical-documents/tutorials/5/5389.html

https://pdfserv.maximintegrated.com/en/an/TUT5389.pdf

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.

Sources

The author’s project homepages:

https://www.realcomputerprojects.dev

https://www.controllersandpcs.de/projects.htm

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

https://www.analog.com
https://www.maximintegrated.com
https://www.silabs.com
https://www.ti.com

Some manufacturers of I/O modules and industrial PCs:
Opto22: http://www.opto22.com 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: https://www.dataforth.com/default.aspx
Selavel Systems, Inc. : https://www.sealevel.com
ADL Embedded Solutions, Inc.: https://www.adl-usa.com
Advanced Micro Peripherals Ltd.: https://www.ampltd.com
Advantech Co., Ltd.: https://www.advantech.com
Measurement Computing: https://www.mccdaq.com

Embedded and industrial PCs:
https://industrialpc.com
https://www.intel.com/content/www/us/en/internet-of-things/industrial-iot/industrial-pc.html
https://www.directindustry.com/industrial-manufacturer/industrial-pc-83714.html
https://www.sealevel.com/product-category/digital-analog-i-o

PLCs:
https://www.phoenixcontact.com
https://www.wago.com/us
https://www.unitronicsplc.com
https://www.crouzet.com/products/automation-controllers
https://www.se.com/ww/en/product-category/3900-plc%2C-pac-and-dedicated-controllers/?filter=business-1-industrial-automation-and-control
https://www.maximintegrated.com/en/products/interface/industrial-digital-io.html
https://www.automationdirect.com/support
https://www.automationdirect.com/adc/overview/catalog/programmable_controllers
https://library.automationdirect.com/history-of-the-plc
https://library.automationdirect.com/worksheet-choosing-controller
https://www.silabs.com/isolation/industrial-io
https://www.phoenixcontact.com/online/portal/us?1dmy&urile=wcm%3apath%3a/usen/web/main/products/subcategory_pages/Classic_PLC_P-21-01/f708b4f8-45fa-4ae7-ab62-0828235ebe53
https://www.omega.de/literature/transactions/volume2/digitalio.html

Miscellaneous:

https://www.silabs.com/documents/public/data-sheets/Si838x-DataSheet.pdf
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:
https://soda.crouzet.com/pn/?i=88974043
https://www.se.com/ww/en/product-range/531-zelio-logic-sr2-sr3/?parent-subcategory-id=3910&filter=business-1-industrial-auto

– 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.

Isolation

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.
https://www.infineon.com/cms/en/product/small-signal-transistors-diodes/bipolar-transistor/digital-transistor
https://www.onsemi.com/products/discretes-drivers/digital-transistors-brts
Understanding a Digital Transistor Datasheet. Application Note AND9129/D. ON Semiconductor, 2013. https://www.onsemi.com/pub/collateral/and9129-d.pdf
[39]  Kay, Art; Claycomb, Timothy: Comparator with Hysteresis Reference Design. TIDU020A. Texas Instruments Incorporated, 2013–2014.
https://www.ti.com/lit/ug/tidu020a/tidu020a.pdf
[40] Guide to Adding Extra Hysteresis to Comparators. Application Note 3616. Maxim Integrated Products,  2005.
https://www.maximintegrated.com/en/design/technical-documents/app-notes/3/3616.html

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

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


Note: We’ve made the May 2020 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 editorial@circuitcellar.com, @circuitcellar, and facebook.com/circuitcellar

Supporting Companies

Upcoming Events


Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2023 KCK Media Corp.

October (issue #375) Circuit Cellar

by Circuit Cellar Staff time to read: 26 min