Learn how to make your own arbitrary waveform generator using an ATmegap, a DDS function generator IC, an op-amp, a few passives, and some hard work. Microcontroller Design for an Arbitrary Waveform Generator. Having your own electronics laboratory at home is great—the only downside is that even basic equipment can be costly. Building your own devices is not only easier on your wallet, but it is also a great way to improve your knowledge.
Therefore, in this article, I am going to explain how to build your own function generator. First, a function generator also called a tone generator is an electronic device that can output a specific waveform at a set frequency.
For example, one could generate a sinusoidal signal at 60Hz. You can use it to test the inner workings of audio amplifiers, find the characteristic of op-amps and diodes, make funky noises—the list of applications goes on.
A DDS function generator is a digital arbitrary waveform generator, meaning it uses a digital-to-analog converter DAC to build a signal. It also has read only memory ROM where it stores amplitude values for specific waveforms at various time intervals based on a sampling frequency Fs.
The aim is to build a reliable function generator that can go up to 1MHz in frequency, up to 9V in amplitude, and that allows you to choose between sinusoidal, triangle, and clock i.
There are two main parts regarding the hardware aspect of this build: the power supply and the main PCB containing the function generator IC and the microcontroller. The symmetrical supplies are needed for the final amplification of the signal. Below you can find the schematic of the power supply board:.
To obtain these voltages, a transformer will be used, from V or V depending on your region to two 12V AC lines on the transformer it will usually be written something along the lines of 12V-0VV. An output current of mA is more than sufficient. Remember that the output of a transformer is AC and we need DC.
How to Build Your Own Function Generator Using Analog Devices’ AD9833
For this, we will be using a simple rectifier bridge. These usually come as standalone components but you can alternatively use four general purpose diodes such as 1N We will not be using it in the standard configuration as we want a symmetrical output, so we will connect them as in the schematic above: the ends of the transformer are connected to the rectifier, and the center tap is connected to ground.
Below you can find the output waveforms for the power supply rails at various stages:. In addition, to remove the ripple, two voltage regulators are used, the classic LM and its sibling the LM, which is used for negative voltages. We want this supply to be as smooth as possible, as we will be using them to offset our final output voltage, and any AC components will propagate to the output.
We will be using only one user input component, a rotary encoder with an integrated switch. This will be our control element to set the frequency, signal type, and other settings. Because mechanical contacts are not perfect, when we rotate the encoder, instead of an ideal pulse, a jittery signal will appear, but this can be easily fixed either by software or hardware using a capacitor.
You turned it off, so they do not work. You mayst find the RF soon much more interesting It can be seen, that the waveform looks nice from 1 Hz to kHz and then it starts slowly to degrade. Duty cycle is more symmetric. This mayst be used as a low frequency arbitrary waveform generator. Update rate in the kHz range. To keep the form-factor small, components have been used. As their number is manageable, this might as well serve as a soldering exercise.
When connected to a pc, a small menue will show up on the serial monitor. Using a digital supply to power analog circuit is somehow challenging. Putting a veeeery large capacitor there mostly solves any issues - but the formfactor of the capacitor was slightly larger than the box.
We therefore remembered this capacitance multiplier thing, which finally did its job very well. The circuit below explains how it works The value of C7 was the largest available in size Ideally R9 is as large as possible, but that will lower the output voltage.Function generator is a very useful tool, especially when we are considering testing our circuit's response to a certain signal.
In this instructable I'll describe the building sequence of small, easy to use, portable function generator. Did you use this instructable in your classroom? Add a Teacher Note to share how you incorporated it into your lesson. There are a lot of circuits that require some testing equipment in order to get information about circuit's response to a certain waveform. This project in based on Arduino Arduino Nano in this casewith 3. It is known that Arduino Nano board requires 5V as a power supply, so electronic design contains DC-DC boost converter that converts 3.
Thus, this project is easy to build, completely modular, with relatively simple schematic diagram. Since AD has no capability to change output signal amplitude, I've used a digital 8-bit potentiometer as a voltage divider at the device output endpoint Will be described in further steps.
Display: is the basic 16x2 LCD, which is probably the most popular liquid-crystal display among Arduino users. In order to reduce energy consumption, there is an option to adjust LCD backlight via PWM signal from the Arduino pre-defined "analog" pin.
In order to make it easier to understand the schematic diagram, description is divided in sub-circuits while every sub-circuit has responsibility for each design block:. Arduino Nano module acts as a "Main Brain" for our device. It controls all the peripheral modules on device, in both digital and analog operating modes.
Since this module has its own mini-USB input connector, it will be used both as a power supply input and programming interface input. There is an option for using dedicated analog pins A Notice that battery voltage line VBAT is attached to the analog input pin A7, because we need to get its value in order to determine low battery state of Li-ion battery voltage.
Power supply circuit is based upon powering the whole device via Li-ion battery 3. As it can be seen from the schematics, when external power supply is connected via micro-USB connector of the Arduino Nano module, battery is being charged through TP module. Make sure that bypass capacitors of several values are present on the circuit, since there is a DC-DC boost converter switching noise on ground and 5V potentials of the whole circuit.
This sub-circuit provides appropriate output waveform, defined by AD module U1. Since there is only single power supply on device 5Vthere is need to attach coupling select circuit to the output cascade.
C1 capacitor is connected in series to the amplitude selection stage, and can be silenced via driving current on the relay inductor, thus making output signal traced straight to the output stage. C1 has value of 10uF, it is sufficient for the waveform even of low frequencies to pass through capacitor without being distorted, only affected by DC removal. Q1 is used as simple BJT switch used to drive current through relay's inductor. Make sure that diode is connected in a reverse allocation to the relay inductor, in order to avoid voltage spikes that can damage the device circuits.
Last but not least stage is an amplitude select. U6 is 8-bit digital potentiometer IC, that acts as voltage divider for a given output waveform. Encoder circuit is a control interface, defining whole device operation.
Signal Generator AD9833
U9 consists of encoder and a SPST switch, so there is no need to add additional buttons to the project. Encoder and switch pins should be pulled up by an external 10KOhm resistors, but it can also be defined via code. It is recommended to add 0. All the external parts of the device are connected via JST connectors, thus making it much more convenient to assemble the device, with an additional feature of reducing place for mistakes during the building process. Mapping the connectors is done this way:.
First of all, there is need to crop the prototype board to the size of desired enclosure dimensions.Every Engineer who loves to tinker with electronics at some point of time would want to have their own lab set-up. While all of these can be purchased, we can also easily built few on our own like the Function Generator and the Dual mode power supply.AD9833 Function generator
In this article we will learn how quickly and easily we can build our own Function generator using Arduino. This function generator a. Apart from that, the generator can also produce since wave with frequency control. Do note that this generator is not of industrial grade and cannot be used for serious testing. But other than that it will come in handy for all hobby projects and you need not wait in weeks for the shipment to arrive.
The complete circuit diagram this Arduino Function Generator is shown below. As you can see we have an Arduino Nano which acts as the brain of our project and an 16x2 LCD to display the value of frequency that is currently being generated. We also have a rotary encoder which will help us to set the frequency. The complete set-up is powered by the USB port of the Arduino itself.
Hence I had to mess up with the wiring a bit by changing the pin order. Anyhow, you will not have any such issues as it is all sorted out, just follow the circuit carefully to know which pin is connect to what.
You can also refer the below table to verify your connections. The circuit is pretty simple; we produce a square wave on pin D9 which can be used as such, the frequency of this square wave is controlled by the rotary encoder. You can build the circuit on a breadboard or even get a PCB for it. But I decided to solder it on a Perf board to get the work done fast and make it reliable for long term use.
My board looks like this once all the connections are complete.
If you want to know more on how the PWM and Sine wave is produced with Arduino read the following paragraphs, else you can scroll down directly to the Programming Arduino section. People who are using Arduino might be familiar that Arduino can produce PWM signals simply by using the analog write function.
But this function is limited only to control the duty cycle of the PWM signal and not the frequency of the signal.I built it to try out the AD module for comparison. There doesn't seem to be any simple way to tell the displays apart except to try each library and see which works. Having resolved the software issue that was preventing the ST from working initially, I've attempted to write the software to make the choice of library as simple as possible so the circuit should work with either display after a couple of changes to the software.
The Rotary Encoders The rotary encoder conected to ATmega pins D2 and D3 - which triggers an interrupt routine in the software - controls the frequency which is written to the AD module and to the output.
The frequency increments by a factor of x1, x10, x, x and so on. The actual increment is set using the second rotary encoder - which is software driven, rather than using the interrupt. The selected multiplier x1, x10, etc is indicated on the display by highlighting the corresponding digit in yellow. The rotary encoder is connected "backwards" in that rotating the knob counter-clockwise increases the increment.
As a result, the highlighted digit moves to the left as the knob is rotated to the left and vice versa. Just swap D5 and D6 in the software if you prefer it the other way. The rotary encoder library is very good at spotting "illegal" switch positions due to contact bounce so additional de-bouncing hardware or software isn't necessary. I found it virtually impossible to design and test a wideband amplifier on a breadboard so it made sense to have the facility to add it as a separate PCB.
Square waves are output at 5 volts peak to peak whereas the Sine and Triangle are only about mV peak to peak.
As the original idea of building this project was to compare the AD and AD modules, I think the AD provides a cleaner output over a wider frequency range but, if the frequency is kept below 1MHz, the AD has the advantage of also providing a triangular waveform.
The AD module also benefits from an on-board 3-stage low-pass filter to remove any unwanted harmonics.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. If nothing happens, download GitHub Desktop and try again.
If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again.
Portable Function Generator on Arduino
The library allows the user to independently program frequency, phase, and waveform type for both registers. Waveform generation is required in various types of sensing, actuation, and time domain reflectometry TDR applications.
The output frequency and phase are software programmable, allowing easy tuning. No external components are needed. The frequency registers are 28 bits wide: with a 25 MHz clock rate, resolution of 0. The AD is written to via a 3-wire serial interface. This serial interface operates at clock rates up to 40 MHz and is compatible with DSP and microcontroller standards.
The device operates with a power supply from 2. Exit the Arduino program if open and restart it to see the AD library along with its sketch examples.
It has been tested on the Arduino Micro. Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up. Library to control the AD waveform generator. Branch: master. Find file. Sign in Sign up. Go back. Launching Xcode If nothing happens, download Xcode and try again.
Latest commit. Latest commit d6b Jul 31, You signed in with another tab or window. Reload to refresh your session.A signal generator is a very useful piece of test gear.
You can optionally add an OLED display. The AD can gererate sine, triangle and square waves from 0. There have been other Instructables using an Arduino and an AD, here and here. This is simpler and can be used as a sweep generator. Sweep generators help test the frequency response of filters, amplifiers and so on. Unlike the other Instructables designs, this does not include an amplifier or amplitude control but you could add them if you wanted. Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson. No PCB is needed. The AD module I chose is similar to this one. I'm not saying that's the best or cheapest supplier but you should buy one that looks like that photo or the photo avove. I've added a n decoupling capacitor because I thought I "ought" to but I couldn't see any difference - there is already a decoupling capacitor on the AD module board.
The USB emulates a serial port running at bps 8-bits, no parity. The commands are:. The Arduino program contains two 6-character arrays "min" and "max. If you transmit a digit then it is shifted into the "min" array. If you send an 'S' then the "min" array characters are converted into a longint frequency and sent to the AD So sending the string.
You must always send all 6 digits. The minimum frequency is and the maximum frequency is If you send an 'M' then the "min" array is copied into the "max" array. If you send an 'H' then the AD repeatedly outputs a gradually increasing frequency over 5 seconds.
It starts at "min" frequency and 5 seconds later is at "max" frequency. The frequency change is logarithmic so after 1 second the frequency will be Hz, after 2 seconds Hz thenand The frequency is changed every milliSecond. You can download the Windows EXE program below which will send the required commands or you could write your own.
The Arduino INO file is also here. Those of you who have read my oscilloscope Instructable will recognise the similarity.