3.3V to 5V Level Adjustment

Only just after I’d written last month’s post about an X-Y-Z display for an HUD, the customer asked for a spot of extra help with his new playtoy.

Uh oh - image not centred and way too big...

Uh oh – image not centred and way too big…

The Oscilloclock Deflection Board currently assumes X and Y input ranges of 0-5V, centred on 2.5V. However, the customer was programming an Arduino-based controller board with analogue output from 0-3.3V. Applying this directly of course didn’t break anything, but sure did make it hard to centre on screen! Would there be a quick way to adjust voltage levels?

Another issue was that the gain in the current-revision Deflection Board is hard-wired, and the image was not the right scale to just fit the screen. The gain could be changed via a single resistor per channel, but would there be an easier, more flexible way?

YES on both accounts!

A Quick and Dirty Level Adjuster

A bit of research and doodling the next day, followed by an even quicker breadboard test in the evening, and the basic level/gain adjuster circuit below was born!

Very simple circuit for a 3.3V to 5V level adjuster

Very simple circuit for a 3.3V to 5V level adjuster

... breadboarded up and ready for testing!

… breadboarded up and ready for testing!

Testing it out

Avid readers will recall that I lose no opportunity to flex my old equipments’ muscles. Let’s see what gets powered up this time!

First, I used an NF DF-193A to generate a nice sine wave centred on 1.62V (approximately 3.3V / 2) with 1V amplitude. (NF Corporation is a niche Japanese manufacturer of high-performance test equipment. The quality (and secondhand pricing!) approaches that of HP and Tektronix.)

Simple 3.3V to 5V analog level adjuster - Test setup

Next, I checked  the output of the circuit on a slightly less venerable and arguably uninteresting HP 54615B 500MHz oscilloscope. The output was a nice 1V P-P sine wave, and slight adjustment to the 130K resistor allowed it to centre nicely on 2.5V.

Simple 3.3V to 5V analog level adjuster - Leveled Output

And the gain adjustment? Changing the value of the 22K feedback resistor worked a charm! However, it also affected the offset level, as shown below.

Simple 3.3V to 5V analog level adjuster - Offset effect on Gain

Changing gain (1.03 to 0.98) impacted the offset (2.443V to 2.648V)

This is certainly not my ideal circuit, because the two adjustments interact with each other. Ah well, I did say that it was quick and dirty…

Op amp selection

One thing to be careful with here is to choose a rail-to-rail op amp. The hapless customer initially tried this out with an LM358, and obtained an awfully shaky and unstable output. It turns out that this chip is a particularly poor performer for this application on a single 5V supply, because its input range is limited up to only Vdd-3V. Even the 2.5V centre area would be unstable!

Other op-amp selection tips: Choose a lower-bandwidth device (say <50MHz) to avoid oscillation without worrying about layout and external damping. Also, choose a device that is stable at (and below) unity gain!

Good enough? Maybe…

This circuit probably got the customer out of a tight spot, but I really do need to make a revised Deflection Board with a proper on-board level and gain adjustment feature. Without the unwanted interaction…

Yet another task on the ever-growing list!