home - Lighting
Generator circuits on an LCD microcontroller. Digital Function Generator DDS

Recently, digital frequency synthesis (DDS) methods have become widespread, and the implementation methods are very diverse. The method and method of implementation depends on the requirements for the generator.

    I had basic requirements for the generator:
  • 1. Frequency in the range from 0.01Hz – 50000Hz in steps of 0.01Hz
  • 2. Maximum possible linearity throughout the entire range.
  • 3. Work on a low-impedance load (for testing speakers and ultrasonic magnetostrictive emitters)
  • 4. Convenience and speed of “hot” adjustment.
  • 5. Scanning a given range with a given step (convenient for determining the resonance frequency of anything)
  • 6. Large number of waveforms, and constant voltage for calibration.
  • 7. Information content of the display.
Since I often came across writing programs for AVR and Microchip controllers, I chose between them... But AVR turned out to be cheaper and more functional. In terms of speed and the required number of pins, ATMega16 was suitable. Now about the calculations...
F max = 16000000Hz(atmega frequency)
We take 15 cycles to change the phase accumulator, sample from the LUT and output.
Total Fclk=16000000Hz/15=1066666.6667Hz
For the required accuracy, I chose a 32-bit phase accumulator.
Now let's calculate the minimum step:
Step(Hz)= 1066666.6667Hz/(2^32)= 0.0002483526865641276041667(Hz)
The generator code itself:
while (1)( #asm ADD R1,R6 ADC R2,R7 ADC R3,R8 ADC R4,R9 #endasm PORTC=LUT_of_Signal;
At 50000Hz, the signal per period will be formed by ~21 voltage changes at the DAC output.
As a DAC, I chose a regular R-2R matrix - it does not require strobes and 8 bits completely satisfy the conditions. Those. (|12|+|-12|) / 2^8 = 0.09375~ 0.1V

For convenience and speed of frequency adjustment, I used a valcoder, according to the scheme proposed by the radio amateur VK6BRO, from a stepper motor.

To prevent false positives from the valcoder, the controller checks the directions several times during steps and only then records the changes.
The remaining parameters are set using 4 buttons.

    The generator has the ability to reproduce the following signal forms:
  • 1. Sine wave
  • 2. Meander
  • 3. H-wave
  • 4. Symmetrical staircase
  • 5. Trapezoid
  • 6. Saw
  • 7. Symmetrical rectangle
  • 8. Asymmetrical staircase
  • 9. Asymmetrical rectangle
  • 10. Constant "+"
  • 11. Constant "-"
Video of work
I also added the function of scanning a given frequency range with an adjustable step.
The step is set to 0.01Hz-0.1Hz-1Hz-10Hz-100Hz and vice versa. For ease of display and ease of writing the program, I used an LCD from Nokia 3310 (84x48). As the encoder itself I used a bipolar stepper motor from an old hard drive. I simulated the entire device and program in Proteus.
Analogue part of the generator


Since the DAC produces a unipolar signal and the idea was to create a bipolar generator, it is necessary to use a bias on the amplifier. I chose TL431 as the voltage reference source. I implemented the amplifier itself on 2 stages. To enhance the load capacity, I used a voltage follower on the TDA2030A chip.

The signal at the output of device U3 repeats the input signal in shape and amplitude, but has greater power, i.e. the circuit can operate on a low-impedance load. The repeater is used to increase the output power of the low-frequency generator (so that loudspeaker heads or acoustic systems can be directly tested). The repeater operating frequency band is linear from DC to 0.5...1 MHz, which is more than enough for a low-frequency generator.

Power source - any (pulse or linear), preferably stabilized with +5, +12/-12V supplies.

About the assembly
There were no particular problems during assembly; the setup involved adjusting the analogue part of the symmetry and amplitude of the output signal. The bias is adjusted by resistors R1 and R6. The amplitude of the first stage is R5, the second is R8.

This DDS function generator (version 2.0) of signals is assembled on an AVR microcontroller, has good functionality, has amplitude control, and is also assembled on a single-sided printed circuit board.

This generator is based on the Jesper DDS generator algorithm, the program has been modernized for AVR-GCC C with assembly code inserts. The generator has two output signals: the first is DDS signals, the second is a high-speed (1..8 MHz) “rectangular” output, which can be used to revive the MK with incorrect fuzzes and for other purposes.
The high-speed HS (High Speed) signal is taken directly from the Atmega16 OC1A (PD5) microcontroller.
DDS signals are generated from other MC outputs through a resistive R2R matrix and through the LM358N chip, which allows adjustment of the signal amplitude and offset. Offset and amplitude are adjusted using two potentiometers. The offset can be adjusted in the range of +5V..-5V, and the amplitude is 0...10V. The frequency of DDS signals can be adjusted within the range of 0... 65534 Hz, this is more than enough for testing audio circuits and other amateur radio tasks.

Main characteristics of DDS generator V2.0:
- a simple circuit with common and inexpensive radioelements;
- single-sided printed circuit board;
- built-in power supply;
- separate high-speed output (HS) up to 8 MHz;
- DDS signals with variable amplitude and offset;
- DDS signals: sine, rectangle, saw and reverse saw, triangle, ECG signal and noise signal;
- 2×16 LCD screen;
- intuitive 5-button keyboard;
- steps for frequency adjustment: 1, 10, 100, 1000, 10000 Hz;
- remembering the last state after turning on the power.

The block diagram below shows the logical structure of a function generator:

As you can see, the device requires several supply voltages: +5V, -12V, +12V. Voltages +12V and -12V are used to regulate signal amplitude and offset. The power supply is designed using a transformer and several voltage stabilizer chips:

The power supply is assembled on a separate board:

If you don’t want to assemble the power supply yourself, you can use a regular ATX power supply from a computer, where all the necessary voltages are already present. .

LCD screen

All actions are displayed via an LCD screen. The generator is controlled by five keys

The up/down keys are used to move through the menu, the left/right keys are used to change the frequency value. When the center key is pressed, the selected signal begins to be generated. Pressing the key again stops the generator.

A separate value is provided to set the frequency change step. This is convenient if you need to change the frequency over a wide range.

The noise generator does not have any settings. It uses the usual rand() function, which is continuously fed to the output of the DDS generator.

The HS high speed output has 4 frequency modes: 1, 2, 4 and 8 MHz.

Schematic diagram

The function generator circuit is simple and contains easily accessible elements:
- AVR Atmega16 microcontroller, with external quartz at 16 MHz;
- standard HD44780-type LCD screen 2×16;
- R2R DAC matrix made of ordinary resistors;
- operational amplifier LM358N (domestic analogue of KR1040UD1);
- two potentiometers;
- five keys;
- several connectors.

Pay:

The functional generator is assembled in a plastic box:


Software

As I said above, I based my program on the Jesper DDS generator algorithm. I added a few lines of assembly code to implement the generation stop. Now the algorithm contains 10 CPU cycles, instead of 9.

void static inline Signal_OUT(const uint8_t *signal, uint8_t ad2, uint8_t ad1, uint8_t ad0)(
asm volatile("eor r18, r18 ;r18<-0″ "\n\t"
"eor r19, r19 ;r19<-0″ "\n\t"
"1:" "\n\t"
"add r18, %0 ;1 cycle" "\n\t"
"adc r19, %1 ;1 cycle" "\n\t"
"adc %A3, %2 ;1 cycle" "\n\t"
"lpm ;3 cycles" "\n\t"
"out %4, __tmp_reg__ ;1 cycle" "\n\t"
"sbis %5, 2 ;1 cycle if no skip" "\n\t"
"rjmp 1b ;2 cycles. Total 10 cycles" "\n\t"
:
:"r" (ad0),,"r" (ad1),,"r" (ad2),,"e" (signal),,"I" (_SFR_IO_ADDR(PORTA)), "I" (_SFR_IO_ADDR(SPCR))
:"r18″, "r19″
);}

The table of DDS signal forms is located in the flash memory of the MK, the address of which starts at 0xXX00. These sections are defined in the makefile, in the appropriate memory locations:
#Define sections where to store signal tables
LDFLAGS += -Wl,-section-start=.MySection1=0x3A00
LDFLAGS += -Wl,-section-start=.MySection2=0x3B00
LDFLAGS += -Wl,-section-start=.MySection3=0x3C00
LDFLAGS += -Wl,-section-start=.MySection4=0x3D00
LDFLAGS += -Wl,-section-start=.MySection5=0x3E00
LDFLAGS += -Wl,-section-start=.MySection6=0x3F00

You can take the library for working with LCD.

I don't want to go into a detailed description of the program code. The source code is well commented (though in English) and if you have any questions about it, you can always use ours or in the comments to the article.

Testing

I tested the generator with an oscilloscope and a frequency counter. All signals are well generated over the entire frequency range (1...65535 Hz). Amplitude and offset adjustments work fine.

In the next version of the generator I am thinking of implementing a rising sine wave signal.

The latest version of the software (), source, files can be downloaded below.

List of radioelements

Designation Type Denomination Quantity NoteShopMy notepad
Linear regulator

LM7805

1 To notepad
Linear regulator

LM7812

1 To notepad
Linear regulator

LM7912

1 To notepad
B1 Diode bridge 1 To notepad
C1, C7 2000 µF2 To notepad
C3, C5, C9 Electrolytic capacitor100 µF3 To notepad
C4, C6, C10 Capacitor0.1 µF3 To notepad
TR1 Transformer220V - 2x15V1 To notepad
F1 Fuse 1 To notepad
S1 Switch220V1 To notepad
X1 ConnectorNetwork 220V1 To notepad
JP1 Connector4 contacts1 PSU output To notepad
Main board
IC1 MK AVR 8-bit

ATmega16

1 To notepad
IC2 Operational amplifier

LM358N

1 KR1040UD1 To notepad
C2, C3 Capacitor0.1 µF2 To notepad
C6, C7 Capacitor18 pF2 To notepad
R1 Resistor

500 Ohm

1 To notepad
R2, R6, R8, R10, R12, R14, R16, R18 Resistor

10 kOhm

8 To notepad
R3, R21 Resistor

100 kOhm

2 To notepad
R20 Resistor

100 Ohm

1 To notepad
R22 Resistor

12 kOhm

1 To notepad
POT Trimmer resistor10 kOhm1

I've been using the signal generator for a long time now. UDB1005S, built according to DDS technology, it was bought on Ali for $30.

In short, the series UDB100 x includes 3 models UDB1002, UDB1005, UDB1008, the last digit determines the maximum operating frequency, and the letter S at the end, if present, indicates that the generator supports sweep_mode. The generator is based on a combination of plis + micron, micron serves the periphery (buttons, encoder, display), and the plis generates the signal.

The generator has one analog output with the ability to adjust the amplitude and DC voltage offset, one digital output with TTL levels, and can operate in pulse counter mode and frequency counter mode.

Now let's look at the main features.

Analogue output:

  • Output waveform: sine, square, sawtooth
  • Output amplitude ≤9Vp-p(no load)
  • Output impedance 50Ω±10%
  • DC offset ±2.5V(no load)
  • frequency range

    0.01Hz~2MHz(UDB1002S)
    0.01Hz~5MHz(UDB1005S)
    0.01Hz~8MHz(UDB1008S)

  • Frequency accuracy ±5×10-6
  • Frequency stability ±1×10-6
  • Square wave rise and fall time ≤100ns
  • Square wave duty cycle 1%-99%
TTL output:
  • frequency range

    0.01Hz~2MHz(UDB1002S)
    0.01Hz ~5MHz(UDB1005S)
    0.01Hz ~8MHz(UDB1008S)

  • Amplitude >3Vp-p
  • Load capacity >20TTL
Counter function:
  • Pulse counter range 0~4294967295
  • Frequency meter range 1Hz~60MHz
  • Input voltage range 0.5Vp-p~20Vp-p
Oscillating Frequency Generator(sweep_mode):
  • Frequency range fM1~fM2 (frequencies are preset)
  • Time range 1s~99s
Additional feature: save and load configurations M0~M9(default M0)

Concerning sweep frequency generator, to configure it you need to set two frequency values ​​and the time during which the generator frequency will change from fM1 to fM2. This is very convenient if you need to find out how a circuit reacts to different frequencies, for example, using a sweep frequency generator you can easily find the resonant frequency of a circuit with unknown elements. To do this, we connect the generator to the circuit through a series-connected resistor with a nominal value of several hundred Ohms, and connect the oscilloscope probe to the terminals of the circuit. If the circuit is serial, then at the resonant frequency the oscillation amplitude will be maximum, and if it is parallel, it will be minimum. By recording the amplitude on the oscilloscope screen, you can find out the resonant frequency of the circuit.

But I will not deviate from the topic; below I will give several oscillograms for different types of oscillations and different frequencies.
Sine 1KHz


Sine 10KHz


Sine 100KHz


Sine 1MHz


Sine 5MHz

Saw 1KHz


Saw 10KHz


Saw 100KHz


Saw 1MHz


Saw 5MHz


You can also change the inclination of the saw


Square wave 1KHz


Square wave 10KHz


Square wave 100KHz


Square wave 1MHz


Square wave 5MHz

Square wave 100KHz with TTL output


Square wave 1MHz with TTL output


Square wave 5MHz with TTL output

The oscillograms show that the frequency stability is very different from the declared one; I would also like to note that if the frequency of the rectangular signal exceeds 1MHz, the signal begins to tremble strongly.
The signal for checking the frequency meter was taken from the oscilloscope calibrator; according to the passport data, its output should have a square wave with a frequency of 1KHz, the frequency meter showed exactly 1KHz. I have not tested the pulse counter mode.

All of the above can be attributed to advantages, but what can you want from a signal generator for $30? And now the downsides, there are only two of them for what.....
In general, this generator has a switching power supply system, which is very noisy. The oscillogram below shows what happens at the output of the generator in the absence of a signal.


but this is a small thing compared to adjusting the amplitude; when you rotate the amplitude adjustment knob, the latter changes abruptly, therefore it is very difficult to set the desired amplitude with an error of 100mV.

A quick search on YouTube for “signal generator from Ali” showed that a signal generator whose amplitude can be precisely set is much more expensive, so in terms of price-capability ratio this generator is unrivaled.
I bought a generator.

Continuing the topic of electronic constructors, this time I want to talk about one of the devices for replenishing the arsenal of measuring instruments for a novice radio amateur.
True, this device cannot be called a measuring device, but the fact that it helps in measurements is unambiguous.

Quite often, radio amateurs, and not only others, have to face the need to check various electronic devices. This happens both at the debugging stage and at the repair stage.
To check, it may be necessary to trace the passage of a signal through different circuits of the device, but the device itself does not always allow this to be done without external signal sources.
For example, when setting up/checking a multi-stage low-frequency power amplifier.

To begin with, it’s worth explaining a little about what will be discussed in this review.
I want to tell you about a constructor that allows you to assemble a signal generator.

There are different generators, for example below are also generators :)

But we will assemble a signal generator. I've been using an old analog generator for many years. In terms of generating sinusoidal signals, it is very good, the frequency range is 10-100000 Hz, but it is large in size and cannot generate signals of other forms.
In this case, we will assemble a DDS signal generator.
This is DDS or in Russian - a direct digital synthesis circuit.
This device can generate signals of arbitrary shape and frequency using an internal oscillator with one frequency as a master.
The advantages of this type of generator are that it is possible to have a large tuning range with very fine steps and, if necessary, be able to generate signals of complex shapes.

As always, first, a little about packaging.
In addition to the standard packaging, the designer was packed in a white thick envelope.
All the components themselves were in an antistatic bag with a latch (quite a useful thing for a radio amateur :))

Inside the package, the components were just loose, and when unpacked they looked something like this.

The display was wrapped in bubble polyethylene. About a year ago I already made such a display using it, so I won’t dwell on it, I’ll just say that it arrived without incident.
The kit also included two BNC connectors, but of a simpler design than in the oscilloscope review.

Separately, on a small piece of polyethylene foam there were microcircuits and sockets for them.
The device uses an ATmega16 microcontroller from Atmel.
Sometimes people confuse the names by calling a microcontroller a processor. In fact, these are different things.
A processor is essentially just a computer, while a microcontroller contains, in addition to the processor, RAM and ROM, and may also contain various peripheral devices, DAC, ADC, PWM controller, comparators, etc.

The second chip is a dual operational amplifier LM358. The most common, widespread, operational amplifier.

First, let's lay out the entire set and see what they gave us.
Printed circuit board
Display 1602
Two BNC connectors
Two variable resistors and one trimmer
Quartz resonator
Resistors and capacitors
Microcircuits
Six buttons
Various connectors and fasteners

Printed circuit board with double-sided printing, on the top side there are markings of elements.
Since the circuit diagram is not included in the kit, the board contains not the positional designations of the elements, but their values. Those. Everything can be assembled without a diagram.

The metallization was done with high quality, I had no comments, the coating of the contact pads was excellent, and soldering was easy.

The transitions between the sides of the print are made double.
I don’t know why it was done this way and not as usual, but it only adds reliability.

First, I started drawing a circuit diagram using the printed circuit board. But already in the process of work, I thought that some already known scheme was probably used when creating this constructor.
And so it turned out, a search on the Internet brought me to this device.
At the link you can find a diagram, a printed circuit board and sources with firmware.
But I still decided to complete the diagram exactly as it is and I can say that it is 100% consistent with the original version. The designers of the designer simply developed their own version of the printed circuit board. This means that if there are alternative firmware for this device, they will work here too.
There is a note about the circuit design, the HS output is taken directly from the processor output, there are no protections, so there is a chance of accidentally burning this output :(

Since we’re talking about it, it’s worth describing the functional units of this circuit and describing some of them in more detail.
I made a color version of the circuit diagram, on which I highlighted the main components in color.
It’s hard for me to come up with names for the colors, but then I’ll describe them as best I can :)
The purple one on the left is the initial reset and forced reset node using a button.
When power is applied, capacitor C1 is discharged, due to which the Reset pin of the processor will be low; as the capacitor is charged through resistor R14, the voltage at the Reset input will rise and the processor will start working.
Green - Buttons for switching operating modes
Light purple? - Display 1602, backlight current limiting resistor and contrast trimming resistor.
Red - signal amplifier and offset adjustment unit relative to zero (closer to the end of the review it is shown what it does)
Blue - DAC. Digital to Analog Converter. The DAC is assembled according to the circuit, this is one of the simplest DAC options. In this case, an 8-bit DAC is used, since all pins of one microcontroller port are used. By changing the code on the processor pins, you can get 256 voltage levels (8 bits). This DAC consists of a set of resistors of two values, differing from each other by a factor of 2, which is where the name comes from, consisting of two parts R and 2R.
The advantages of this solution are high speed at a cheap cost; it is better to use precise resistors. My friend and I used this principle, but for the ADC, the choice of exact resistors was small, so we used a slightly different principle, we installed all the resistors of the same value, but where 2R was needed, we used 2 resistors connected in series.
This principle of digital-to-analog conversion was in one of the first “sound cards” - . There was also an R2R matrix connected to the LPT port.
As I wrote above, in this designer the DAC has a resolution of 8 bits, or 256 signal levels, which is more than enough for a simple device.

On the author's page, in addition to the diagram, firmware, etc. A block diagram of this device was discovered.
It makes the connection of nodes more clear.

We are done with the main part of the description, the expanded part will be further in the text, and we will move directly to the assembly.
As in previous examples, I decided to start with resistors.
There are a lot of resistors in this designer, but only a few values.
The majority of resistors have only two values, 20k and 10k, and almost all of them are used in the R2R matrix.
To make the assembly a little easier, I’ll say that you don’t even have to determine their resistance, just 20k resistors are 9 pieces, and 10k resistors are 8, respectively :)

This time I used a slightly different installation technology. I like it less than the previous ones, but it also has the right to life. In some cases, this technology speeds up installation, especially on a large number of identical elements.
In this case, the resistor terminals are formed in the same way as before, after which all resistors of one value are installed on the board first, then the second, so two such lines of components are obtained.

On the reverse side, the leads are bent a little, but not much, the main thing is that the elements do not fall out, and the board is placed on the table with the leads facing up.

Next, take the solder in one hand, the soldering iron in the other, and solder all the filled contact pads.
You shouldn’t be too zealous with the number of components, because if you fill the entire board at once, then you can get lost in this “forest” :)

At the end, we bite off the protruding leads of the components close to the solder. Side cutters can grab several leads at once (4-5-6 pieces at a time).
Personally, I don’t really welcome this method of installation and showed it simply for the sake of demonstrating various assembly options.
The disadvantages of this method:
Trimming results in sharp, protruding ends.
If the components are not in a row, then it’s easy to get a mess of conclusions, where everything starts to get confused and this only slows down the work.

Among the advantages:
High speed of installation of similar components installed in one or two rows
Since the leads are not bent too much, dismantling the component is easier.

This installation method can often be found in cheap computer power supplies, although the leads are not bitten off, but cut off with something like a cutting disk.

After installing the main number of resistors, we will have several pieces of different values ​​left.
The pair is clear, these are two 100k resistors.
The last three resistors are -
brown - red - black - red - brown - 12k
red - red - black - black - brown - 220 Ohm.
brown - black - black - black - brown - 100 Ohm.

We solder the last resistors, the board should look something like this after that.

Color-coded resistors are a good thing, but sometimes there is confusion about where to count the beginning of the marking.
And if with resistors where the marking consists of four stripes, problems usually do not arise, since the last strip is often either silver or gold, then with resistors where the marking consists of five stripes, problems may arise.
The fact is that the last stripe may have the same color as the denomination stripes.

To make the marking easier to recognize, the last stripe should be spaced apart from the rest, but this is ideal. In real life, everything happens completely differently from what was intended and the stripes are in a row at the same distance from each other.
Unfortunately, in this case, either a multimeter or simply logic (in the case of assembling a device from a kit) can help, when all known denominations are simply removed, and from the remaining ones you can understand what kind of denomination is in front of us.
For example, a couple of photos of resistor marking options in this set.
1. There were “mirror” markings on two adjacent resistors, where it doesn’t matter where you read the value from :)
2. Resistors are 100k, you can see that the last strip is a little further from the main ones (in both photos the value is read from left to right).

Okay, we’re done with resistors and their marking difficulties, let’s move on to simpler things.
There are only four capacitors in this set, and they are paired, i.e. There are only two denominations, two of each.
Also included in the kit was a 16 MHz quartz resonator.

I talked about capacitors and a quartz resonator in the previous review, so I’ll just show you where they should be installed.
Apparently, initially all the capacitors were conceived of the same type, but the 22 pF capacitors were replaced with small disk capacitors. The fact is that the space on the board is designed for a distance between the pins of 5mm, and small disk ones have only 2.5mm, so they will have to bend the pins a little. You will have to bend it near the case (fortunately the pins are soft), since due to the fact that there is a processor above them, it is necessary to obtain a minimum height above the board.

Included with the microcircuits were a couple of sockets and several connectors.
At the next stage we will need them, and in addition to them we will take a long connector (female) and a four-pin male connector (not included in the photo).

The sockets for installing microcircuits were the most ordinary, although when compared with the sockets from the times of the USSR, they were chic.
In fact, as practice shows, such panels in real life last longer than the device itself.
There is a key on the panels, a small cutout on one of the short sides. Actually, the socket itself doesn’t care how you install it, it’s just that it’s easier to navigate using the cutout when installing microcircuits.

When installing the sockets, we install them in the same way as the designation on the printed circuit board.

After installing the panels, the board begins to take on some form.

The device is controlled using six buttons and two variable resistors.
The original device used five buttons, the designer added a sixth one; it performs the reset function. To be honest, I don’t quite understand its meaning in real use yet, since during all the tests I never needed it.

I wrote above that the kit included two variable resistors, and the kit also included a trimming resistor. I'll tell you a little about these components.
Variable resistors are designed to quickly change the resistance; in addition to the nominal value, they are also marked with a functional characteristic.
The functional characteristic is how the resistance of the resistor will change when you turn the knob.
There are three main characteristics:
A (in the imported version B) - linear, the change in resistance linearly depends on the angle of rotation. Such resistors, for example, are convenient to use in power supply voltage regulation units.
B (in the imported version C) - logarithmic, the resistance changes sharply at first, and more smoothly closer to the middle.
B (in the imported version A) - inverse logarithmic, the resistance changes smoothly at first, more sharply closer to the middle. Such resistors are usually used in volume controls.
Additional type - W, produced only in imported version. S-shaped adjustment characteristic, a hybrid of logarithmic and inverse logarithmic. To be honest, I don’t know where these are used.
Those interested can read more.
By the way, I came across imported variable resistors in which the letter of the adjustment characteristic coincided with ours. For example, a modern imported variable resistor with a linear characteristic and the letter A in the designation. If in doubt, it is better to look for additional information on the website.
The kit included two variable resistors, and only one was marked :(

Also included was one trim resistor. in essence, it is the same as a variable, only it is not designed for operational adjustment, but rather, set it and forget it.
Such resistors usually have a slot for a screwdriver, not a handle, and only a linear characteristic of resistance change (at least I haven’t come across others).

We solder the resistors and buttons and move on to the BNC connectors.
If you plan to use the device in a case, then it may be worth buying buttons with a longer stem, so as not to increase the ones provided in the kit, it will be more convenient.
But I would put the variable resistors on wires, since the distance between them is very small and it would be inconvenient to use in this form.

Although the BNC connectors are simpler than those in the oscilloscope review, I liked them better.
The key thing is that they are easier to solder, which is important for a beginner.
But there was also a remark: the designers placed the connectors on the board so close that it is basically impossible to tighten two nuts; one will always be on top of the other.
In general, in real life it is rare that both connectors are needed at once, but if the designers had moved them apart by at least a couple of millimeters, it would have been much better.

The actual soldering of the main board is complete, now you can install the operational amplifier and microcontroller in place.

Before installation, I usually bend the pins a little so that they are closer to the center of the chip. This is done very simply: take the microcircuit with both hands by the short sides and press it vertically with the side with the leads against a flat base, for example, against a table. You don’t need to bend the leads very much, it’s more a matter of habit, but then installing the microcircuit into the socket is much more convenient.
When installing, make sure that the leads do not accidentally bend inward, under the microcircuit, since they can break off when bent back.

We install the microcircuits in accordance with the key on the socket, which in turn is installed in accordance with the markings on the board.

Having finished with the board, we move on to the display.
The kit included a pin part of the connector that needs to be soldered.
After installing the connector, I first solder one outer pin, it doesn’t matter whether it is nicely soldered or not, the main thing is to ensure that the connector stands tightly and perpendicular to the plane of the board. If necessary, we warm up the soldering area and trim the connector.
After aligning the connector, solder the remaining contacts.

That's it, you can wash the board. This time I decided to do it before testing, although I usually advise doing the flushing after the first turn on, since sometimes you have to solder something else.
But as practice has shown, with constructors everything is much simpler and you rarely have to solder after assembly.

You can wash it in different ways and means, some use alcohol, some use an alcohol-gasoline mixture, I wash the boards with acetone, at least for now I can buy it.
When I washed it, I remembered the advice from the previous review about the brush, since I use cotton wool. No problem, we'll have to reschedule the experiment next time.

In my work, I have developed the habit, after washing the board, of covering it with protective varnish, usually from the bottom, since getting varnish on the connectors is unacceptable.
In my work I use Plastic 70 varnish.
This varnish is very “light”, i.e. If necessary, it is washed off with acetone and soldered with a soldering iron. There is also a good Urethane varnish, but with it everything is noticeably more complicated, it is stronger and it is much more difficult to solder it with a soldering iron. THIS varnish is used for severe operating conditions and when there is confidence that we will no longer solder the board, at least for some long time.

After varnishing, the board becomes more glossy and pleasant to the touch, and there is a certain feeling of completion of the process :)
It's a shame the photo doesn't convey the overall picture.
I was sometimes amused by people's words like - this tape recorder/TV/receiver was repaired, you can see traces of soldering :)
With good and correct soldering there are no signs of repair. Only a specialist will be able to understand whether the device has been repaired or not.

Now it's time to install the display. To do this, the kit included four M3 screws and two mounting posts.
The display is attached only on the side opposite the connector, since on the connector side it is held by the connector itself.

We install the racks on the main board, then install the display, and at the end we fix this entire structure using the two remaining screws.
I liked the fact that even the holes coincided with enviable accuracy, and without adjustment, I just inserted and screwed in the screws :).

Well, that's it, you can try.
I apply 5 Volts to the corresponding connector contacts and...
And nothing happens, just the backlight turns on.
Don’t be scared and immediately look for a solution on the forums, everything is fine, that’s how it should be.
We remember that there is a tuning resistor on the board and it’s there for good reason :)
This trimming resistor needs to be used to adjust the contrast of the display, and since it was initially in the middle position, it is quite natural that we did not see anything.
We take a screwdriver and rotate this resistor to achieve a normal image on the screen.
If you twist it too much, there will be overcontrast, we will see all the familiar places at once, and the active segments will be barely visible, in this case we simply twist the resistor in the opposite direction until the inactive elements disappear almost to nothing.
You can adjust it so that the inactive elements are not visible at all, but I usually leave them barely noticeable.

Then I would have moved on to testing, but that was not the case.
When I received the board, the first thing I noticed was that in addition to 5 Volts, it needed +12 and -12, i.e. only three voltages. I just remembered RK86, where it was necessary to have +5, +12 and -5 Volts, and they had to be supplied in a certain sequence.

If there were no problems with 5 Volts, and with +12 Volts as well, then -12 Volts became a small problem. I had to make a small temporary power supply.
Well, the process was classic, searching through the bottom of the barrel for what it could be assembled from, routing and making a board.

Since I had a transformer with only one winding, and I didn’t want to fence the impulse generator, I decided to assemble the power supply according to a circuit with doubling the voltage.
To be honest, this is far from the best option, since such a circuit has a fairly high level of ripple, and I had very little voltage reserve so that the stabilizers could fully filter it.
Above is the diagram according to which it is more correct to do it, below is the one according to which I did it.
The difference between them is the additional transformer winding and two diodes.

I also supplied almost no reserve. But at the same time it is sufficient at normal mains voltage.
I would recommend using a transformer of at least 2 VA, and preferably 3-4 VA and having two windings of 15 Volts each.
By the way, the consumption of the board is small, at 5 Volts together with the backlight the current is only 35-38 mA, at 12 Volts the current consumption is even less, but it depends on the load.

As a result, I came up with a small scarf, slightly larger in size than a matchbox, mostly in height.

The layout of the board at first glance may seem somewhat strange, since it was possible to rotate the transformer 180 degrees and get a more accurate layout, which is what I did at first.
But in this version, it turned out that the tracks with mains voltage were dangerously close to the main board of the device, and I decided to slightly change the wiring. I won’t say that it’s great, but at least it’s at least a little safer.
You can remove the space for the fuse, since with the transformer used there is no special need for it, then it will be even better.

This is what the complete set of the device looks like. To connect the power supply to the device board, I soldered a small 4x4 pin hard connector.

The power supply board is connected using a connector to the main board and now you can proceed to a description of the operation of the device and testing. The assembly is complete at this stage.
It was possible, of course, to put all this in the case, but for me such a device is more of an auxiliary one, since I am already looking towards more complex DDS generators, but their cost is not always suitable for a beginner, so I decided to leave it as is.

Before testing begins, I will describe the controls and capabilities of the device.
The board has 5 control buttons and a reset button.
But regarding the reset button, I think everything is clear, and I will describe the rest in more detail.
It is worth noting a slight “bounce” when switching the right/left button, perhaps the software “anti-bounce” has too short a time, it manifests itself mainly only in the mode of selecting the output frequency in the HS mode and the frequency tuning step, in other modes no problems were noticed.
The up and down buttons switch operating modes of the device.
1. Sinusoidal
2. Rectangular
3. Sawtooth
4. Reverse sawtooth

1. Triangular
2. High frequency output (separate HS connector, other forms are given for DDS output)
3. Noise-like (generated by random selection of combinations at the DAC output)
4. Emulation of a cardiogram signal (as an example of the fact that any form of signal can be generated)

1-2. You can change the frequency at the DDS output in the range 1-65535Hz in 1Hz steps
3-4. Separately, there is an item that allows you to select the tuning step; by default, the step is 100Hz.
You can change the operating frequency and modes only in the mode when generation is turned off. The change occurs using the left/right buttons.
Generation is turned on with the START button.

There are also two variable resistors on the board.
One of them regulates the signal amplitude, the second - the offset.
I tried to show on oscillograms what it looks like.
The top two are for changing the output signal level, the bottom two are for adjusting the offset.

Test results will follow.
All signals (except noise-like and HF) were tested at four frequencies:
1. 1000Hz
2. 5000Hz
3. 10000Hz
4. 20000Hz.
At higher frequencies there was a big drop, so it doesn’t make much sense to show these oscillograms.
To begin with, a sinusoidal signal.

Sawtooth

Reverse sawtooth

Triangular

Rectangular with DDS output

Cardiogram

Rectangular with RF output
There is a choice of only four frequencies here, I checked them
1. 1MHz
2. 2MHz
3.4MHz
4.8MHz

Noise-like in two scanning modes of the oscilloscope, so that it is more clear what it is.

Testing has shown that the signals have a rather distorted shape starting from about 10 kHz. At first I was guilty of the simplified DAC, and the very simplicity of the synthesis implementation, but I wanted to check it more carefully.
To check, I connected an oscilloscope directly to the output of the DAC and set the maximum possible frequency of the synthesizer, 65535 Hz.
Here the picture is better, especially considering that the generator was operating at maximum frequency. I suspect that the simple amplification circuit is to blame, since the signal before the op-amp is noticeably more “beautiful”.

Well, a group photo of a small “stand” of a novice radio amateur :)

Summary.
pros
High-quality board manufacturing.
All components were in stock
There were no difficulties during assembly.
Great functionality

Minuses
BNC connectors are too close to each other
No protection for HS output.

My opinion. One can, of course, say that the characteristics of the device are very poor, but it is worth considering that this is a very entry-level DDS generator and it would not be entirely correct to expect anything more from it. I was pleased with the quality of the board, it was a pleasure to assemble, there was not a single place that had to be “finished.” In view of the fact that the device is assembled according to a fairly well-known scheme, there is hope for alternative firmware that can increase functionality. Taking into account all the pros and cons, I can fully recommend this set as a starter kit for beginner radio amateurs.

Phew, that seems to be it, if I messed up somewhere, write, I’ll correct/add it :)

The product was provided for writing a review by the store. The review was published in accordance with clause 18 of the Site Rules.

I'm planning to buy +47 Add to favorites I liked the review +60 +126

Maximum frequency - 65534 Hz ​​(and up to 8 MHz HS output with square wave). And then I thought that a generator is an excellent task where the FPGA can show itself at its best. As a matter of sport, I decided to repeat the project on FPGA, while meeting the deadlines within two weekends, and getting the parameters not strictly defined, but the maximum possible. You can find out what came out of this under the cut.

Day zero

Before the weekend arrived, I had some time to think about the implementation. To simplify my task, I decided to make the generator not as a separate device with buttons and an LCD screen, but as a device that connects to a PC via USB. For this I have a USB2RS232 board. The board does not require drivers (CDC), therefore, I think it will work under Linux (for some this is important). Also, I will not hide that I have already worked with receiving messages via RS232. I will take ready-made modules for working with RS232 from opencores.com.

To generate a sine wave signal you will need a DAC. I chose the DAC type, as in the original project - R2R 8-bit. It will allow you to operate at high frequencies, on the order of megahertz. I am convinced that the FPGA should cope with this

I was thinking about how to write a program for transmitting data via a COM port. On the one hand, you can write in Delphi7; you already have experience writing such a program, and besides, the size of the executable file will not be large. I also tried to sketch out something to work with Serial in the form of a java script in an html page, but it more or less worked only through the Chrome serial API, but for this you need to install a plugin... in general, it’s also out of the question. I tried PyQt5 as an innovation for myself, but when distributing such a project, you need to drag a bunch of libraries. Having tried to compile a PyQt project into an exe file, it turned out to be more than 10 MB. That is, it will be no better than an application written in C++\Qt5. It’s also worth considering that I don’t have experience developing in python, but I do have experience in Qt5. Therefore, the choice fell on Qt5. Since the fifth version, a module for working with serial appeared and I have already worked with it. And an application based on Qt5 can be transferred to Linux and Mac (for some this is important), and from version 5.2, applications based on QWidgets can even be transferred to a smartphone!

What else is needed? Naturally, the board has an FPGA. I have two of them (Cyclone iv EP4CE10E22C8N for 10 thousand cells, and Cyclone ii EP2C5 for 5 thousand cells). I'll choose the one on the left solely because of the more convenient connector. In terms of volume, the project does not intend to be large, so it will fit into either of the two. They do not differ in speed of operation. Both boards have 50 MHz oscillators on board, and inside the FPGA there is a PLL, with which I can increase the frequency to the planned 200 MHz.

The first day

Due to the fact that I had already made the DDS module in my synthesizer project, I immediately took up the soldering iron and started soldering the DAC with resistors. I took a prototype board. The installation was done using wrapping. The only change that affected the technology was that I abandoned the F38N acid for tinning the stands in favor of the TT indicator flux gel. The essence of the technology is simple: I solder racks into a printed circuit board, and solder resistors on them from the printed circuit board side. I make the missing connections by twisting. Also, the racks are convenient because I can insert them directly into the FPGA board.

Unfortunately, there were no 1 and 2 kilo-ohm resistors available at home. There was no time to go to the store. I had to give up one of my rules and remove resistors from the old unnecessary board. 15K and 30K resistors were used there. The result is this Frankenstein:


After creating the project, you need to set the target device: Menu Assigments -> Device


In the project, I coded the uncontrollable main DDS module to a fixed frequency.

1000 Hz Generator Module

module signal_generator(clk50M, signal_out); input wire clk50M; wire output signal_out; wire clk200M; osc osc_200M reg accumulator; assign signal_out = accumulator; //try to generate 1000 Hz //50,000,000 Hz - clock frequency of the external generator //2^32 = 4,294,967,296 - DDS bit depth - 32 bits //divide 1000Hz / 50,000,000 Hz / 2 * 4294967296 => 42949, 67296 always @(posedge clk50M) begin accumulator<= accumulator + 32"d42949; end endmodule


After that, I clicked “Start Compilation” so that the development environment would ask what input/output lines we have in the main module of the project and what physical PINs they are connected to. You can connect to almost anyone. After compilation, we assign the lines that appear to the real PINs of the chip FPGA:

Menu item Assigments -> Pin Planner

Please ignore the HS_OUT, key0 and key1 lines for now, they appear in the project later, but I didn’t have time to take a screenshot at the very beginning.

In principle, it is enough to “register” only PIN_nn in the Location column, and the remaining parameters (I/O standard, Current Strench and Slew Rate) can be left by default, or you can select the same ones that are offered by default (default) so that there is no warning "ov.

How can I find out which PIN corresponds to the connector number on the board?

The connector pin numbers are marked on the board


And the FPGA pins to which the connector contacts are connected are described in the documentation that comes with the FPGA board.




After the pins are assigned, I compile the project again and flash it using a USB programmer. If you do not have drivers installed for the USB Byte blaster programmer, then tell Windows that they are located in the folder where you have Quartus installed. Then she will find it herself.

The programmer must be connected to the JTAG connector. And the menu item for programming is “Tools -> Programmer” (or click the icon on the toolbar). The “Start” button, the joyful “Success” and the firmware are already inside the FPGA and are already working. Just don’t turn off the FPGA, otherwise it will forget everything.

Tools -> Programmer


The DAC is connected to the FPGA board connector. I connect an oscilloscope S1-112A to the DAC output. The result should be a “saw” because the high-order part of the DDS word of the phase accumulator is output to the 8-bit output. And it always increases until it overflows.

Some 1.5 hours and for a frequency of 1000 Hz I see the following oscillogram:

I would like to note that the “saw” has a small fracture in the middle. It is due to the fact that resistors have a range of values.

Another important point that needed to be clarified is the maximum possible frequency with which the DDS generator will operate. With correctly configured TimeQuest parameters, after compilation in the “Compilation Report” you can see that the speed of the circuit is above 200 MHz with a margin. This means that I will multiply the generator frequency of 50 MHz by 4 using PLL. I will increase the value of the DDS phase accumulator with a frequency of 200 MHz. The final frequency range that can be obtained under our conditions is 0 - 100 MHz. Frequency setting accuracy:

200,000,000 Hz (clk) / 2^32 (DDS) = 0.047 Hz
That is, it is better than ~0.05 Hz. I consider the accuracy of a fraction of a hertz to be sufficient for a generator with such a range of operating frequencies (0...100 MHz). If someone needs to increase the accuracy, then for this they can increase the DDS bit depth (remember to check the TimeQuest Timing Analyzer that the operating speed of the logic circuit was within CLK = 200 MHz, since this is an adder), or simply reduce the clock frequency, if such a wide frequency range is not required.

TimeQuest Timing Analyzer


After I saw “saw” on the screen, family matters forced me to go to the country (it was my day off). There I mowed, cooked, barbecued and had no idea about the surprise that was waiting for me in the evening. Closer to night, before going to bed, I decided to look at the signal shape for other frequencies.

For frequency 100 kHz

For frequency 250 kHz

For frequency 500 kHz

For 1 MHz frequency

Second day

Due to the fact that it was interesting how the DAC would work on resistors of 100 and 200 Ohms, I immediately took up the soldering iron. This time the DAC turned out to be more accurate, and it took less time to install it.

We put the DAC on the FPGA board and connect it to the oscilloscope

Checking 1 MHz - VO! It's a completely different matter!

Saw 10 MHz

Saw 25 MHz


The shape of the 10 MHz saw is still similar to the correct one. But at 25 MHz it is no longer “pretty” at all. However, the C1-112a has a bandwidth of 10 MHz, so in this case the reason may already be in the oscilloscope.

In principle, this issue with the DAC can be considered closed. Now let's take waveforms of the high-speed output. To do this, we will output the most significant bit to a separate PIN of the FPGA. We will take the data for this line from the most significant bit of the DDS accumulator.

Assign hs_out = accumulator;

Square wave 1 MHz

Square wave 5 MHz

Square wave 25 MHz

The 50 MHz square wave is almost invisible now


But I think that the FPGA output should be loaded with resistance. Perhaps the fronts would have been steeper.

The sine is done according to the table. The table size is 256 values ​​of 8 bits. It would have been possible to take more, but I already had a ready-made mif file. Using the wizard, we create a ROM element with sine table data from the mif file.

Creating a ROM - Tools -> Mega Wizard Plugin manager


Select 1 port ROM and give the module a name

We agree

We agree here too

Using browse, we find our mif file with the sine table

We don’t change anything here either.

Uncheck the module sine_rom_bb.v - it is not needed. Next finish. Quartus will ask to add a module to the project - we agree. After this, the module can be used just like any other module in Verilog.


The upper 8 bits of the DDS accumulator word will be used as the ROM address, and the data output will be the sine value.

Code

//sine rom wire sine_out; sine_rom sine1(.clock(clk200M), .address(accumulator), .q(sine_out));


The oscillogram of a sine wave at different frequencies looks... the same.

If desired, you can consider DAC problems associated with resistor spread:

Well, that's the end of the weekend. But software for control from a PC has not yet been written. I am forced to admit the fact that I did not meet the planned deadlines.

Day three

There is very little time, so we write the program in a hurry (in the best traditions). In some places, in order to reduce the number of letters and the convenience of entering information from the keyboard, an event filter is used by the widget name. Please understand and forgive.

Interface

Links with analogues

Not a complete list
Functional DDS generator. Created based on AVR. Frequencies 0… 65534 Hz.
Review of DDS generator GK101. Created using Altera MAX240 FPGA. Frequencies up to 10 MHz.
Multifunction generator on PIC16F870. Frequency range: 11 Hz - 60 kHz.
generators Add tags
 


Read:



How to properly cook grilled chicken

How to properly cook grilled chicken

1. The chicken must be marinated in salt and paprika in advance. To do this, you need to rinse the chicken inside and out and coat it generously with salt and paprika....

Online exam test in Russian language

Online exam test in Russian language

Answer: SCALE SCARED Answer: ___ 123_____________ 14 _ Task 25 of part 2 is an essay on...

To prepare for the exam in social studies

To prepare for the exam in social studies

Preview:5. Culture and spiritual sphere. I. Culture (from Latin - “culture” - “cultivation, education”) Features of culture:...

Compatibility of Leo and Scorpio: should fire be afraid of water?

Compatibility of Leo and Scorpio: should fire be afraid of water?

Fate will not give them sentimental and romantic relationships that will be filled with love and tenderness. Scorpio woman and man...

feed-image RSS