01225 650150 | 0800 772 0795 sales@austinconsultants.com

There can be no doubting the dedication and enthusiasm our team. Here, LabVIEW Consultant, Petru Tarabuta, shares a fantastic project he developed, for interest, in this own time.

Project summary

This project uses a National Instruments myRIO and an Arduino Uno to display text on an oscilloscope screen, as seen in the video below.

Acknowledgements

This work was inspired by a project by Alan Wolke (w2aew). Thanks, Alan! The two videos in which Alan is describing his project are found here and here. Alan’s YouTube channel, called w2aew, is one of my favourites, as it contains many excellent electronics tutorials.

Hardware

  • myRIO-1900
  • Arduino Uno
  • One 8-bit and one 6-bit digital-to-analogue converter (DAC)
  • Analogue or digital oscilloscope with X-Y mode capability. The analogue scope used in this project is a Hitachi V‑422. If you plan to use a digital oscilloscope, please read the note at the bottom of the document.

Software

  • LabVIEW, LabVIEW Real-Time and LabVIEW FPGA. LabVIEW 2015 SP1 was used in this project. Earlier LabVIEW versions would work just as well to create the software.
  • Arduino 1.6.12 IDE

 

 Project description

Description of hardware

 The hardware diagram of the system is shown in Figure 1.

Figure 1: Hardware block diagram using the myRIO (left) and Arduino Uno (right) as the source of digital signals

Figure 1: Hardware block diagram using the myRIO (left) and Arduino Uno (right) as the source of digital signals

 

The oscilloscope is used in X-Y mode, which means that the voltage on Channel 1 is interpreted as an X‑axis coordinate and the voltage on Channel 2 is interpreted as a Y-axis coordinate. The X and Y coordinates determine the location of the beam on the oscilloscope screen. By controlling the voltages measured by the Channel 1 and 2 oscilloscope probes, we control the X and Y coordinates of the point that the scope displays. The analogue oscilloscope used in this project uses a single beam, so it always displays a single point on its screen. However, by varying the X and Y voltages quickly enough, the human eye perceives multiple points being displayed at the same time. By cycling through an array of predetermined X-Y coordinates, we create points that contour text, logos or other shapes. The digital signal sources in this project are two microcontrollers: the NI myRIO and the Arduino Uno. In this project, they can be used interchangeably.

 

The digital-to-analogue converters (DAC)

The X and Y digital signals generated by the microcontrollers are passed through two DACs, one for each axis. There are a number of ways to implement a DAC, one of which being to use an integrated circuit (IC). However, in this project, it was chosen to use an R-2R circuit, just like Alan Wolke (w2aew) did in his project. You can find here Alan’s excellent explanation of how this circuit works and why it is called an R‑2R circuit. The advantage of the R-2R ladder circuit is that it can be prototyped quickly with common through-hole resistors. The R-2R circuit schematic for the two DACs used in this project is shown in Figure 2.

Figure 2: Schematic of 8-bit and 6-bit digital-to-analogue converters

Figure 2: Schematic of 8-bit and 6-bit digital-to-analogue converters

 

The value of the resistors can be between 1 kΩ and 10 kΩ (smaller or larger values are likely to work too). The output impedance of the DACs is equal to R (1 kΩ in this case), as explained by Alan (w2aew) here.

It is important to note the role of the capacitors present at the output of the digital-to-analogue converters. The capacitors’ role is to “draw” the line segments linking the X-Y points. This is important because without output capacitors the line segments disappear, leaving only the points themselves displayed on the scope. Figures 3 and 4 show this effect.

 

Figure 3: X-axis capacitor removed. Notice that there are no horizontal segments between the points.

Figure 3: X-axis capacitor removed. Notice that there are no horizontal segments between the points.

 

Figure 4: Both capacitors removed. No line segments between the points.

Figure 4: Both capacitors removed. No line segments between the points.

 

Adding capacitors to the DAC outputs is equivalent to creating an RC time constant at the output of the DACs. This RC time constant prevents instant changes and applies an “inertia” to the DAC output voltage. This “inertia” is what allows the oscilloscope beam to spend some time moving in between points. This draws the lines in between the points.

However, if the time constant is too large, the text will start to get distorted because the capacitors will not have enough time to fully charge or discharge before the digital signal changes to the coordinates of the next point. Screenshots of this effect are shown in the “point dwell time” section below.

In this project 1 kΩ, 1% tolerance resistors were used together with 22 nF output capacitors. The RC time constant is approximately 22 microseconds (22 us = 1,000 ohms * 22 nF). This time constant was found to work well, allowing the use of a “point dwell time” of 150 us per point, while not distorting the text.

A discussion of “dwell time” is found below. Alan Wolke (w2aew) used a similar time constant of 26.5 us achieved by using 3.9 K resistors and 6.8 nF capacitors.

Since there are two working examples of projects using a time constant of 22 and 26.5 us, if you are thinking about replicating this project, a good try would be to use a time constant between 20 and 30 us. For example, you can use 10 kΩ resistors and 2.2 nF capacitors.

The X-axis DAC (8 bit) and the Y axis DAC (6 bit) were implemented on the matrix board seen in Figure 5.

Figure 5: Matrix board with the two R-2R digital-to-analogue converters

Figure 5: Matrix board with the two R-2R digital-to-analogue converters

 

The Arduino Uno offers only 14 DIO lines and that is the reason why one converter is 8-bit and one is 6-bit. Forty DIO lines are available on the myRIO, so two 8-bit, 12 or even 16-bit DACs could be used. However, 6 bits of resolution (64 levels) proved to be enough for the Y axis to produce clear and legible text. Moreover, having one 6-bit and one 8-bit DAC meant that the matrix board could be used interchangeably with both the Arduino Uno and myRIO.

 

The point dwell time

 The amount of time that the microcontroller (myRIO or Arduino) digital output dwells at a stable voltage before moving to the next point is what I called the “point dwell time”. The time duration to write the whole text once is the point dwell time multiplied by the number of points in the text. Let the “text refresh rate” be the reciprocal of the “duration to write the whole text once”. The text refresh rate shows how many times per second the text is drawn on the oscilloscope screen. Above a certain text refresh rate, the human eye perceives the text as flicker-free.

There are 88 points used to write the text “AUSTIN”. It was found that a dwell time of 150 us works well. At this refresh rate and with this many points, the duration to write the whole text once is 13.2 ms, which leads to a text refresh rate of approximately 76 Hz. This is enough for the text to appear flicker-free, as seen in Figure 6.

Figure 6: Text displayed using a point dwell time of 150 us. No distortion.

Figure 6: Text displayed using a point dwell time of 150 us. No distortion.

Reducing the point dwell time below 150 us distorts the text. Figure 7 shows the effect of point dwell times of 100, 50, 20 and 0 us respectively.

Figure 7: The effect of a point dwell time between 100 us and 0 us

Figure 7: The effect of a point dwell time between 100 us and 0 us

 

Notice how the text shrinks down as the dwell time decreases. This is in accordance with circuit theory: there is less and less time for the output capacitors to charge or discharge, therefore the voltage swing at the output of the DACs becomes smaller and smaller, which means the distance between X-Y points becomes smaller and smaller.

On the other hand, if the point dwell time is too large, the “text refresh rate” will drop and the text will start to flicker. The video below shows the effect of a point dwell time of 500, 1000 and 2000 us.

Figure 8: Point dwell time = 2000 us. Text refresh rate = 5.7 Hz

Figure 8: Point dwell time = 2000 us. Text refresh rate = 5.7 Hz

 

 

Getting the point coordinates

 The text “AUSTIN” was printed on the grid shown in Figure 9. The “Squares Bold” font found here was used to print the text. Making use of the grid, the corner points of the letters were identified and their coordinates were recorded.  A LabVIEW VI was used to map the X-Y coordinates taken from the grid to the range appropriate for the myRIO and Arduino: 0 to 255 on the X-axis and 0 to 63 on the Y-axis.

Figure 9: The grid that was used to identify the coordinates of the points that define the text

Figure 9: The grid that was used to identify the coordinates of the points that define the text

 

Description of software

 

myRIO

 The LabVIEW software running on the myRIO consists of an FPGA VI and a Real-Time (RT) Main VI.

 

The Real-Time VI

The role of the RT Main VI is to act as a GUI for the FPGA VI, and to allow the user to change the text being displayed and the point dwell time without having to recompile the FPGA VI. When the user presses the “Send text to FPGA” button, the RT VI sends to the FPGA two arrays of datatype U8 (byte unsigned integer) containing the X and Y point coordinates. Thus, the user can select a predefined text, logo or shape from a drop-down menu, without having to recompile or stop the FPGA. This is how each individual letter inside the word “AUSTIN” is displayed in the main project video at the top of this document. When the user presses the “Update dwell time” button, the RT VI updates the point dwell time of the FPGA VI.

 

Figure 10: Front panel of RT Main VI. The user can press “Send text to FPGA” and “Update dwell time” to change the operation of the FPGA VI.

Figure 10: Front panel of RT Main VI. The user can press “Send text to FPGA” and “Update dwell time” to change the operation of the FPGA VI.

 

The FPGA VI

 The FPGA VI receives the two arrays from RT Main. It cycles through each array, indexing each element and sending it to the digital ports DIO 7:0 and 15:8 on myRIO connector A. Note that DIO lines 14 and 15 are not physically connected to the DAC matrix board, since only lines 13:8 are needed for the 6-bit Y-axis DAC. The point dwell time received from the RT VI is used as the input value to the Wait (us) FPGA function.

Figure 11: The block diagram of the FPGA VI

Figure 11: The block diagram of the FPGA VI

 

Arduino

The starting point for the Arduino program was the sketch that Alan Wolke (w2aew) open-sourced here. Modifying it to suit this project was straightforward. The Arduino sketch used in this project is attached below. A screenshot of the Arduino code is shown in Figure 12.

Figure 12: The Arduino program

Figure 12: The Arduino program

 

Future improvements

  • Implement the algorithm that makes the text appear to rotate around its central axis, as shown in w2aew’s project implementation.
  • Create a PCB to house the two digital-to-analogue converters. Use ICs instead of the R-2R ladder, for smaller circuit footprint.

*Note: A digital oscilloscope can be used if its display persistency in X-Y mode is adjustable. The popular and well performing Rigol DS1054Z DSO does have an adjustable display persistency when used in the traditional Y-T mode, but the persistency cannot be changed from “Min” when in X-Y mode. This means that the DS1054Z displays the points but with the contour of the text cannot be distinguished, as seen in the video below. Also, notice that the X-Y display cannot be made to occupy the whole screen.

 

On the other hand, the Tektronix DSO that w2aew is using here is suitable for displaying text (you can see the “Persist” being set to 5 seconds on the screen of the scope in the video).