As the name suggests, I am going to write about a self-made signal generator based on an AD9833 IC. Also, this is going to be a multi part post, as it is impossible to design and make a fully functional device within a short period of time and even write a single huge blog post. So, today’s post is about an analog part of the DIY signal generator.
The device’s heart is going to be the AD9833 chip. This chip is a sine/triangle/square wave generator IC which puts out up to 12.5 MHz. The problem is that this chip can only change its outputs frequency, but not amplitude nor signal offset. Also, it produces signal only within 0.05…0.7 V range which is usually not very suitable for a generator’s use cases.
Links to project’s all posts
- VCA822 Gain Amplifier Circuit (this post)
- LM7171 Offset Circuit
- Gain and Offset Control Filter Circuit
- Dual 5V Power Supply
- Dual 12V TPS65131 Power Supply
- Battery Charging Circuit with BQ24295
- Basic WEB Interface
- IPS Capacitive LCD on an ESP32
- IPS LCD, ESP32 with eSPI library and Touch screen
- Final PCB Design for the DIY Waveform Generator
- Custom Design PCBs and How To Get Them Manufactured
- Soldering the PCB
- AD9833 Library and Further Output Noise Reduction
- Arduino BQ24295 Battery Charger Library
- LCD GUI with LVGL on ESP-32
- 3D Printed Enclosure
- Finished DIY generator
The Schematic
So, for a testing purposes I have built myself a PCB based on a schematic shown below:
Note, that this schematic is with some problematic parts, which I thought about only after the PCB was already built. These problems might be mentioned in the future, but today’s area of interest is the VCA822 op-amp and its connection to the AD9833.
The PCB was made by me at home. I have written a tutorial how it can be done either by etching with chemicals or with a CNC router.
This op-amp was chosen because it is a variable gain amplifier and it is also one of the cheaper parts in this category. It also has much higher bandwidth than the generator IC will ever need. Initially, the schematic for this part looked like this:
The VCA822 schematic is somewhat similar to regular opamp’s schematic, except for several things. Firstly, the maximum gain is set by R8 and R12 resistors and is equal to 2*(R12/R8) – in this case the gain is 10. The gain can be changed with a voltage applied to J7 connector (Pin 3 of the VCA822). Also, this voltage should change in the range of -1 to +1 Volts. With a +1 V applied the gain is maximum and it lowers linearly as the voltage on the Pin 3 changes.
By the way, you can notice a lot of resistors on the VCA822 inputs. Some of them are optional, as I tried to make a PCB layout for easy future upgradability.
Powering up the DIY generator analog board
First connection to the AD9833 was direct – R5 and R9 were omitted, R6 and R7 were 0 ohms. Also, R15 was omitted as output was directly connected to the oscilloscope trough J10 connector. C7, C5 were 100nF each and C9, C10 were 2uF each.
The opamp was powered from a lab PSU through a voltage divider which created a virtual ground. Also to the same 1k potentiometer was connected which created variable voltage output in the range of -1.5 to +1.5 V.
Signal distortion
Everything seemed alright except the signal output was distorted… Checked the power supply voltages -> +-5 V as needed, so it couldn’t be because of low power voltage. As there were to obvious reason why there was a distortion, I went back to the VCA822 datasheet. According to it, the input voltage can be between 1.6 and -2.1 volts. AD9833 outputs voltage between 0 and 0.7 volts, so everything seemed ok with the inputs.
You can find in the datasheet that the current trough R8 resistor can’t be more than 2.6 mA. As peak voltage at AD9833 output was around 0.7 volts, peak current trough R8 resistor was 3.5 mA – which was more that allowed value. So, there were two solutions to the problem: either to add a voltage divider, or to get rid of DC bias. As this stage doesn’t require to have DC bias (and might be even better without it) – the second option was chosen.
Solving the distortion problem
To remove DC bias at the VCA822 input, a simple RC filter was used, as shown in a schematic below:
C16 was chosen 22uF as I had it laying around as it was with R9 (1k1 Ohms). Also, R6 was chosen with the same value as R9 to balance out voltage offset at the op-amp’s inputs. Note, that at this point R-C values doesn’t really matter much, but they might change in the future.
Generator’s output voltage
After adding R-C input filter, DC bias was removed and there was no noticeable distortion as it was before. But, I have noticed that AD9833 output voltage was a bit lower than before. It should be because of low input impedance of 1.1 kOhm . The AD9833 datasheet doesn’t have a lot of information about AD9833 output capabilities, so I have measured, how its output depends on the load resistance. This might or not be helpful deciding on the future input R-C filter’s values change.
The output test was performed with 2kHz sine wave output and AD9833 being connected to a potentiometer. After turning the potentiometer’s knob, its resistance was measured. Then it was connected to the generator IC output and the output RMS voltage was measured with a multi-meter. RMS values were recalculated to peak to peak values which are also shown in a graph.
In the AD9833 datasheet it is mentioned that the DAC output has internal 200 Ohm resistor. It should be obvious that total resistance will decrease with an added external resistance. Also, output voltage will decrease, and this dependence is shown in a graph above (output frequency was set to 2kHz sine wave). External resistor with values >2kOhm does not make a noticeable voltage difference on the output. So, VCA822 input filter’s R value might be changed to 2kOhms or more in the future. Also, it was noticed that there was no noticeable distortion introduced in the output wave even with load being as low as 50 Ohms.
Summary
So, I believe, that it is everything that I wanted to tell about my first steps of the DIY signal generator. Also, one thing to note: VCA822 gets a bit hot (I could guess about 40-45 C) when powered up. I haven’t found any way to lower its heat output, so at this point I believe it is chip’s normal operation temperature.
Next step to build and test second amplification stage which will add controllable DC bias to the waveform generator’s output.