Ifd Electrical Engineer Scanrail Dreamstime

Ramp Generator Uses Microcontroller Emulation Of Unijunction Transistor

April 2, 2014
By using a standard, low-cost PIC microcontroller with a short block of code that emulates a simple ramp-signal generator based on the venerable unijunction transistor (UJT), you can achieve smooth output and infinite resolution without the challenges of finding, using, and controlling a ramp-signal generator. 

This article is part of the Ideas for Design Series: Vol. 3, No. 3

Unijunction transistors (UJTs) were common circuit elements several decades ago. A simple ramp generator could be built from a single UJT and a few other components (Fig. 1).

1. In a simple UJT-based ramp generator, the current source linearly charges the capacitor to create a voltage ramp. A synchronizing output pulse is also available.

The operating principle is simple. The base-emitter junction is initially in a high-impedance state, and the current source linearly charges the capacitor until a breakdown voltage is reached. At that point, the capacitor discharges through the UJT base until a lower threshold voltage is reached. Then, the base-emitter connection returns to a high-impedance state, and the capacitor can recharge. 

Related Articles

This approach still has a few advantages over digital circuitry, as there are tradeoffs when using a digital-to-analog converter (DAC) to create a ramp. Inexpensive microcontrollers include high-resolution analog-to-digital converters (ADCs), but high-resolution DACs are expensive peripheral components. While such DACs have limited resolution, an analog ramp like one produced by a UJT has infinite resolution.

Download this article in .PDF format
This file type includes high resolution graphics and schematics when applicable.

It’s possible to emulate the action of a UJT using just three I/O pins of a microcontroller and a few other components.  Most microcontrollers allow their I/O pins to be dynamically reconfigured to function as either a high-impedance input or as an output. This feature is the basis for a simple UJT-emulated ramp generator.

In the microcontroller emulation, the current source is implemented by the rail-to-rail operational amplifier IC1b of a dual device and Q1, while IC1a buffers the voltage on capacitor C and provides the ramp output (Fig. 2). This capacitor is connected to both analog/digital converter pin AN0 of the microcontroller (IC2) and to its I/O pin GP1, which is initially configured as an input. A 22-Ω current-limiting resistor allows high-value capacitors to be used without damage to the microcontroller.

2. The microcontroller-based emulation of a UJT ramp generator switches the function of an I/O pin from a high-impedance input state to an output state to implement the ramp-generation function.

The pseudocode listing for the microcontroller continually monitors the capacitor voltage (see the code).

When it reaches a threshold value, it switches the I/O pin from its high-impedance input state to an output state at ground potential. When the capacitor voltage goes below another threshold value, the I/O pin is switched back to a high-impedance state, and the cycle repeats (Fig. 3). The circuit also provides a pulse synchronized with the ramp cycles, which can be used for timing and triggering.

3. The ramp output repetition rate is about 85 Hz using the values shown. It can be changed via resistor R, which sets the charging current, and capacitor C.

Dev Gualtieri received his PhD in solid-state science from Syracuse University in 1974. After many years doing research for a major aerospace company, he now does computer, electronic, and embedded-systems projects at his consulting company, Tikalon LLC (www.tikalon.com) in Ledgewood, N.J. He is the author of several books, available at Amazon.

Read more articles in the Ideas for Design Series: Vol. 3

Sponsored Recommendations

Near- and Far-Field Measurements

April 16, 2024
In this comprehensive application note, we delve into the methods of measuring the transmission (or reception) pattern, a key determinant of antenna gain, using a vector network...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Empowered by Cutting-Edge Automation Technology: The Sustainable Journey

April 16, 2024
Advanced automation is key to efficient production and is a powerful tool for optimizing infrastructure and processes in terms of sustainability.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!