Image Creation with DAC

The "analogue" outputs on ATmega328-based Arduino boards are PWM digital outputs rather than true analogue outputs. The faster SAMD range includes digital to analogue converters:

  • SAMD21 (M0) - one 10bit DAC 0V-3.3V, maximum 350 kilosamples per second,
  • SAMD51 (M4) - two 12bit DACs 0V-3.3V, maximum 1 Megasample per second.

DACs are commonly used for audio but they can be used to create any electrical signal. Adafruit Learn: Circuit Playground Express (& other ATSAMD21 Boards) DAC Hacks shows how to create low resolution composite video and an AM radio signal in C/Arduino. A compiled language with predictable execution speed is generallly more suitable for DAC output. CircuitPython can be used for high rate DAC output with the aid of a built-in library.

Two DACs

Two analogue outputs allow control of the beam on an x-y oscilloscope. The beam needs to be moved gradually between the start and end of each line to draw a line. The large animation at the top of Overview page shows the lines being progressively interpolated to form increasingly solid-looking set of lines.

Tennis for Two (short, looping clip shown below) was a very early game in 1958 using an oscilloscope as a display.

Tennis for Two (recreation) at Brookhaven National Laboratory (public domain).

This technique works well on both a CRO and DSO.

PC audio cards feature DACs and also can be used to create interesting x-y oscilloscope output. The x-y signals can be crafted to some degree to also playback as music, Jerobeam Fenderson has produced many impressive examples of this.

Three DACs

Some CROs have an advanced feature referred to as x-y-z mode where an additional z input can be used to control the beam intensity. This gives it capabilities similar to a black and white monitor/television.

The Asteroids arcade game used discrete intensity to vary brightness including turning the beam off between objects. This can be seen in Displaying Asteroids XY on an analog oscilloscope (YouTube).

One DAC

Composite video, a descendent of the early 405/441 line television standards, is one way to create image/video output suitable for display on a television. The full bandwidth is around 6-8MHz necessitating a 12-16 megasample per second DAC!

A lower resolution image with a primitive synchronisation scheme can be used to display an image on an oscilloscope with the help of the normal timebase for the x-axis control. A CRO helps here because the brightness of the display varies with beam deflection speed.

The images here show how the beam intensity (brightness) varies with sweep rate.

The near vertical parts of a rapidly rising signal (high slew rate) are barely visible. This is often seen on square waves. Sawtooth waves are also interesting as the ramp will be visible but the vertical part less so.

A sine wave may show some gaps if it's created with low resolution samples or the DAC has very low resolution. These are more likely to visible away from the peaks where the wave has a steeper gradient and hence the difference between each consecutive sample is larger.

A low-resolution image can be formed by allowing the normal timebase to control the beam horizontally and using the DAC to control the vertical position. To draw an on-pixel, the DAC can be set to a value on-screen, if a pixel is not on then the DAC can be set of a value off-screen. If the slew rate is high enough the vertical transitions will be barely visible on a CRO. This technique only allows one pixel per column to be displayed as the beam scans from left to right, multiple scans need to be used to create a complete image. If the frame rate is 60Hz and the image is 50x40 pixels then the DAC needs to output samples at 60*50*40 = 120 kilosamples-per-second (ksps or kHz). This is far higher than the rate required for audio but still within the capabilities of the SAMD21/SAMD51 chips. A large sync pulse can be added to allow the oscilloscope to trigger (start) the horizontal scan. This is, in effect, a crude form of composite video.

This technique is likely to work well on an old CRO but the vertical lines will be too prominent on a DSO.

Prolonged stationary bright points or very bright lines on a CRT-based oscilloscope may damage the phosphor.
This guide was first published on Jul 22, 2019. It was last updated on Jul 22, 2019. This page (Image Creation with DAC) was last updated on Sep 22, 2019.