Repair Design Furniture

Sine wave generator on a microcontroller. Functional dds generator on plc. Appearance of the power supply for the generator

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 are no different in speed. 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. Installation was done using . 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 be 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

Here we also agree

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 you 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
  • Qt5
  • Add tags

    The DDS generator, or Direct Digital Synthesis generator, is currently far from a novelty. There are a large number of circuits presented on the Internet, mainly on AVR microcontrollers. The DAC is mainly an R-2R matrix, but there are also designs on the AD9850 chip (by the way, they are not low in cost). But unfortunately (or fortunately?), they did not have what I needed: small size and low cost. As a result, this scheme was developed.

    In this article I want to present a DDS generator made on the ATmega8 microcontroller. To display information, a graphic LCD LPH8731-3C is used. This device allows you to obtain a periodic signal with an arbitrary shape (resolution 100 points) and a specified amplitude.

    Specifications:

    • Supply voltage: 5V
    • Current consumption:<100мА
    • Min. output voltage: 0.5V
    • Max. output voltage: 2.5V
    • Voltage setting step: 0.5V
    • Min. signal frequency: 10Hz
    • Max. Signal frequency: 2kHz (10kHz)
    • Frequency step: 10Hz (100Hz)
    • Number of preset signals: 8
    • Data display: graphic LCD
    • Possibility of adding a waveform “on the fly” (without flashing): absent
    • Backlight brightness: adjustable, requires flashing
    • Max. number of forms in memory: at least 20

    The device diagram is presented below:

    The basis of the circuit, as already mentioned, is the ATmega8-16AU microcontroller. The index "...16" is necessary, since the circuit uses a 16 MHz quartz resonator. The DAC is made on an R-2R matrix. This move allows you to avoid the use of special microcircuits, but unfortunately, it does not allow you to achieve a real DAC resolution higher than 10 .. 12 bits (in amateur conditions). An operational amplifier is connected to the output of the matrix through a resistive voltage divider (R17, RV1), connected according to a repeater circuit and serves to amplify the current.

    The device is controlled using buttons. It is advisable to place only buttons SB1-SB4 on the front panel. Button SB5 plays the role of “functional”, and allows you to use actions different from the “main” ones for buttons SB1-SB4. Switch SA1 turns on/off “generation” and control buttons, respectively. In its first position, control is turned on and signal generation is turned off, and in the other, the situation is diametrically opposite to the first. Connector J2 does not need to be routed on the board, since it is intended only to supply power to the board while programming the microcontroller (but you will have to connect directly to the tracks).

    The printed circuit board of the device is made on double-sided foil material and has dimensions (_ x _). The main difficulty in its manufacture is the layout of the tracks for mounting the microcontroller, but if you have experience in manufacturing such boards and/or the ability to use photoresist/LUT, then there should be no problems during manufacture.

    When assembling the device, I strongly recommend checking whether the vias are well soldered and that the contact between the microcontroller legs and the printed circuit board tracks is reliable. I missed only 1 unsoldered pin of the microcontroller, and as a result it took a couple of days to find the problem.

    Firmware

    The firmware for the microcontroller was written in . A programmer and software were used to fill the .hex file. A screenshot with an example of setting fuse bits is presented below. Since there was no special connector for programming on the printed circuit board, to flash the microcontroller firmware you will have to temporarily solder to the corresponding tracks (microcontroller pins “MISO”, “MOSI”, “SCK”, “RESET”).

    Assembly and layout of the device

    When placing the device in a case, it is advisable to install the SB5 button on its side. Switch SA1 in my version was located at the bottom end, as was the connector for connecting the load. The USB connector is installed at the top of the case because the plan was to use a 3.7 -> 5V DC-DC converter. But since I wanted versatility, I decided to make this block removable.

    Possible replacement of elements

    The microcontroller can only be used ATmega8-16AU. The LM358 operational amplifier is similar (for example, NE532, OP04, OP221, OP290, ...) in an SO-8 package, and you should not forget about possible pin mismatches. Transistor Q1 can be taken from any low-power n-p-n, for example, the domestic KT315 or KT3102. It is advisable to take resistors R1-R16 with a minimum tolerance (0.5...1%), but the more common 2...5% will also work (but here the signal shape may be slightly worse). Moreover, it is advisable to take resistors of the same value (let it be 10 kOhm), and then where 2R is required, put 10 kOhm, and where R - 2x10 kOhm in parallel. It is advisable to take capacitors C1, C2 in the range of 22...33pF. The quartz resonator used is low-profile, at a frequency of 16 MHz. Resistor RV1 is multi-turn. The zener diode can only be set to 3.3V.

    The LCD display can only be used with a yellow backing and the inscription "LPH8731-3C". It is found in Siemens A60, A65, etc. mobile phones and has a resolution of 101x80 pixels.

    Settings

    A correctly assembled device does not require adjustment, and should work immediately after assembling and flashing the controller. If this does not happen, then check for short tracks on the printed circuit board, the correct connection of the LCD display, the integrity of the wires from the SA1 switch, as well as the serviceability of the zener diode and the power supply/USB cable.

    Upon successful first turn-on, you need to use an oscilloscope and trimming resistor RV1 to adjust the output signal level according to the settings on the display.

    Purpose of the buttons: SB1 - "Left" (Output voltage is less), SB2 - "Right" (Output voltage is more), SB3 - "Frequency +10" (Frequency +100), SB4 - "Frequency -10" (Frequency - 100)<-- SB5 - Отжата (Нажата).

    Photo and video of the device:


    The two photos below show how you can get a higher frequency than 2 kHz. But it has to do with the quality of the signal (for rectangular ones it doesn’t matter).



    Oscillograms of signals obtained using this device:





    Appearance of the assembled device:


    List of radioelements

    Designation Type Denomination Quantity NoteShopMy notepad
    U1 MK AVR 8-bit

    ATmega8A-AU

    1 To notepad
    U2 Operational amplifier

    LM358

    1 Housing SO-8 (LM358D)) To notepad
    Q1 Bipolar transistor

    BC547

    1 To notepad
    D1 Zener diode

    BZX55C3V3

    1 To notepad
    RV1 Trimmer resistor220 kOhm1 To notepad
    R1-R9 Resistor

    2.2 kOhm

    9 0805, 1% To notepad
    R10-R16, R32 Resistor

    1.1 kOhm

    8 0805, 1% To notepad
    R17 Resistor

    100 kOhm

    1 0805 To notepad
    R19-R23 Resistor

    5.6 kOhm

    5 0805 To notepad
    R24-28, R18 Resistor

    10 kOhm

    5 0805 To notepad
    R29, R30 Resistor

    220 Ohm

    2 0805 To notepad
    R31 Resistor

    75 Ohm

    1 0805 To notepad
    R33 Resistor

    510 Ohm

    1 0805 To notepad
    C1, C2 Capacitor27 pF2 0805

    We assemble a simple function generator for the laboratory of a novice radio amateur

    Good afternoon, dear radio amateurs! Welcome to the website ““

    We assemble a signal generator - a function generator. Part 3.

    Good afternoon, dear radio amateurs! At today's lesson in Beginning radio amateur school we'll finish collecting function generator. Today we will assemble a printed circuit board, solder all the attached parts, check the functionality of the generator and configure it using a special program.

    And so, I present to you the final version of my printed circuit board made in the program that we looked at in the second lesson - Sprint Layout:

    If you were unable to make your own version of the board (something didn’t work out, or you were just lazy, unfortunately), then you can use my “masterpiece”. The board is 9x5.5 cm in size and contains two jumpers (two blue lines). Here you can download this version of the board in Sprint Layout format^

    (63.6 KiB, 3,488 hits)

    After using laser ironing technology and etching, the result was the following workpiece:

    The tracks on this board are made with a width of 0.8 mm, almost all pads are 1.5 mm in diameter, and almost all holes are made with a 0.7 mm drill. I think that it will not be very difficult for you to understand this board, and also, depending on the parts used (especially the trimmers), make your own changes. I want to say right away that this board has been tested and if the parts are soldered correctly, the circuit starts working immediately.

    A little about the functionality and beauty of the board. When you pick up a factory-made board, you probably noticed how conveniently it is prepared for soldering parts - so-called “silk-screen printing” is applied in white on both the top and bottom, on which the names of the parts and their locations are immediately visible, which makes life very easy when soldering radioelements. Seeing the seat of the radio element, you will never be mistaken in which holes to insert it into, all you have to do is look at the diagram, select the desired part, insert it and solder it. Therefore, today we will make a board close to the factory one, i.e. Let's apply silk-screen printing to the layer from the parts side. The only thing is that this “silk-screen printing” will be black. The process is very simple. If, for example, we use the Sprint Layout program, then when printing we select layer K1 (the layer on the parts side), print it as for the board itself (but only in mirror image), put a print on the side of the board where there is no foil (with sides of the parts), center it (and the pattern is fairly visible in the light of the etched board) and using the LUT method we transfer the toner to the PCB. The process is the same as when transferring toner to copper, and we admire the result:

    After drilling the holes, you will actually see the layout of the parts on the board. And the most important thing is that this is not only for the beauty of the board (although, as I already said, a beautiful board is the key to good and long-term operation of the circuit you have assembled), but most importantly, to facilitate further soldering of the circuit. The ten minutes spent on applying “silk-screen printing” significantly pays off in time when assembling the circuit. Some radio amateurs, after preparing the board for soldering and applying such “silk-screen printing,” cover the layer on the parts side with varnish, thereby protecting the “silk-screen printing” from being erased. I would like to note that the toner on the PCB adheres very well, and after soldering the parts you will have to remove the remaining rosin from the board with a solvent. If solvent gets on the “silk-screen printing” coated with varnish, it leads to the appearance of a white coating, when removed, the “silk-screen printing” itself comes off (this is clearly visible in the photograph, this is exactly what I did), therefore, I believe that it is not necessary to use varnish. By the way, all the inscriptions and contours of parts are made with a line thickness of 0.2 mm, and as you can see, all this is perfectly transferred to the textolite.

    And this is what my board looks like (without jumpers and attachments):

    This board would have looked much better if I hadn't varnished it. But you can, as always, experiment and, of course, do better. In addition, I have two C4 capacitors installed on the board; I didn’t have the required value (0.22 μF), so I replaced it with two 0.1 μF capacitors connecting them in parallel.

    Let's continue. After we have soldered all the parts onto the board, we solder two jumpers and solder resistors R7 and R10 and switch S2 using sections of mounting wires. We do not solder switch S1 yet, but make a jumper from a wire, connecting pins 10 of the ICL8038 microcircuit and capacitor C3 (i.e., we connect the range 0.7 - 7 kHz), supply power from our (I hope assembled) laboratory power supply to the inputs of microcircuit stabilizers about 15 volts DC voltage

    Now we are ready to test and configure our generator. How to check the functionality of the generator. Very simple. We solder to outputs X1 (1:1) and “common” any ordinary or piezoceramic speaker (for example, from a Chinese clock in an alarm clock). When the power is connected, we will hear a beep. When changing resistance R10, we will hear how the tone of the output signal changes, and when changing resistance R7, we will hear how the volume of the signal changes. If you don’t have this, then the only reason is improper soldering of the radio elements. Be sure to go through the scheme again, eliminate the shortcomings and everything will be ok!

    We will assume that we have passed this stage of generator manufacturing. If something doesn’t work out, or it works out but not right, be sure to ask your questions in the comments or on the forum. Together we will solve any problem.

    Let's continue. This is what the board looks like ready for configuration:

    What we see in this picture. Power supply – black “crocodile” to the common wire, red “crocodile” to the positive input of the stabilizer, yellow “crocodile” - to the negative input of the negative voltage stabilizer. Soldered variable resistances R7 and R10, as well as switch S2. From our laboratory power supply (this is where the bipolar power supply comes in handy), we supply the circuit with a voltage of about 15-16 volts, so that the 12-volt microcircuit stabilizers work normally.

    Having connected power to the inputs of the stabilizers (15-16 volts), use a tester to check the voltage at the outputs of the stabilizers (±12 volts). Depending on the voltage stabilizers used, the voltage will differ from ± 12 volts, but is close to it. If your voltages at the outputs of the stabilizers are absurd (do not correspond to what is needed), then there is only one reason - poor contact with ground. The most interesting thing is that even the absence of reliable contact with the “ground” does not interfere with the operation of the generator on the speaker.

    Well, now we just need to configure our generator. We will carry out the setup using a special program - virtual oscilloscope. On the Internet you can find many programs that simulate the operation of an oscilloscope on a computer screen. Especially for this lesson, I checked many such programs and chose one, which, it seems to me, simulates an oscilloscope the best - Virtins Multi-Instrument. This program includes several subprograms - an oscilloscope, a frequency meter, a spectrum analyzer, a generator, and in addition there is a Russian interface:

    Here you can download this program:

    (41.7 MiB, 5,238 hits)

    The program is easy to use, and to configure our generator you only need minimal knowledge of its functions:

    In order to configure our generator, we need to connect to the computer via a sound card. You can connect through the line input (not all computers have it) or to the microphone connector (available on all computers). To do this, we need to take some old, unnecessary headphones from a phone or other device, with a plug with a diameter of 3.5 mm, and disassemble them. After disassembly, solder two wires to the plug - as shown in the photo:

    After this, solder the white wire to ground and the red wire to pin X2 (1:10). We set the R7 signal level control to the minimum position (be sure to not burn the sound card) and connect the plug to the computer. We launch the program, and in the working window we will see two running programs - an oscilloscope and a spectrum analyzer. Turn off the spectrum analyzer, select “multimeter” on the top panel and launch it. A window will appear that will show the frequency of our signal. Using resistor R10 we set the frequency to about 1 kHz, set switch S2 to position “1” (sinusoidal signal). And then, using trimming resistors R2, R4 and R5, we configure our generator. First, the shape of a sinusoidal signal with resistors R5 and R4, achieving a sine wave shape on the screen, and then, switching S2 to position “3” (rectangular signal), using resistor R2 we achieve signal symmetry. You can see what it really looks like in this short video:

    After completing the steps and setting up the generator, we solder switch S1 to it (after removing the jumper) and assemble the entire structure in a ready-made or homemade (see lesson on assembling a power supply) case.

    Let's assume that we have successfully dealt with everything, and a new device has appeared in our amateur radio equipment - function generator . We will not equip it with a frequency meter yet (there is no suitable circuit) but will use it in this form, given that we can set the frequency we need using the program Virtins Multi-Instrument. We will assemble a frequency meter for the generator on a microcontroller, in the “Microcontrollers” section.

    Our next stage in the knowledge and practical implementation of amateur radio devices will be the assembly of a light-and-music installation using LEDs.

    When repeating this design, there was a case when it was not possible to achieve the correct shape of rectangular pulses. It is difficult to say why such a problem arose, perhaps because of the way the chip works. Solving the problem is very easy. To do this, you need to use a Schmitt trigger on the K561(KR1561)TL1 chip according to the diagram below. This circuit allows you to convert voltage of any shape into rectangular pulses with a very good shape. The circuit is connected to the gap in the conductor coming from pin 9 of the microcircuit, instead of capacitor C6.

    This project is a high-quality and universal function generator, which, despite some complexity of the circuit, at least in comparison with simpler ones, has very wide functionality, which justifies the cost of its assembly. It is capable of producing 9 different waveforms and also works with pulse synchronization.

    Schematic diagram of the generator on the MK

    Device settings

    • Frequency range: 10 Hz - 60 kHz
    • Digital frequency adjustment in 3 different steps
    • Waveforms: Sine, Triangle, Square, Saw, H-pulse, L-pulse, Burst, Sweep, Noise
    • Output range: 15V for sine and triangle, 0-5V for other modes
    • There is an output for pulse synchronization

    The device is powered from 12 volts AC, which provides a sufficiently high (over 18 V) DC voltage necessary for normal operation of the 78L15 and 79L15, which form a bipolar 15 V circuit. This is done so that the LF353 microcircuit can output the full range of signals to the load 1 kOhm.

    Level controller used ALPS SRBM1L0800. The circuit should use resistors with ±1% tolerance or better. LED current limiters - 4306R series resistors. Brightness can be increased depending on the preference of the performer. The generator is assembled in a plastic case 178x154x36 mm with aluminum front and rear panels.

    Many contact components are mounted on the front and rear panels (buttons, knobs, RCA connectors, LED assemblies, power connector). Printed circuit boards are attached to the housing with bolts with plastic spacers. All other elements of the generator are mounted on printed circuit boards - the power supply is separate. The left button in the middle is to change the mode, the right one is to select the mode frequency.

    The generator produces various signals and operates in three modes, which are selected using the "Select" key and indicated by the three upper (in the diagram) LEDs. The rotary control changes the signal parameters according to the following table:

    Immediately after setting in mode 1, sine generation occurs. However, the starting frequency is quite low and at least one click of the encoder is needed to increase it. The board has a contact for connecting the device for programming, which allows you to quickly change the functionality of the signal generator, if necessary. All project files - PIC16F870 firmware, board drawings, are located

    The article uses materials from the YouTube channel Soldering Iron TV. In the practice of a radio amateur, there are situations when a frequency generator is needed. For example, when setting up a low-frequency amplifier and when designing switching power supplies. You can purchase ready-made generators or construction kits in various online stores. For example, a digital designer, a generator of sine, meander and saw frequencies. The estimated cost of such a set is from 800 to 1000 rubles. It was purchased from a Chinese online store and goes under the name “DDS Function Signal Generator Module DIY.”

    This set is supplied in an antistatic bag. What do we have inside? So, we see a printed circuit board of fairly high quality. Fiberglass is quite thick. The printed circuit board shows all the values ​​of the necessary components. Next are the passive components, various resistors, and the ATmega 16 chip itself. You can take a closer look at it. Also a socket for her. And another eight-legged LN358 microcircuit. Liquid crystal display, 16-bit, I think. Plugs for connecting outputs, connectors. Bolts for attaching the display to the board. Also stands for bolts. Pin connectors. Another panel. Variable resistors; one, as you can already tell from the board, is for adjusting the amplitude; second... let's figure out why. And microswitches. Another variable resistor. Unfortunately, the kit is missing, or maybe the manufacturer simply decided that the radio amateur does not need detailed instructions...

    Assembling a signal generator designer.

    As a matter of fact, there are no detailed instructions on how to assemble, how to launch, how to use, and so on. But let's try to figure it out ourselves. I think there will be no problems in assembly, since all denominations are signed. Also, the designer does not have any name other than the name “DDS signal generator”, and some markings TB207809. I don’t know what it is, the model number or the marking of our designer itself. I have no idea.

    Let's start soldering the components. Let's start with the passive ones. From resistors. Let's check their denominations. These are 10 kOhm resistors, these are apparently kOhms. With a wide spread... Yes, this is at 20 kOhm. As you can see from the board, we have a lot of identical resistors. Here is a row of 10 kilo-ohm ones, here is a row of 20. There will be no problems with soldering. Let's start with 10 kilo-ohm ones. Now let’s solder in 20 kilo-ohm resistors. For reliability, you can also solder all resistors on the front side of the track. Since all the holes are metallized, if you suddenly missed something somewhere, you can compensate for this problem here. We solder the remaining resistors, having first checked the value. This is a 100 Ohm resistor, here it is on the board. So, all fixed resistors on the board are soldered.

    Now let's solder in the capacitors, we don't have many of them. It seems like there are only 4 things... That's right. So, the first capacitor, marked 104, is 100 nF. Also two capacitors, small orange, 22 pF. They are located to the right and left of the quartz resonator. So, all capacitors are soldered in.

    Now let's solder in our quartz, it is 16 MHz. It stands between two 22 pF capacitors. The polarity doesn't matter. Let's place it level and bend the legs here. The quartz resonator is soldered.

    Now let's solder the sockets for the microcircuits. We have two of them. Let's start with the big one. One socket is soldered. Now let's solder a small socket, LM358. Now let's solder two pin connectors on the board. One of them is the “female” connector; it fits tightly into the hole into the board, so it does not need to be fixed anywhere. And the second connector is “male”, this is the power input connector. It also fits in tightly, there is no need to fix anything.

    Now you can solder in our buttons or microswitches, whichever is more convenient for you. They also get stuck in tension. Everything switches, everything is fine. Now let's solder three variable resistors. We have one marked 102, which means 10 and two more zeros, that is, 1 kOhm. He will stand in this place. It doesn't fit quite snugly, so you'll have to hold it. And the first soldering is a little sloppy. It remains to solder two output signal connectors on this board. After soldering they hold very, very tightly. In order for the microcircuit to fit tightly into its socket, you need to slightly bend the 22 pF capacitors, like this. Now the microcircuit will fit exactly. The key should be positioned as shown on the markings. Now let's insert the second microcircuit. We also insert it in accordance with the markings. The key should be located at the bottom. Like this. The chip is inserted. Now you can solder the pin header onto the display PCB. First you need to fix the pin connector and align it so that it does not fit crookedly. To do this, solder one leg. So. From this side it is also desirable. Let's see how he got up. It stands up straight. You can now solder it completely. Now, in order for the display to be in its place, you need to put stands under the bolts. They are installed in two places here and, accordingly, here. To do this, we need a screwdriver, maybe a Phillips head, or a flathead one. It’s still more convenient to use a cross. And we do the following: put a bolt, put a stand, tighten it. One. Second. Like this.

    Now we install our display exactly in its position, that is, we combine the holes, the female-male pin connector, and stick it here. Thus, our display should be slightly above the chip. Just a little higher than our microcontroller so that it doesn't touch it. And screw in the two bolts of the stand. Like this. At this point, the assembly of our generator can be considered complete. So, before testing our generator, I strongly recommend that you wash the board to remove flux residue, just in case. In order to start the generator, it needs three voltages. That is, it is 5 V, +12 V, -12 V, and, accordingly, ground. To do this, you can assemble a power supply on two transformers, and make a bipolar output, and make stabilization at 5 V on the positive side. Or you can take a power supply from a computer, it already has an output of 5 V, 12 V, and -12 V In order to start it, just short-circuit the green and black wires with a jumper. I'll just use the power supply from the computer. I diverted the necessary wires from it. Blue is -12 V, black is ground, yellow is +12 V, and red is +5 V. We plug it into our pin connector somehow...

    Now we can turn on our power supply to the network. So, we see that our screen lights up. We don't see anything else yet. But don't be alarmed, this doesn't mean you assembled it incorrectly. On the manufacturer’s website, I still found the necessary instructions for adjustment, and in order for us to start showing something, we need to adjust this small 10 kOhm variable resistor. We twist it in different directions and see what appears on the screen. That is, we twist it like this, counterclockwise, and nothing happens. We turn it clockwise and see that letters begin to appear. Even stronger - our pixels are all starting to burn. Let's adjust it so that the text is clear. Like this. We see the text, the inscription sine wave SIN, 30 Hz, off. And in order to see even better, let’s remove the protective film. Like this. Now we see that our generator is finally working.

    Test of generator operating modes after assembly.

    Let's see what operating modes it has. Click down, the DOWN button. Here the inscription is SQUARE, which means “rectangle”. TRIANGLE, this means “triangle”. SAWTOOTH, it means "saw". REW SAWTOOTH, this is a “reverse saw”. ECG is one type of signal too. And frequency step. There is also noise and a high-frequency signal. Left and right we change our frequency. If you hold it, it will begin to change quickly. We launch it with the “START” button. Using the “RESET” button we reset our settings. We can change the frequency step from 10 Hz... from 1 Hz, then 100, then 1000, then 10,000. That is, let’s say we choose a step of 1 Hz. Let's choose a sinusoid. And we can change the signal one hertz at a time. It will not always be convenient; it is convenient only at low frequencies. Let's choose, say, a step of 1000, choose a sinusoid, and see what the maximum is. So, we see that the maximum frequency generated by a regular DDS output is 65535 Hz on all types of signals. That is, we look, it’s the same on the rectangle, we can’t add. This is natural, as it is at all frequencies. And the minimum frequency, accordingly... Let's take a look. We see, from zero. From zero, and then it went, 1, 2, 3, 4, 5, 6, 7... And so on. Well. Our generator is working.

    I forgot to say that you can turn it on with any position of the variable resistors, this will not affect it in any way. Except, accordingly, this one, and you will adjust this one when you turn it on. Now let's move on to directly checking the quality of our signal. For tests, I will need a laptop with a USB oscilloscope, and an oscilloscope probe like this to connect it to the oscilloscope and the generator at the same time. Let's first connect to the DDS output, that is, to the output with a low-frequency signal. Let's set the frequency sine to 1 Hz and try to turn it on. Nothing yet... But nothing, because we didn’t connect an oscilloscope. We see that we have something. Let's change the oscilloscope sweep to, say, 200 ms. Here. We see a sinusoid, very low frequency. Oscilloscope frequency 0.95 Hz. For good tests, let's increase the frequency a little. Let's say 20 Hz. Now let's change the timebase again to 10 ms. We see a very pure sine wave with a frequency of 19.9 Hz. Let's try to change the signal amplitude. It’s better not to touch the board from the back side, such bad interference occurs. Therefore, we will not touch. As we can see, the amplitude is very well regulated from zero to... The signal amplitude is 18.8, that is, from the lower peak to the upper peak 18.8 V. Accordingly, from zero to the upper peak we get a little less than 10 V Why do we need a second variable resistor? Let's see. The sine wave crawled, so to speak, upward. And now it has crawled down. So, what is it for? This resistor changes the signal offset. That is, if we need a sinusoid from zero to some voltage value, we simply drag it up, reduce the amplitude of the signal, and here we have a sinusoid from zero to 10 V. And if we need a variable sinusoid, that is, from the supply voltage to minus supply voltage, we rotate the slider in the other direction, the potentiometer. Just like that. We change the amplitude value of the voltage. And as we see, we have a sinusoid from -9 to +9 V. The same with everyone else. Let's choose, for example, a rectangle. We see a variable rectangle, that is, it also ranges from minus supply voltage to plus, from -10 to +10 V. By changing the slider, changing its position, we change the lower component of our signal. That is, now we have a purely pulsed rectangle, from zero to supply voltage. Or vice versa, from zero to minus supply voltage. We need to set up synchronization... Let's increase the frequency a little so that everything goes faster. That is, let’s now select a step, FREQUENCU STEP, 100 Hz, for example. Like this. So it will be great, 500 Hz. Turn it on, see a 500 Hz rectangle, change the scan. For some reason the decay front is quite flat here, at 500 Hz. Let's see what will happen at further frequencies, so we won't ask questions for now... Let's set the sweep to 200 for now... No, 1 ms. Let's set a variable position, something like this... Here we have a rectangle, our amplitude changes. Now let's choose what we have next... Triangle. We look at the same triangle, the amplitude changes easily, without any problems. The same thing changes and its position relative to zero. We can see. Let's put it back now. Next we have the saw. Let's look at the saw. The same thing, everything changes beautifully, both here and there. And its amplitude also changes. Everything is fine. Good quality signal. Next comes the reverse saw. Also, amplitude, position relative to zero. Next comes the ECG signal, this is what it looks like. And its position relative to zero and amplitude also change. The last one we have is noise. The noise also changes its position relative to zero, and the amplitude also changes. We checked the low frequencies. Now let's change the step, let it be 10,000. Let's set the highest frequency, almost the highest. Let's launch. Wow, what is this? Very sad, actually. Accordingly, there is no rectangle here. Okay, let's give the frequent one half that amount. SQUARE... Let it be 25 kHz. There should be a rectangle, but for some reason we have a triangle here. For some reason we have a triangle here. Interesting... What if you change the amplitude? Now we get some kind of full-wave rectified sinusoid. There is no rectangle here either. Okay... Let's reduce the frequency even more. Let's say up to 15 kHz. Now at least there is some kind of appearance. Just like that. Yes, everything is not quite as rosy as I thought. Some grandfather time shelves are appearing here, these ones here. Where they come from is unknown. Well. Up to 5 kHz, in principle, our generator is still usable, and after that, apparently, we already see that our trajectory is very flat. I assembled a generator using ordinary logic, and it produced a stable rectangle up to 0 kHz, in contrast to this. Let's see how the saw behaves at the same frequencies... Not a saw, but a triangle. We don’t have any particular problems with the triangle, it’s the same, everything is regulated. Everything is fine. And, let's say, she drank? The decline has become very gentle, not sharp. Characteristics vary greatly. And the same thing with the reverse saw. ECG, there is also something incomprehensible here. Some kind of pyramids of Cheops. And noise... Some kind of set of harmonics from rectangles. Also, apparently, already poorly used... Well, what can we say? Up to 5 kHz the generator still copes with its task almost well. That is, at low frequencies up to 500 Hz everything is fine, after which some parameter deviations begin, flatter trajectories. And from 5 kHz and above there is a very strong change in characteristics, and at the highest frequency of 65 kHz some nonsense happens, frankly. It is absolutely impossible to use such a sine and other types of signal. Well, we need to see what we have with the high-frequency output. Switch to HIGH-SPEED OUT. Here we select HIGH-SPEED. And we'll see. Let's immediately change the timebase to 100 ns. And let's see what we can do. You see, the adjustment is already here... The position of the levels does not change anything. Accordingly, this is a completely different way out. This is the output directly from the chip. Directly from the microcontroller. We see a rectangle here, a pretty good one at that. That is, what was at 65 kHz cannot even be compared with this. There is already a very high-quality megahertz rectangular device here. The logic signal was just a little worse for me. The only thing is that the amplitude here, I see, does not change. A stable signal will have an amplitude of 5 V. Now let's see what happens when we increase the frequency, that is, set it to, say, 2 MHz. Turn it on. The rectangle is almost good. The amplitude also did not change, 5 V remained. Let's look further. 4 MHz. At 4 MHz the rectangle looks more like a sine; although it still has a small constant component, it’s not the same anymore. A very flat front and decline are obtained. And the amplitude, by the way, has not changed either, 5 V. And we look at 8 MHz. The amplitude has changed, 4.5 V, and here we no longer have a rectangle, but a clear sine. Increasing the scan, we clearly see something similar to a sine here. The outlet has just such a sine wave, only 50 Hz. It has the same curve characteristics. I don’t know in what equipment such a sine wave can be used. Well, 1 and 2 MHz are quite usable. Turn it off.

    Conclusions.

    What can we say in general? Overall, the set is not bad. It met expectations by 50 percent. But, of course, a strong change in characteristics from 5 kHz is very bad. I didn't expect it to give such a bad signal. But up to 5 kHz is quite usable. Let's say that for testing low-frequency, audio-frequency amplifiers, this set can be used. At 40 kHz, that is, these are the operating frequencies of pulse converters, somewhere from 25 to 100 kHz, there is nothing to catch here, you won’t get any good signal here. Using the same TL494 PWM controller, the signal is much better. I would also like to add that the manufacturer nevertheless made a description of his kit on the website, which will be posted in the description of the video. Here is the location of all the components, setting the variable resistor for normal operation of the display, frequency steps, basic operation, a circuit diagram for our generator, and also the circuit diagram itself.