Micro Noise-Pulse Generator

By Murray Greenman ZL1BPU

An audio and LF signal generator with wide range, high accuracy and great versatility.
The generator has sine wave, noise and pulse capability.


INTRODUCTION

This generator is similar to others in the ZL1BPU stable (same hardware, for example), generates the same great high stability sine waves, and has the same useful sweep generation option, but it has three special features - a Noise Generator mode, and two pulse modes - DC pulse (square wave) and RF pulse (ICW), with adjustable on and off times. This unit is small, but has great performance. It is battery operated and has no "front panel" - you control it from a PC or computer terminal.

This is one of a family of three signal generators which use identical hardware:

The generators are quite inexpensive to build - just two or three ICs and a couple of transistors. One of the ICs is an AVR RISC microcontroller - inexpensive, and quite powerful. It operates in an unusual manner, using a Direct Digital Synthesis (DDS) technique developed by Jesper Hansen to create very accurate signals. Some of the features of the Noise - Pulse Generator are:

A commercial version of the Noise-Pulse Generator
(Please note - unit and boards not available)
Click on image for larger view

DESCRIPTION

Power for the unit comes from a small 5V regulator, which runs from a DC supply (battery or AC adaptor) with an output of between 6V and 15V. The unit is reverse voltage protected. The RS232 communications with the PC uses simple transistor level shifters. The transmit signal from the microcontroller requires a negative voltage supply, and for simplicity, this voltage is derived from the mostly idle PC transmit data line, which is normally negative. Communications is half - duplex, using a 9600 bps data rate (9600-N-8-1). Except at start-up, the generator only replies when spoken to.

The microcontroller, an Atmel AT90S2313-10PC, has two very simple main programs consisting of very tight and very fast loops, taking data from one of two tables at a fixed rate, to place the data on an output port (or for noise generator, to a shift register). The Direct Digital Synthesis technique uses a fixed very high frequency (1.2 MHz) sampling rate, and a user controlled step size to address the table. The main loop is changed by storing parameters, then resetting the micro.

Eight bit digital values from the DDS or pseudo-random algorithms are sent to an output port where the required analog waveform is constructed by a simple R-2R resistive ladder and a low pass filter. With precision resistors the reconstructed waveform and bandwidth are very good.

While the synthesizer is running, nothing is allowed to interrupt the process, as interruptions would slow down or distort the waveform. Commands to change the operating parameters are received from the serial communications link, which operates via an interrupt and stops the generator while the command is processed. The interruption can be as short as 2 µs (in sweep mode), or as long as several milliseconds, depending on the command sent. At audio frequencies the glitch in the generated waveform caused by the shorter commands is hardly noticeable. In pulse mode the signal is turned on and off by another internal timer interrupt.

The Generator has four modes; Sine Wave (CW), Noise, Pulsed CW mode, and Pulsed DC mode (square wave). In addition, there is a Sweep Generator function, used with the Sine Wave mode. This function is set independently of other modes, and overrides the other modes.

There are three outputs:

The 50 OHM output is the main high powered output. It is transformer coupled from the power amplifier output, and has limited frequency response; about 7 kHz to 250 kHz. It can also be used for audio purposes if a small audio output transformer is used. The amplifier is not damaged by open circuit or short circuit, but MUST NOT be coupled to an antenna while a transmitter is operating in the vicinity (even on another antenna). Be aware also that there is sufficient output from this amplifier to cause significant interference to other services if the output is coupled to an antenna.

The amplifier has DC level control, and the output is adjustable over greater than 60dB range. There is little leakage from the generator, and so the output can indeed be reduced to microwatts.

The FIXED output is direct from the D-A converter, and while it has no output adjustment, it has the merits of being completely flat from DC to in excess of 400 kHz, and generates a 0V to 5V signal. This output will drive about 50mV RMS into 50 Ohm.

The SYNC output is high when the Signal Generator outputs are on, i.e. when carrier or noise is being generated. It is low between pulses in pulse mode, and low when pulsed DC is at 0V. In Sweep Generator mode, this output is high only during the first step, and so provides a useful oscilloscope synchronizing signal.

There are two other connectors, the RS232 serial port for computer control, and the DC power connector. The one control knob adjusts the output level of the high power output, from about 1W down to microwatts.

Sine waves are generated very accurately using a 24 bit DDS technique. The frequency resolution is 0.08 Hz, and the range is 0.08 to 400 kHz. The output is 8 bit, very clean and free of harmonics and spurious responses. The output sample rate is 1.333 MHz.

Noise is generated using a 24 bit maximal length pseudorandom generator algorithm with four feedback terms. A table-lookup technique is used to maximize speed. The output is 8 bit, with a sample rate of 1.200 MHz, so the noise output is Gaussian in response, and useful to at least 400 kHz.

The pulsed CW mode uses the sine wave generator in tandem with a timer, which turns on and off the carrier. The sine wave always starts at zero phase angle, and the off period is at the "zero" point of the waveform (zero sine phase). The on and off time are independently controllable in 21 µs steps from 21 µs to 1.3 seconds.

The pulsed DC mode is similar to the pulsed CW mode, except that the output is +5V when on, and 0V when off. The on and off time are independently controllable in 21 µs steps from 21 µs to 1.3 seconds.

The sweep generator uses the CW set frequency as its starting frequency, and steps in 20 discrete frequencies in an increasing frequency direction. The step size is adjustable over the range 20 Hz to 5 kHz, giving a maximum sweep range of up to 100 kHz, anywhere within the operating range of the generator. Each step has a duration of 2.5 ms, so the total sweep time of 50 ms ideally suits an oscilloscope operating at 5 ms / division. The oscilloscope is triggered from the SYNC output of the generator, which is high only during the first frequency step.

COMMAND SYNTAX

Commands are provided to change the frequency, offset the frequency (by microscopic amounts), change the output level, the pulses, and to control the sweep function. Commands to the microcontroller are given manually in hexadecimal form. However, feel free to write your own control program.

ADD Axx
Add offset of xx resolution steps, where xx is "00" to "FF" in two hexadecimal characters.

FREQUENCY Fhhmmll
Set frequency to this value times the resolution. The value hhmmll is a 24 bit binary number expressed as six hexadecimal characters, "00" to "FF".

HELP H
Simple help message listing these commands.

MODE Mn
Sets the waveform mode, where n is a number 0 to 3.
0 SINE
1 NOISE
2 PULSED CW
3 PULSED DC

NO Nhhll
Sets the pulse off time for CW and DC pulse modes. The value hhll is a 16 bit binary number expressed as four hexadecimal characters, "0" to "F". The resolution is 21 µs and the range 21 µs to 1.3 sec.

PORT Pn
Four general purpose outputs PD2, PD3, PD4 and PD5 are set by this command. The default value of n=0 clears (to zero) all outputs. N can take values from 0 - F (HEX), and the outputs are set bit-wise, with PD2 being LSB and PD5 MSB.

It is possible (although not implemented in the hardware) to use this command to set the carrier output power, with a four-bit R-2R network connected to the PD2 - PD5 outputs and controlling the DC volume control of the amplifier device. In this case consider this to be the POWER command. Otherwise, the pins become simple computer controlled outputs.

REPORT R
Requests a message giving the current settings.

TX ON T
Turns the RF output or signal output on.

WIDTH Wmm
Sets sweep step size, where mm is "00" to "FF" in two hexadecimal characters. Each step is 256 x mm resolution steps in the up-frequency direction. With an 8 MHz crystal, the range is 13.5 Hz/step (W01) to about 3.5 kHz (WFF). The start frequency for the sweep is set by the F command. There are 20 steps at 5ms intervals.

TX OFF X
Turns the RF output or signal output off.

YES Yhhll
Sets the pulse on time for CW and DC pulse modes. The value hhll is a 16 bit binary number expressed as four hexadecimal characters, "0" to "F". The resolution is 21 µs and the range 21 µs to 1.3 sec.

Each command consists of one command letter (upper or lower case) and zero to six following hexadecimal characters. No "Enter" or other control characters follow. The correct number of characters must be used. Unexpected characters, misunderstood commands and some impossible values will result in the micro controller responding "?", and the synthesizer will continue with the current settings. If a command is not completed, the synthesizer will remain stopped. Sending any wrong character (such as <CR>) will restore operation.

Commands which set parameters (all except H, R, T and X) store the new values in EEPROM automatically, and so the generator starts up where it left off when power is interrupted. The MODE command also resets the micro controller. This is because there is no other way to easily leave the DDS main program to enter the pseudorandom noise main program and vice versa.

It is quite possible to send impractical frequencies (even negative frequencies) and impractical sweep step sizes. Negative frequencies (the hexadecimal values are signed, so those from FFFFFF downwards are negative) result in reversed table stepping - no difference will be noted except that the sweep function will sweep down instead of up in frequency, and the ADD step increments (the A command) subtract rather than add. The Nyquist Frequency occurs with a setting of F800000 and would generate meaningless signals if approached. It is best to stay below F400000.

When the device is first powered up, it issues an <OK> message. If using a dumb terminal, start the terminal before the generator.

HARDWARE

The unit can be very small. Even built on "Veroboard", it can be under 100mm square. The prototype was built on a DSE H5608 prototyping board (47 x 72mm), but with a board this small it would be a tight squeeze to fit in the power amplifier. The simplest version of the unit consists of the microcontroller, a 3-terminal regulator, two transistors, a crystal and about 25 resistors and capacitors. Most of this is shown on the SCHEMATIC SHEET 1. You will also need a 10k pot for level adjustment (not shown on the schematic, but it replaces R35 - the wiper goes to the output), a BNC connector for the output, another for the sweep trigger output, and a coaxial DC power connector. These are shown on the right of SCHEMATIC SHEET 2. The panel mount DB9 or DB25 RS232 connector is on the right of Sheet 1.

For the more advanced version with power amplifier and micro controlled output level, you will also need a TDA7052A audio amp, and a few more resistors and capacitors. For both models it is also a good idea to use sockets for the dual-inline ICs. The power amplifier is shown on SCHEMATIC SHEET 2. If the power amplifier is not used, delete all the related components, including the resistors related to the VC output of the microcontroller (left side of Sheet 1).

The unit can be built (with or without power amplifier) on a PCB made to the design offered here. The circuit board suits all three signal generators, and is doubles sided.

Silk Screen Layer    User Manual
Bottom Copper Layer    Schematic Sheet 1
Silk Screen Layer    Schematic Sheet 2

SOFTWARE

Software is offered for 12 MHz and 16MHz versions. Timing and frequency calculations here and in the User Manual relate to the 12 MHz version. The Specifications for the Generator are also listed in the Manual.

It is possible to purchase just the executable code, or both the executables and source code. In both cases the PC software is also supplied. See the Micro Page for details.

The PC controller program has a configuration file which is used to set the PC serial comms port, the baud rate, and the Signal Generator clock frequency. This value can be altered to precisely match the crystal frequency, errors and all, and precise output frequencies will result.


Copyright � Murray Greenman 1997-2005. All rights reserved. Contact the author before using any of this material.