Article Materials and Resources

December (issue #365) Circuit Cellar

Click here for the Circuit Cellar article code archive

p.6: Device Monitors Home Air-Quality and CO2: The IntlAir Project, By Andrei Florian

References:

[1]  https://ie.farnell.com/avnet/aes-ms-mt3620-sk-g/starter-kit-arm-cortex-a7-cortex/dp/3106884
[2] https://www.mikroe.com/air-quality-4-click
[3] https://www.mikroe.com/relay-click
[4] https://visualstudio.microsoft.com/

[5] https://docs.microsoft.com/en-us/azure-sphere/install/install-sdk
[6] https://docs.microsoft.com/en-us/azure-sphere/install/development-environment-windows
[7] https://docs.microsoft.com/en-us/azure-sphere/install/claim-device
[8] https://docs.microsoft.com/en-us/azure-sphere/install/configure-wifi
[9] https://azure.microsoft.com/en-us/free/search/?&ef_id=Cj0KCQjw_ez2BRCyARIsAJfg-kv440AJYtRGKVjWP28QJishm9oW1ZAgR9AdOXwo1o6ytGZpZMlHhq8aAldLEALw_wcB:G:s&OCID=AID2000084_SEM_Cj0KCQjw_ez2BRCyARIsAJfg-kv440AJYtRGKVjWP28QJishm9oW1ZAgR9AdOXwo1o6ytGZpZMlHhq8aAldLEALw_wcB:G:s&dclid=CLqrn_W57ekCFWSN7QodH8oDGA
[10] https://docs.microsoft.com/en-gb/azure/iot-dps/quick-setup-auto-provision
[11] https://docs.microsoft.com/en-us/azure-sphere/app-development/setup-iot-hub
[12] https://azure.microsoft.com/nl-nl/blog/how-to-use-azure-functions-with-iot-hub-message-routing/
[13] https://www.linkedin.com/pulse/stream-data-power-bi-from-azure-function-9-lines-code-van-valkenburg
[14] https://docs.microsoft.com/en-us/power-bi/fundamentals/service-self-service-signup-for-power-bi
[15] https://docs.microsoft.com/en-us/azure-sphere/deployment/deployment-concepts
[16] https://docs.microsoft.com/en-us/power-bi/fundamentals/service-get-started

GitHub Repo
https://github.com/Andrei-Florian/IntlAir

Farnell | www.ie.farnell.com
Microsoft | www.microsoft.com
Mikroe | www.mikroe.com

p.16: Breathalyzer Links to Car’s Ignition System: Using an NXP LPC802 MCU, By Julia Paglia

Source Code: https://github.com/jpaglia/ignition-interlock

Demo Video:

Datasheets and User Manuals:
The following are links to the PDF files for the LPC802 user manual as well as the datasheets for the LPC802, the MQ-3 gas sensor, and the HD44780 LCD screen.
https://www.nxp.com/docs/en/data-sheet/LPC802.pdf
https://www.mouser.com/pdfdocs/NXP_LPC802_UM.pdf
https://www.sparkfun.com/datasheets/Sensors/MQ-3.pdf
http://fab.cba.mit.edu/classes/863.06/11.13/44780.pdf

Mathematical References:
These are resources used for the deriving the conversion formula from the MQ-3 analog output signal into a meaningful BAC percentage.
https://www.lionlaboratories.com/testing-for-alcohol/the-lion-units-converter
https://nootropicdesign.com/projectlab/2010/09/17/arduino-breathalyzer
https://www.alcohol.org/bac-calculator

Additional Background References:
Below are references to background details about Ontario’s Ignition Interlock Program.
http://www.mto.gov.on.ca/english/safety/ignition-interlock-program.shtml#program-overview

Eric Electronic Technology | www.eric1688.com
Digi-Key Electronics Canada | www.digikey.ca
Mouser Electronics | www.mouser.com
NXP Semiconductors | www.nxp.com
Sparkfun | www.sparkfun.com

p.22: True Random Number Generation: Using Comparators, By Wolfgang Matthes

Note:  An extensive Addendum is provided to the article. To view the Addendum, scroll down to the end of this page.

Reference designs and application notes:

Analog designers usually strife to avoid oscillations. The most common method is to provide for hysteresis, that is, to modify the reference voltage if the comparator’s output level has changed.
This is to avoid that the differential voltage at the inputs remains in the linear region for some time. As soon as the output switches, the reference voltage is changed so that a larger input voltage swing in the opposite direction is required to switch back again. If the output signal switches on, the reference voltage is reduced, if it switches off, it is increased again. So small variations of the input voltage cannot cause the output switching back, thus avoiding oscillations.

These papers and articles discuss the causes of the oscillations and how to prevent them. When reading with the converse intention, perhaps we could get some ideas on how to incite them

1. Kay, Art; Claycomb, Timothy: Comparator with Hysteresis Reference Design. TIDU020A. Texas Instruments Incorporated, 2013–2014.
https://www.ti.com/lit/ug/tidu020a/tidu020a.pdf

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

3. Application Note 74. LM139/LM239/LM339 A Quad of Independently Functioning Comparators. Application Report SNOA654A. Texas Instruments, Incorporated, 2004–2013.
https://www.ti.com/lit/an/snoa654a/snoa654a.pdf

4. Grohe, Paul: Application Design Guidelines for LM339, LM393, TL331Family Comparators Including the New B-versions. Application Report SNOAA35A. Texas Instruments, Incorporated, 2019–2020.
https://www.ti.com/lit/an/snoaa35a/snoaa35a.pdf

Some data sheets:
5. LM339, LM239, LM139, LM2901 Quad Differential Comparators. Data Sheet SLCS006U. Texas Instruments, Incorporated, 1979–2018.
https://www.ti.com/lit/ds/symlink/lm2901.pdf

6. TLV4011 Precision Comparator with Integrated Reference. Data Sheet SLVSFL9.  Texas Instruments, Incorporated, 2020.
https://www.ti.com/lit/ds/symlink/tlv4011.pdf

7. LMV727x Single and Dual, 1.8-V Low Power Comparators With Rail-to-Rail Input. Data Sheet  SNOSA56I.   Texas Instruments, Incorporated, 2003–2015.
https://www.ti.com/lit/ds/symlink/lmv7271.pdf

8. MAX40002–MAX40005/ MAX40012–MAX40015 nanoPower 4-Bump Comparator in Ultra-Tiny 0.73mm x 0.73mm WLP/SOT23 Packages. Data Sheet 19-8574. Maxim Integrated Products, Inc., 2020.
https://datasheets.maximintegrated.com/en/ds/MAX40002-MAX40005.pdf

9. LTC1841/LTC1842/LTC1843 Ultralow Power Dual Comparators with Reference. Data Sheet 1284123f. Linear Technology Corporation, 1998 / Analog Devices, Inc., 2020.
https://www.analog.com/media/en/technical-documentation/data-sheets/184123f.pdf

We need comparators without built-in hysteresis. This obvious requirement could comparators in microcontrollers or FPGAs render not suitable. To be reasonable fast, the random number generator requires some or even many comparators. So especially tiny comparators are of particular interest.

10. Matthes, Wolfgang: Microcontroller Modules for the Ambitious. Circuit Cellar, Issue 312, July 2016


p.31: Understanding the Ultra96 Board (Part 1): The Hardware, By Nishant Mittal

References:
[1] Product page: https://www.96boards.org/product/ultra96
[2] http://pmbus.org/Assets/Present/Using_The_PMBus_20051012.pdf
[3] Schematic: https://www.96boards.org/documentation/consumer/ultra96/ultra96-v2/hardware-docs/files/ultra96-v2-schematics.PDF

Xilinx reference: https://www.mouser.in/datasheet/2/903/ds891-zynq-ultrascale-plus-overview-1662253.pdf

96Boards.org | www.96boards.org
Avent | www. www.avnet.com
Infineon Technologies | www.infineon.com
Micron Technology | www.micron.com
ON Semiconductor | www.onsemi.com
PYNQ | www.pynq.io
Renesas Electronics | www.renesas.com
Xilinx | www.xilinx.com

p.36: Build a Line Follower Robot: With Arduino and PID Control, By Alexandru Dumitrache

Adafruit | www.adafruit.com
EasyEDA | www.easyeda.com
FTDI Chip | www.ftdichip.com
Microchip Technology | www.microchip.com
Pololu | www.pololu.com
SketchUp | www.sketchup.com
Solarbotics | www.solarbotics.com
SparkFun | www.sparkfun.com

p.42: IC and Software Solutions Enable Machine Learning: FPGAs, MCUs and Software, By Jeff Child

Achronix | www.achronix.com
AMD | www.amd.com
Eta Compute | www.etacompute.com
Flex Logix Technologies | www.flex-logix.com
Microchip Technology | www.microchip.com
Qualcomm Technologies | www.qualcomm.com
Quicklogic | www.quicklogic.com
SensiML | www.sensiml.com
STMicroelectronics | www.st.com
Renesas Electronics | www.renesas.com
Xilinx | www.xilinx.com

p.50: App-Specific Trend Drives Test and Measurement Gear: Market Mindset, By Jeff Child

Keysight Technologies | www.keysight.com
Measurement Computing | www.mccdaq.com
Pico Technology | www.picotech.com
Rohde & Schwarz | www.rohde-schwarz.com
Siglent | www.siglentna.com
Tektronix | www.tek.com
Teledyne LeCroy | www.teledynelecroy.com

p.55: DATASHEET: DC-DC Converters: Technology Charging Ahead, By Jeff Child

MINMAX Technology  | www.minmax.com.tw
Murata Power Solutions  | www.murata.com
RECOM  | www.recom-power.com
TDK-Lambda Americas  | www.us.tdk-lambda.com
Vicor  | www.vicorpower.com
XP Power  | www.xppower.com

DATASHEET URLS:

MINMAX Technology        www.minmax.com.tw/en/download/files/2500/MCW04_Datasheet.pdf

Murata Power Solutions        www.murata.com/products/productdata/8807040516126/uwe-q12.pdf

RECOM        www.recom-power.com/en/rec-s-RxxCTxxS.html

TDK-Lambda Americas https://product.tdk.com/info/en/catalog/datasheets/pxd-m_e.pdf

Vicor        www.vicorpower.com/documents/datasheets/ds-DCM3717S60E14G5TN0-VICOR.pdf

XP Power        www.xppower.com/portals/0/pdfs/SF_DTJ15.pdf

p.58: EMBEDDED IN THIN SLICES: FreeRTOS (Part 1): Intro to Real Time Operating Systems, By Bob Japenga

References:
[1] https://www.bbc.co.uk/programmes/p083t547
[2] https://www.innovationhartford.com/hal-taylors-innovative-work-with-utc-and-nasa/ This article provides some background about the LM AGS.
[3] https://www.hq.nasa.gov/alsj/a11/a11.1201-pa.html For more details about the 1201 and 1202 alarms
[4] https://edu.gcfglobal.org/en/computerbasics/understanding-operating-systems/1/
[5] Wikipedia provides some useful definitions and examples of “bare metal” systems https://en.wikipedia.org/wiki/Bare_machine
[6] https://techterms.com/definition/operating_system
[7] https://en.wikipedia.org/wiki/Operating_system August 24th, 2020
[8] https://en.wikipedia.org/wiki/Ventricular_assist_device for a good definition
[9] “FreeRTOS is a real-time kernel (or real-time scheduler) on top of which embedded applications can be built to meet their hard real-time requirements.” from https://www.freertos.org/wp-content/uploads/2018/07/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf
[10] Wikipedia gives a good general summary of each of the scheduling algorithms https://en.wikipedia.org/wiki/Real-time_operating_system#Algorithms
[11] See Circuit Cellar articles – Issue 271 February 2013 Concurrency in Embedded Systems and Issue 273 April 2013 Introducing Linux Concurrency

FreeRTOS | www.freertos.org

p.62: FROM THE BENCH: Automated TV Antenna Positioning System: Zeroing in on HDTV, By Jeff Bachiochi

References:
[1]  Image source: Antennas on rooftops: https://www.everthenomad.com
[2]  Free TV content in your area: http://www.fcc.gov/media/engineering/dtvmaps
[3]  BNO055 datasheet:  http://www.adafruit.com/datasheets/BST_BNO055_DS000_12.pdf
[4]  Winegard RFL-332 SensarPro TV signal strength meter
www.winegard.com/products/accessories/signal-meters
[5] The Tablo:  https://www.tablotv.com
Adafruit | www.adafruit.com
Espressif Systems | www.espressif.com
Honeywell | www.honeywell.com
Winegard | www.winegard.com

p.68: THE DARKER SIDE: Voltage-Level Translation Techniques: Managing Mixed-Voltages, By Robert Lacoste

References:

[1] Logic Guide
Texas Instruments
https://www.ti.com/lit/sg/sdyu001ab/sdyu001ab.pdf
[2] SN74AC00 quadruple 2-input positive-NAND gate
Texas Instruments
https://www.ti.com/lit/ds/symlink/sn74ac00.pdf
[3] MT-098 Tutorial: Low Voltage Logic Interfacing
Analog Devices Inc
https://www.analog.com/media/en/training-seminars/tutorials/MT-098.pdf
[4] Voltage level translators search engine
Texas Instruments
https://www.ti.com/logic-circuit/voltage-level-translation/overview.html
[5] SN74LV1T34 Single Power Supply BUFFER Logic Level Shifter
Texas Instruments
https://www.ti.com/product/SN74LV1T34
[6] 74LVC245A Octal bus transceiver; 3-state
Nexperia
https://assets.nexperia.com/documents/data-sheet/74LVC_LVCH245A.pdf
[7] MAX3370 – 1µA, 2Mbps, Low-Voltage Level Translators in SC70 and µDFN
Maxim Integrated
https://www.maximintegrated.com/en/products/interface/level-translators/MAX3370.html
[8] ADG3301 – Low Voltage 1.15 V to 5.5 V, Single-Channel Bidirectional Logic Level Translator
Analog Devices
https://www.analog.com/en/products/adg3301.html
7400-series integrated circuits
Wikipedia
https://en.wikipedia.org/wiki/7400-series_integrated_circuits

4000-series integrated circuits
Wikipedia
https://en.wikipedia.org/wiki/4000-series_integrated_circuits
Voltage Translation Buying Guide
Texas Instruments
https://www.ti.com/lit/sg/slyy165/slyy165.pdf

Analog Devices | www.analog.com
Maxim Integrated | www.maximintegrated.com
Nexperia | www.nexperia.com
Texas Instruments | www.ti.com

p.79: The Future of Chiplets: Specialized Chiplets Revive Moore’s Law, By Syed Alam

References:
[1]  Omdia https://omdia.tech.informa.com
[2] https://fuse.wikichip.org/news/3184/ocp-makes-a-push-for-an-open-chiplet-marketplace
[3] https://semiengineering.com/the-next-advanced-packages

Accenture | www.accenture.com

———————————————————————————————————————————————-

ADDENDUM TO: True Random Number Generation: Using Comparators, By Wolfgang Matthes

Project History
Comparators behave nastily when the difference voltage between the two inputs remains some time within the magnitude of the offset voltage (in other words, within the linear region). Without countermeasures (e.g., hysteresis), a typical comparator will oscillate. The idea was, to employ these oscillations to generate random numbers. An experimental setup was built to verify the principle. However, it was not that easy to generate true random bit patterns that could pass appropriate certification tests. In the end,  principles have been found that may lead to acceptable true random numbers (TRNs). I have filed two patent applications (in Germany), covering the principles of operation. To develop fully-fledged devices, to get them certified, manufactured, and marketed, however, requires a considerable amount of work and money.  It has shown impossible to raise adequate funding. So I have decided to make the principles freely available in the realm of open sources.

German patent applications:
1.         Verfahren und Vorrichtung zum Erzeugen von Zufallszahlen
DE file number: 10 2015 010 518.3
Application date: August 13, 2015
https://register.dpma.de/DPMAregister/pat/register?AKZ=1020150105183

2.         Verfahren und Vorrichtung zum Erzeugen von Zufallszahlen durch Auswertung des Schwingungsverhaltens von Komparatoren
DE file number: 10 2016 005 082.9
Application date: April 27, 2016
https://register.dpma.de/DPMAregister/pat/register?AKZ=1020160050829

Both patents have lapsed.

License conditions
The technical solutions communicated here can be used freely (open-source hardware / open-source software). The terms of the CERN Open Hardware License Version 2 – Permissive apply. Functionality, suitability for any purpose, and freedom from other property rights cannot be guaranteed. The license terms – together with more detailed explanations – can be found at the following Internet addresses:
https://www.ohwr.org/project/cernohl/wikis/home
https://www.ohwr.org/project/cernohl/wikis/Documents/CERN-OHL-version-2
https://ohwr.org/cern_ohl_p_v2.pdf

Experiments
What has been built and programmed is essentially an experimental setup as a proof of feasibility.  It consists of  a microcontroller with attached comparator-based circuitry, a program running in the microcontroller, generating random bit patterns, programs running on a personal computer to set up and control the microcontroller program and to capture and evaluate the random bit patterns.

Figure A1. A look at the workplace. The arrow points to an adapter injecting collaring pulses from the signal generator behind. To the left a venerable Tektronix 5441 storage oscilloscope.


OLYMPUS DIGITAL CAMERA

Figure A2. A look at the experimental setup. The human interface module has been described in “Microcontroller Modules for the Ambitious” Circuit Cellar, Issue 312, July 2016, the microcontroller module is a more advanced version, carrying an Xmega microcontroller.


OLYMPUS DIGITAL CAMERA

Figure A3. The prototyping board carries four comparators, the counters, and the auxiliary circuitry. U1 is a Xilinx 9536 CPLD, U2 an LM339 quad comparator. The crystal oscillator U3 is a clock source used to capture the width of the oscillation pulses (by counting) and to generate collaring pulses.


Figure A4. An example of a display on the human interface module. All numbers are in hex (remember, it’s about tinkering, and the microcontroller is programmed in assembler …).


Some screenshots
Oscilloscopes used: Tektronix 5441, Agilent 6014A, and Agilent/Keysight 3024A.

Figure A5. Here the comparator behaves like described in the textbooks. The sinusoidal input voltage is converted into a pulse. The slow rise of the leading edge is the consequence of the open-collector output.


Figure A6. A slowly changing input voltage (here: the yellow traces) causes oscillations.


Figure A7. This is a snapshot of our random number generation. The input voltage is increased in small steps.


Figure A8. Experimenting with feedback via a capacitor. In the left picture, it is connected to the positive input, in the right picture to the negative. For comparison, see Figures 13 and 14 in the printed article.


Figure A9. Normal operation without additional feedback. For comparison see Figure 15.


Figure A10. Here the additional capacitor is connected to the positive input. For comparison, see Figure 16.


Figure A11. Here the additional capacitor is connected to the negative input. The green trace shows the input voltage. For comparison, see Figure 17.


Some details of the principles of operation

Figure A12. A comparator-counter circuit, comprising an 8-bit counter and an auxiliary 2-bit counter. The 8-bit counter ceases counting when 255 oscillations have been counted. This limit resulted from observing the comparator’s behavior on the oscilloscope. Only a few oscillations would evidently deliver insufficient entropy, counting 200 or more oscillations would not improve entropy but consume too much time. The auxiliary counter contributes the two least significant bits independent of the number of oscillations.


Figure A13. The experimental setup consists of four comparator-counter circuits. The counter contents are read out via an 8-bit  data bus.


Figure A14. Each comparator has, depending on its reference voltage, a region of the input voltage in which oscillations will occur if traversed not too fast. This portion of the linear region, called the VIN window, is defined by a lower and an upper VIN limit. It is reached and traversed in steps. In the 1st loop, the microcontroller emits coarse steps until the counter outputs begin to change (1). Then, the region is traversed in fine steps until the counter ceases to count (2). The VIN values at the points (1) and (2) are stored as the lower and the upper VIN limit, thus defining the VIN window. 


Figure A15. The basic parameters are to be found experimentally, above all the slew rate or, in other words, the dwell time in the VIN window. To secure sufficient entropy, a somewhat larger number of oscillations should be counted. On the other hand, it should not take too long to obtain a random bit. It was an intuitive decision to provide an 8-bit counter. The CNT_MIN and CNT_MAX values are parameters to be entered. As a starting point, we may begin, for example, to stipulate more than 32 oscillations, but no more than 128.


Figure A16. This hierarchy diagram depicts the components of the software running in the platform’s microcontroller.


Figure A17. The main window of a control program. Communication between the personal computer and the microcontroller is via a serial (RS-232) link. Commands are entered as hex numbers or by clicking the corresponding button. The communications protocol appears in the window to the left. To the microcontroller, 12 parameters are sent, whose meaning depends on the experiment to be executed. Analog voltages are set via the sliders.


Figure A18. Here an experiment has been run. The generated random bit pattern is shown. 333 774 bits have been produced, among them 167 309 zeros and 166 459 ones. Six passes of the bit generation loop were not successful. The difference between zeros and ones yields a bias of 850 or 0,255%.


Figure A19. This program evaluates bit patterns and converts them to files. It has been written with deliberate neglect of comfort (e.g., no file handling dialogues). The logout relates to the test pattern shown in the File Content window.


Figure A20. To generate a random bit, the linear region is to be traversed. In a first loop, the software begins to emit somewhat coarse input voltage steps. In each step, the content of the counter is read.  When its value has been changed, the linear region has been reached where the oscillations begin. Then the second loop will traverse the linear region in fine steps. The count values are collared. The second loop ends when the counter content changes no more.


Figure A21. This example shows how the outcome depends on the distance of the collaring pulses.        


Figure A22. This flowchart illustrates the algorithm to evaluate the collared values. This is preceded by the algorithm depicted in Figure 9 in the printed article, supplemented by a subroutine or interrupt handler that stores (collars) counter values occasionally.


Figure A23. This block diagram illustrates the same algorithm. It is, however, implemented in hardware. The collared values, however, are not brought into a RAM but evaluated on the fly. This way some or even many comparators could be operated in parallel.

More Details
They may be found on the author’s homepages (see below). It is not expedient to repeat the first experiments, conducted in 2015 and 2016. The descriptions and sources, however, may find their good use as a starting point for experiments and further development. For example, one could begin with one of the ubiquitous small microcontroller modules and, at first, find out whether some of the built-in peripherals, especially counters and comparators, may be of use or not. Random number generation and evaluation could be written in a convenient high-level language and executed on the microcontroller without needing a PC. I recommend, however, to write the innermost bit generation loop in assembler. Thus the program cycles generating the random bits will not depend on the intricacies of a compiler. (Please consider that an eventual certification may become invalid if the innermost algorithm is modified, even by minute deviations that may be caused by re-compiling.)  CPLD or FPGA design, if necessary, could be done not by drawing schematics but by describing the desired behavior, e.g., through a language like Verilog or VHDL.   

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.ti.com
(Author’s note: I prefer to look first into the technical documentation manufacturers of real hardware provide, not into academic textbooks.)


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

 
 
Note: We’ve made the October 2017 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.
Become a Sponsor
Website | + posts

Circuit Cellar's editorial team comprises professional engineers, technical editors, and digital media specialists. You can reach the Editorial Department at [email protected], @circuitcellar, and facebook.com/circuitcellar