Tuesday, October 30, 2012

[Open 7400 Logic Competition Entry] Using two CD4007 IC as an op amp to generate sine waves

The CD4007 dual complementary pair and inverter is primarily intended for digital logic circuits. It contains an inverter, and two pair of PMOS and NMOS transistors that can be configured to implement any CMOS logic gates. Since we now have access to pairs of transistors, it should be okay to use these transistors for other purposes than digital, in other words: analog. This idea is not new, in fact this article has already mentioned this possibilty, and now I would like to take the challenge to build something somewhat useful out of it, as simple as possible.

First, a bit of demo. Here is the CD4007 op amp working as a sine wave oscillator. It can even drive a small loudspeaker through a capacitor (try to listen to it):


Now comes the explanations. I have actually started a bit on this late last year, and posted its explanations and results there (in Indonesian language). I will repeat some of my earlier post here, in a different language that is.

The circuit for the op amp is shown here:


It needs two CD4007s: one for the differential input stage, and one for the gain stage. Since simplicity is what we are after (not necessarily high performance), I did not use active loads (current mirrors) on the differential input stage, and use a pair of 100k resistors instead. The good thing about this CD4007 though is that the differential input pair transistors are on the same chip, so it would definitely help the matching. If you are after even better matching, using a 1% resistor (not a 5% like I did) would be a good idea.

There are two potentiometers in the circuit. One is the bias voltage for the current source (pin 6-7-8) through a simple voltage divider. The reason to use potentiometers in that voltage divider and in the gain stage is because we are not too certain about the behaviour of the transistors. These transistors need correct operation mode (saturation), and tuning the potentiometers is a simple way to ensure that.

A bit of tuning was necessary to make the op amp work. First we need to adjust the current in the differential pair such that the DC voltage level on its output is 'reasonable' (mid-rail). Then we adjust the other potentiometer to adjust the gain, enough to make it work. The way I did the tuning was by putting the op amp in a simple inverting amplifier and tune the potentiometers until I get the correct output.

The op amp in breadboard looks like this:


The inverting amplifier test circuit I used looked like this:


A terrible video showing that the circuit works can be seen below. I wanted to emphasize that the amplifier works with different DC offset of the input signal as an op amp should do.


Here is a picture of the circuit configured differently, now as an integrator (replace feedback R with C). It generates a triangle from a square wave input.


And finally, the oscillator circuit. The schematic looks like this:


On breadboard, it looks really messy:


But it works. It generates a sine wave!


Trying to tidy it up a little, I made a PCB version of the op amp, which looks like this:



Unfortunately due to lack of time (deadline is coming), I haven't got it to work correctly yet.

Next step:
While the op amp is indeed simple, but tuning may not be a pleasant thing to do. So it would be really nice to get fixed resistor values, and possibly use active loads and final output stage (this one doesn't use a final  --push-pull amplifier-- output stage but surprisingly its theoretically not-too-low output impedance is sufficient for all our purposes!?)

Another idea is to be more extreme, use dedicated inverter ICs such as the 4069, and work that one out as an op amp if possible.

7 comments:

  1. Wow great! Good stuff. I was thinking about doing this next year, but you beat me to it!

    A few questions from the curious:
    1 - Did you measure any IV plots?
    2 - Was the phase compensation capacitor not necessary?
    3a - Did you measure the unity gain bandwidth?
    3b - Did you measure the open look gain?
    4 - Looks like the output drive is pretty low, but were you able to measure it?

    ReplyDelete
    Replies
    1. To clarify, I meant to ask, did you measure any IV plot of the transistors on the 4007. How is the matching between different devices on one IC?

      Delete
    2. Hi Yi Wao,

      Thank you for the interest. This op amp design is a bare minimum basic one, it even lacks the low output impedance of a normal op amp. It was developed as a simple laboratory experiment for undergraduate students, which uses discrete transistors such as 9013 at that time. The aim was not to get good performance, but just to make three features of an opamp: (1) able to amplify voltage differences, (2) further amplification, (3) low output impedance (and high input impedance). Surprisingly, once a circuit have these three features, it can work as an op amp, though a terrible one, but it works in a negative feedback circuit.

      We did have I-V plots of the transistors in CD4007, let me try finding it. But no comprehensive analysis on the opamp circuit has been done yet, just a proof of its functionality.

      Thank you I hope you can improve it on another design to make it better!

      Delete
  2. I included some DC plots of the differential pair stage of the opamp here: http://translate.google.com/translate?sl=id&tl=en&js=n&prev=_t&hl=id&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fhobimikro.blogspot.com.au%2F2011%2F11%2Fmencoba-membuat-op-amp-cmos-dengan.html

    ReplyDelete
    Replies
    1. And here is the I-V characteristics of one of its transistor, measured by a student in our class (Krisno Bimantoro from Gadjah Mada University) http://1.bp.blogspot.com/-qEJMoeev-3g/UJcXg-Vt6VI/AAAAAAAAAoI/US6ssFGRABA/s1600/cd4007iv.png

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Really nice blog!! I am glad to read your post, pretty informative..thanks for providing such a nice post.
    Sine Wave Inverter

    ReplyDelete