Tracing All Function on Waveform generator

Owning a decent function Waveform generator is sometimes pretty much mandatory or for an electronics tinkerer to for example evaluate filter circuits or stress test a small MOSFET circuit the one I’ve been using is the Siglent SDG2082X Which works like a charm and offers tons of awesome additional features The only problem is that electronics beginners probably do not want to spend 600 euro on such a piece of equipment Thankfully though,

cheaper function generators do exist like this AE20125 which you can get for around 70 euro and While this generator does create sine square and triangle waves up to a frequency of partly 10 megahertz I’m not satisfied with its maximum output level between – and +5 volts So in this episode of DIY or Buy, let’s see whether we can make our own decent function/ waveform generator or whether we should stick to the buy version instead Let’s get started… [Lookalike by Bartlebeats playing] .

This video is sponsored by JLCPCB(.com), which is slowly becoming a worldwide known PCB brand $2 PCB’s, continuous good quality and fast turnarounds is what they are known for So upload your gerber files today and test their service First off, I had to define what features my DIY function generator should come with Obviously, it should be able to provide a sine,

triangle and square voltage With a frequency of up to ten megahertz and a peak to peak voltage from minus to plus 12 volts (peak-to-peak) The amplitude of the voltage also needs to be adjustable as well as the offset for this voltage Which means it should be able to provide an AC voltage as well as a positive or negative DC voltage.

I think those features are decent base for good function generator So let’s think about creating the different waveforms Which brings us to the problem whether we should go with the analog or digital route If we would go analog then a simple op-amp configuration like this can be found everywhere on the Internet After building the circuit up on a breadboard and powering it,

we can use an oscilloscope to probe each op-amp stage To find out that the first one creates a supposedly square wave the second one a triangle wave and the third one a sine wave and By adjusting the potentiometer at the first stage.

We can also adjust the frequency of the waveforms The way this works is that an op-amp outputs will do anything in Order to keep the difference voltage between its inputs to zero volts Thus at the first stage, We got a multi-vibrator Which means the op-amp outputs will alternate between its high and low states to charge/ Discharge the capacitor so that it reaches the same voltage level as on the non-inverting inputs Created by the voltage divider.

At the second and third stage We got a classical integrator op-amp circuits whose output will fall negatively If a positive constant voltage is applied and rise positively if a negative constant voltage is applied It does that to, like always, keep the inverting input at the same defined voltage level as the non-inverting inputs. In theory, those op-amp circuits sound promising But practically they do not deliver decent waveforms and also come with a minimum frequency Which means we would have to change passive components on the fly to alter the frequency range.

That is a hassle though? Which is why I would only recommend such op-amp circuits if you’re looking for one specific waveform that you do not want to change But if you desperately want to stay analog, then you can always get yourself an xr2206 function generator IC it provides a square wave and triangle slash sign outputs with a frequency of up to one megahertz and only requires a few complementary passive components and If you want to be lazy like me you can even get a complete kit based around them for only six euro and Let me tell you that it works really well for its price But we are still not even close to the features.

I said at the beginning of the video So let’s turn to digital and let’s talk about DDS-which stands for direct digital synthesis To explain it better though. I firstly searched for DDS IC and found this AD8933 Programmable waveform generator IC It’s functional block diagram might seem confusing at first But after studying the 21 pages of the data sheets, it is pretty clear how this DDS IC works First off. We got the phase accumulator,

which super simplified stores all the possible voltage values of a sine wave as phase information between 0 & 2 PI next the SIN ROM turns the phase information into actual mathematical voltage amplitudes and Finally, we got a digital to analog converter Which then spits out our beautiful sine wave So in a nutshell,

it is a more or less glorified memory with attached DAC to generate whatever waveform is stored in the memory and speaking of waveforms, by writing to the control frequency and phase registers We cannot only achieve a frequency of up to 12.5 megahertz But also a triangle and square wave and Since adjusting the output voltage between plus minus 12 volts and adding an offset should be easy to do with an op-amp circuit I started designing my DIY function generator around this AD8933 IC But while

I was getting close to finishing my circuit schematic I noticed that someone else already created a very similar project Caesar Chirilla over at Allaboutcircuits actually created such a project about 1.5 years ago but since I used other components I will still explain my circuits before eventually coming back to his work in Order to use most of his code to save a bit of time and effort Anyway for the power supply we need a center tapped transformer like this one After connecting it to mains voltage, which you should not do if you never worked with electronics before,

since that can be lethal We can see here that between its outer pins We got an AC voltage of 30 volts RMS and between the outer pins and the middle pin around 15 volts RMS This is mandatory to create a plus and minus 12 volt rail at the end of this power electronic circuit whose only job is to power the op amp which allows us to move the waveform around between the two voltage rails Of course, we also got a 5 volt regulator to power.

the Arduino, rotary encoder AD8933 IC and LCD Needless to say the Arduino manages everything like displaying the current frequency and waveform on the LCD Adjusting the values according to the rotation and button presses of the rotary encoder and of course sending the current frequency and waveform information over to the DDS IC and Finally like already mentioned We also got an inverting op-amp circuit with an adjustable gain through a potentiometer of around 22 Which should be enough to boost the DDS IC maximum output voltage of 0.65 volts up to 12 volts by the way.

The second potentiometer connected to the non-inverting inputs is used to generate the offset further amplified waveform So with the theory out of the way, I started soldering all of my components onto a piece of perf board and Afterwards to one another according to my final schematic As soon as my circuit was complete after around 4 hours.

I added wires to the external components as well as headers and Ultimately hooked them all up to the circuits After then connecting the 3 transformer terminals to the circuit It was time for the first powerup, which did not result in an explosion Perfect Instead. I measured all the required voltage rails and thus continued with the programming Now at this point I highly recommend checking out Caesar Chirilla’s article to find out how the code works Since I based my code around his and just changed a few minor things So after.

I uploaded the code I used my oscilloscope to check whether everything worked correctly Which it surely did but since such naked function generator is not comfortable and safe to work with I started measuring the dimensions of all the components and designed a housing for its in 123D design After then 3d printing its which took around 15 hours. I mounted the external components in place and glued the transformer and perfboard into the box Which means my DIY function generator was complete Now after testing it for a bit,.

I have to say that it comes with most of the features that I was looking for but especially in the higher frequency range, it does not work as well as I would have like Of course, it does also not offer a crazy advanced features like my expensive function generator

Leave a Comment