# Sending out the right signals

### Preamble

Once again, I was eBay, this time looking for a cheap signal generator to use with the oscilloscope that I had purchased. This is a quick look at the various options available.

### Signal generators

There were a few NE555 modules for a pound, but only dealt in square waves with a range of 1Hz-200kHz. Other information was sparse.

There is also a kit version:

• Input voltage: 5V-15VDC. 5V power supply, the output current can about 15MA; 12V power supply, the output current can be so 35MA;
• Input Current: ? 100MA
• Output amplitude: 4.2V V-PP to 11.4V V-PP (depending on the input voltage, the output amplitude is not the same)
• Maximum output current:? 15MA (5V power supply, V-PP greater than 50%), ? 35MA (12V power supply, V-PP greater than 50%)

• Output with LED indication, there is no output LED quantity (low straightforward, high level LED off relatively low frequency LED flashes);
• Low-frequency stall: 1Hz ~ 50Hz
• IF stall: 50Hz ~ 1kHz
• In the high-frequency stall: 1KHz ~ 10kHz
• High-frequency stall: 10kHz ~ 200kHz
• the output duty cycle can fine-tune the duty cycle and frequency is not adjustable separately adjust the duty cycle will change the frequency
• the output frequency is adjustable;
• Cycle T = 0.7*(Ra + 2*Rb)*C
• LF gear C = 0.001UF;
• IF file C = 0.1UF;
• In the high-frequency file C = 1UF;
• High-frequency gear C = 100UF, the waveform frequency buyers can own calculations.

For a pound, it’s great, but I thought that that pound could be put towards something better if I kept on scrolling.

Next was a Audio Function Generator kit, Simultanious Square, Triangle, Sine, 20Hz-20kHz from Czechoslovakia for £4 (or £8 if you want a box and BNC connectors). All three wave types that I was after, for a reasonable price.

Also, of note is the 10HZ~300kHz ICL8038 DDS Signal Generator Module Sine Square Triangle Wave, for £5.50.

Then I come across the AD9850 based board, for a fiver, with a range of up to 40MHz!

Here is the top view showing the pinout

However, it is only apparently capable of square and sine waves, no triangle waves unfortunately. Looks good, I think to myself.  However, at first glance, it seems to be a programmable waveform generator, the AD9850, so after a quick google as to how to program the thing,  I came up with the 0-40Mhz, Sine wave generator for \$25 from instructables, whereby the board is programmed via an Arduino Uno, with a library already available. The dds.h library is from Anthony Good – K3NG. Perfect.

Note that it appears that an external potentiometer is required to adjust the duty cycle of the square wave, whereas the other form of this board, below, has an on-board potentiometer. However, that is not actually true – upon closer inspection, there is a tiny variable resistor next to one of the jumper pins. However the potentiometer on the second board type, below, is of the larger type (blue plastic case).

A slightly different variation of the AD9850 board is available, for £7.14, which features an LED and a potentiometer. The potentiometer is used to adjust the duty cycle of the square wave. This is actually the board that is used in the instructables link above. There are fewer pins.

Here is the top view showing the pinout

It should be noted that even though these are quoted as going up to 40MHz, harmonics can creep into the signal, at the higher end of the spectrum (that was mentioned in the instructables guide, as well as in one of the eBay seller descriptions!). Up to 20-30MHz the signal should be OK though.

Again, a board also worth noting is the  AD9833 DDS Signal Generator Module 0-12.5MHz Square / Triangle / Sine Wave, for £6.55 (£5.69). It may have a smaller frequency range but it does do triangle waves, and it does have some rather nice connectors, one output being the original signal and the other amplified x5. It also, like all of the AD9833 boards, has fewer control pins, lacking the parallel programming and using only a serial communication:

Although it is based upon a different programmable waveform generator, the AD9833, I would assume that it is just as easy to control from an Arduino. A library can be found here (from this thread). Here is another library from Doug Gilliland. Here is a sketch to control a naked AD9833, without the board, via SPI. It requires the TimerOne library.

A variation on the above green board, is the AD9833 DDS Signal Generator Module 0 to 12.5 MHz Square / Triangle / Sine Wave, £6.28, which does not have an onboard 25 MHz oscillator, but instead has a MCLK input (see Waveform Generation with AD9833, and SPI). It does not offer the unamplified signal output.

Note that as the Arduino does not have an oscillator output, then this board may not be suitable for use with an Arduino:

The MCLK pin is tied directly to the oscillator of the PIC, and the three SPI communication lines are connected to three I/O pins on the PIC (in this case pins A1, A2, and A3).

Frequency control is not as simple as the previous green AD9833 board, as the output frequency is a function of the frequency of the signal supplied to the MCLK input, rather than just a fixed frequency of 25 MHz supplied by an onboard oscillator.

# Frequency and Phase Registers

In order for the chip to output at a frequency fout and phase shift Φshift we need to have:

$f_{out}=\frac{f_{MCLK}}{2^{28}}\times FREQREG$

$\Phi_{shift} = \frac{2\pi}{4096}\times PHASEREG$

In other words, the output frequency and phase shift are not the values of the frequency or phase registers. They are related by the above equations, so the values you send to the registers need to be modified from the actual frequency and phase shift. For instance, if we sent 200 to the FREQ register and 100 to the PHASE register, and we were using a 20 MHz MCLK, we would output a 14.9 Hz wave with a phase shift of 0.15 radians.

A different form of the AD9833 can be found here, AD9833 Module DDS Signal Generator Module Wave+Circuit Diagram+Test Programm, for £7.60. It is smaller and as such offers only one output.

There is yet another, even smaller AD9833 board, Programmable Microprocessors Sine Square Wave AD9833 DDS Signal Generator Module, for £3.38+99p postage (£4.37). Controlled by the SPI, this can produce sine, triangle (note that the AD9850 can’t produce triangle waves) and square waves up to 12.5MHz, with a maximum of 650mV output (38mV minimum). See [R]amp up! for amplification. It also says AD9837 on the board, not sure why. However, for an extra £2, using the green AD9833 board above, you get an amplified signal, and nice connectors.

A back view, showing the connections

Here is the schematic

Paul Gallagher (github user tardate) has made use of this small AD9833 board – it is worth taking a look at his Arduino sketch, BasicDemoCycle, on github.

There is an updated version of the AD9850, which is the AD9851 board, at £9.29, using the AD9851. It has a frequency range up to 70MHz. Like the AD9850, harmonics can creep into the signal, at the higher end of the spectrum.

There is also a supped up model, the AD9854. I found this board, 100Mhz AD9854 Sine Wave DDS Signal Generator + PC Software Control FSK BPSK, that comes with PC controller software, but is a pricey £45.99, and only does sine and square waves.

### PIC Controllers

If you don’t fancy going for the “using an Arduino as a controller” route, then relatively inexpensive PIC based controllers are available:

These are all from the same seller, itjoe_kam, and all sell for £8

### An all in one unit

To save a lot of hassle you could just plump for the Latest DDS Function Signal Generator Module Sine/Triangle/Square Wave Digital, which seems to be an excellent option as it offers sawtooth, ECG and noise waveforms, on top of the standard square, sinusoidal and triangular waves. At £8.50, it certainly seems a bargain, although a little limited in the bandwidth side of things. The maximum frequency seems a little unclear for the description but 8MHz is quoted, although the 10-65KHz range certainly seems obtainable. It is also unclear which chipset is used.

However, this kit, DDS Function Signal Generator Module Sine Square Sawtooth Triangle Wave Digital, for £8.25, had the following image, so one can assume that an AD1515 ( or 354V30 marking as can be seen in both this and the image below) is used.

Another kit version is also available, for £8.75, which, as it states in the specifications, uses an ATmega16 MCU clocked at 16MHz, so presumably so does the pre-built module above. Note that you are paying an extra 25p for the privilege of building it yourself. Oh well, the kit above is cheaper at £8.25.

One thing that could be a sticking point is that it requires a ±12V supply, which adds to the complexity. The PD9833, PD9850 and PD9851 boards do not appear to have this requirement as they operate off 5V.

Another variant is the New DDS Function Signal Generator Module Sine Square Sawtooth Triangle Wave, for £10.80

This item clearly states the specifications in the item’s description:

Specification:

• Operating voltage: DC7-9V
• DDS frequency range: 1HZ-65534Hz.
• High-speed frequency (HS) output up to 8MHz;
• DDS signal amplitude of the offset amount can be adjusted separately by two potentiometers;
• DDS signals: sine wave, square wave, sawtooth, reverse sawtooth, triangle wave, the ECG wave and noise wave.
• Intuitive keyboard.
• Section into the value: 1,10,100,1000,10000 Hz;
• The power automatically restore the last used configuration.
• Offset: 0.5pp-5Vpp
• Amplitude amount: 0.5Vpp-14Vpp

KEY FUNCTIONS:

The UP output waveform select
The DOWN output waveform select
LEFT output frequency –
RIGHT output frequency +
STOP / RUN the output stop / start

“UP” key waveforms order:

ECG = electrocardiogram wave (in the OFF state, the “left “and “right” keys to set the output frequency. Middle button start, all of the following waveform set)
Rev Sawtooth = reverse sawtooth
SawTooth = sawtooth
Triangle = triangle wave
Square = square wave

Unfortunately, it is not possible to tell what IC it is using.

It is worth noting that if you buy the same thing (more or less – this one uses a AD9851) from a UK vendor, you will pay around 300% more!

### Make a signal generator using only an Arduino

Watch this space. I’ve found a few examples of how to do this using an Uno and just a couple of resistors.

• Arduino simple signal generator from fritzing
• Arduino DDS Sinewave Generator, which only requires a few capacitors, resistors and inductors for a Chebyshef filter, to remove the 32KHz sampling noise. A video is available also.
• A nice example is shown in this Arduino Uno Function Generator, which is capable of producing a square wave with varying duty cycle, sin wave, and sawtooth wave, although it is only a low frequency application (<500Hz). Unfortunately, no sketch or schematic is provided.

### Other examples of Arduinos used in conjunction with a DDS

#### Vintage Signal Generators

The best signal generator or, rather, Function generator, that I have seen was this Function generator, which went for £32. Frequency range 1mHz-5Mhz!