Do-it-yourself oscilloscope on a peak controller. Dual channel USB HID oscilloscope based on ATtiny45 microcontroller. Full set of classic peripherals

Measuring technology

Pocket oscilloscope up to 1 MHz

Replacing the PIC16F873A microcontroller with the PIC18F4550 in the pocket oscilloscope described in, and the K140UD608 operational amplifier with the TDA8708A analog video interface chip, it was possible to reduce the sweep duration by 150 times, to 21 μs for the entire screen width, and increase the maximum input signal frequency to 1 MHz. This greatly expanded the capabilities of the oscilloscope.

Main technical characteristics

Beam deflection voltage for the entire height of the screen, V ................. 0.2; one; 3; ten; thirty; 100

Maximum frequency of the studied signal, MHz ........ 1

Horizontal sweep duration, µs.......21, 170, 1000, 10-103, 30-103, 100-103, 300-103, 106

Screen resolution, px......128x64

Supply voltage, V .............. 5

Consumed current, mA ........... 115

Dimensions, mm............80x62x30

Weight, g........................110

The oscilloscope circuit is shown in fig. 1. The input signal is sent to pin 20 (ADCIN - ADC input) of the DA1 chip (TDA8708A). To start its ADC, the DD1 microcontroller generates clock pulses at pin 17. The binary codes of the signal counts are sent to port B of the DD1 microcontroller, which, according to the program, writes them to the RAM, and then displays them on the HG1 graphic LCD in the form of an oscillogram. A general description of the MT-12864J-2FLA LCD can be found in , and read about its use in .

Rice. 1. Oscilloscope circuit

On fig. 2 shows an oscillogram of a signal with a frequency of 100 kHz. The variable resistor R6 shifts the scan line vertically, setting it to the most convenient position for observing the waveform. A selection of resistor R12 achieves the best image contrast on the LCD screen.

Rice. 2. Oscillogram of a signal with a frequency of 100 kHz

The oscilloscope sweep works in single trigger mode by pressing the SB1 button. By pressing the button SB2, change the duration of the sweep. After each pressing of this button, the value of the new sweep duration is displayed for some time (Fig. 3).

Rice. 3. The value of the new sweep duration

The microcontroller program can be downloaded.

Literature

1. Pichugov A. Pocket oscilloscope. - Radio, 2013, No. 10, p. 20, 21.

2.PIC18F2455/2550/4455/4550 Data Sheet. - URL: http://ww1.microchip.com/downloads/en/DeviceDoc/39632e.pdf (04/22/15).

3. V. S. Yatsenkov, Microchip microcontrollers with USB hardware support. - M.: Radio and communication, 2008.

4. TDA8708A. Video analog input interface. - URL: http://doc.chipfind.ru/pdf/philips/tda 8708a.pdf (21.05.15).

5. Liquid crystal module MT-12864J. - URL: http://www.melt.com.ru/files/file2150172.5.pdf (22.04.15).

6. Milevsky A. The use of a graphic LCD MT-12864A with a Microchip microcontroller. - Radio, 2009, No. 6, p. 28-31.


Publication date: 06.11.2015

Readers' opinions
  • admin / 18.04.2017 - 14:35
    The problem is on the ftp server where the distribution comes from. I think this is a temporary phenomenon, try downloading a little later.

The proposed device belongs, rather, to the category of oscilloscope-graphic probes. Its capabilities allow only "by eye" to evaluate the shape and parameters of low-frequency signals. Nevertheless, due to its small size and cost-effectiveness, such an oscilloscope can be used in amateur radio practice, especially when diagnosing and repairing equipment in the field.

This development is based on a small-sized two-beam oscilloscope-multimeter, described in. Only one "beam" is left in it. The maximum sensitivity of the vertical deviation channel has been increased from 640 to 100 mV (full screen). The minimum sweep duration has been reduced from 5 to 3 ms, and when observing logic signals - up to 300 µs. Significantly reduced the dimensions of the device, its weight and current consumption.

Main technical characteristics

The oscilloscope circuit is shown in fig. 1. The investigated signal of arbitrary shape, depending on its amplitude, is fed to "Input 1" - one of the sockets 1-5, 7, 8 of connector X1, and the common wire of the source of the signal under study is connected to its socket 6. Resistors R1-R6, which set the sensitivity of the vertical deflection channel of the oscilloscope, are mounted directly on the pins of the connector sockets. Through the amplifier on the K140UD608 (DA1) op-amp, the signal is fed to pin 2 (RA0) of the microcontroller (DD1), which serves as the input of the ADC built into it. Digital readings of instantaneous signal values ​​for the time corresponding to the selected sweep duration are stored in the microcontroller's RAM and displayed on the HG1 graphic LCD in the form of an oscillogram. An LCD is used, which is controlled via the lines of the ports RB0-RB4 and RC0-RC7 of the microcontroller. When developing software, the recommendations from the article turned out to be very useful.

Variable resistor R10 is designed to shift the waveform vertically. Resistor R17 is selected to achieve the best image contrast on the indicator screen.

The oscilloscope sweep is one-shot, triggered each time the SB2 button is pressed. The duration of the sweep is changed by pressing the SB1 button. After each click, the indicator screen displays a number — the value of the selected duration.

If the sweep duration is set to 300 µs (full screen), the ADC of the microcontroller no longer has time to digitize the samples of the signal under study. At such a speed, the indicator can only observe the nature of the change in time of the logical levels of pulses applied to slot 9 of connector X1 ("Input 2" of the oscilloscope). Through the separating capacitor C1, these pulses are fed directly to the discrete input RA1 (pin 3) of the microcontroller.

The oscilloscope is assembled by surface mounting on a board (Fig. 2), placed in a case made from a fishing tackle box. The HG1 indicator is located on the housing cover. The appearance of the operating device is shown in fig. 3. The third button visible in the photographs is left unconnected. It is not used with the device.

Assembly source code and firmware for the PIC16F873A microcontroller are available at .

Literature:

1. Kichigin A. Small-sized two-beam oscilloscope-multimeter. - Radio, 2004, No. 6, p. 24-26.
2. Liquid crystal module MT-12864J. - .
3. Milevsky A. Using a graphic LCD MT-12864A with a Microchip microcontroller. - Radio, 2009, No. 6, p. 28-31.

An oscilloscope is a device that helps to see the dynamics of oscillations. With its help, you can diagnose various breakdowns and obtain the necessary data in radio electronics. In the past, transistorized oscilloscopes were used. These were very bulky devices that were connected exclusively to a built-in or specially designed screen.

Today, devices for taking the main frequency, amplitude characteristics and waveforms are convenient, portable and more compact devices. Often they are performed as a separate set-top box that connects to a computer. This maneuver allows you to remove the monitor from the package, significantly reducing the cost of equipment.

You can see what a classic device looks like by looking at a photo of an oscilloscope in any search engine. At home, you can also mount this device using inexpensive radio components and cases from other equipment for a more presentable look.

How can I get an oscilloscope

Equipment can be obtained in several ways and it all depends solely on the amount of money that can be spent on acquiring equipment or parts.


  • Buy a ready-made device in a specialized store or order it online;
  • To buy a constructor, for example, sets of radio components, cases, which are sold on Chinese sites, are now very popular;
  • Independently assemble a full-fledged portable device;
  • Mount only the prefix and probe, and organize the connection to a personal computer.

These options are listed in order of decreasing equipment cost. Buying a ready-made oscilloscope will cost the most, since it is already delivered and working unit with all the necessary functions and settings, and in case of incorrect operation, you can contact the sales center.

The designer includes a simple do-it-yourself oscilloscope circuit, and the price is reduced by paying only the cost of radio components. In this category, it is also necessary to distinguish between more expensive and simple models in terms of configuration and functionality.

Assembling the device yourself according to the available schemes and radio components purchased at different points may not always be cheaper than purchasing a designer, therefore, it is necessary to first evaluate the cost of the idea, its justification.

The cheapest way to get an oscilloscope is to solder only the prefix to it. For the screen, use a computer monitor, and programs for capturing and transforming the received signals can be downloaded from various sources.


Oscilloscope Builder: Model DSO138

Chinese manufacturers have always been famous for their ability to create electronics for professional needs with very limited functionality and for quite a bit of money.

On the one hand, such devices are not able to fully satisfy a number of needs of a person involved in radio electronics in a professional way, however, beginners and lovers of such “toys” will have more than enough.

One of the most popular Chinese-made models such as an oscilloscope designer is the DSO138. First of all, this device has a low cost, and it comes with all the necessary parts and instructions, so there should be no questions about how to make an oscilloscope with your own hands using the documentation included in the kit.

Before installation, you need to familiarize yourself with the contents of the package: board, screen, probe, all the necessary radio components, assembly instructions and a circuit diagram.

The work is facilitated by the presence of corresponding markings on almost all the details and the board itself, which really turns the process into assembling a children's construction set by an adult. On the diagrams and instructions, all the necessary data is clearly visible and you can figure it out without even knowing a foreign language.


The output should be a device with the following characteristics:

  • Input voltage: DC 9V;
  • Maximum input voltage: 50 Vpp (1:1 probe)
  • Current consumption 120 mA;
  • Signal bandwidth: 0-200KHz;
  • Sensitivity: electronic bias with vertical adjustment option 10 mV/div - 5V/Div (1 - 2 - 5);
  • Discrete frequency: 1 Msps;
  • Input resistance: 1 MΩ;
  • Time Interval: 10us / Div - 50s / Div (1 - 2 - 5);
  • Measurement accuracy: 12 bits.

Step-by-step instructions for assembling the DSO138 constructor

You should consider in more detail the detailed instructions for the manufacture of an oscilloscope of this brand, because other models are assembled in the same way.

It should be noted that in this model the board comes with a soldered 32-bit Cortex™ microcontroller on the M3 core. It works with two 12-bit inputs with a characteristic of 1 μs and operates in a maximum frequency range of up to 72 MHz. Having this device already mounted makes the task somewhat easier.

Step 1. It is most convenient to start the installation with smd components. It is necessary to take into account the rules when working with a soldering iron and a board: do not overheat, hold no longer than 2 s, do not close different parts and tracks together, use solder paste and solder.

Step 2. Solder the capacitors, inductors and resistances: you need to insert the specified part into the place allotted for it on the board, cut off the excess leg length and solder it on the board. The main thing is not to confuse the polarity of the capacitors and not to close adjacent tracks with a soldering iron or solder.


Step 3. We mount the remaining parts: switches and connectors, buttons, LED, quartz. Particular attention should be paid to the side of the diodes and transistors. Quartz has a metal in its structure, so you need to ensure that its surface does not directly contact the tracks of the board or take care of the dielectric lining.

Step 4. 3 connectors are soldered to the display board. After completing the manipulations with the soldering iron, you need to rinse the board with alcohol without auxiliary means - no cotton wool, disks or napkins.

Step 5. Dry the board and check how well the soldering was carried out. Before connecting the shield, you need to solder two jumpers to the board. The existing bitten-off conclusions of the parts will be useful in this.

Step 6. To check the operation, you need to turn on the device in a network with a current of 200 mA and a voltage of 9 V.

The check consists in taking indicators from:

  • Connector 9 V;
  • Reference point 3.3 V.

If all parameters correspond to the required values, you need to disconnect the device from the power supply and install the JP4 jumper.

Step 7. Insert the display into the 3 available connectors. You need to connect the probe for the oscilloscope to the input, turn on the power with your own hands.

The result of proper installation and assembly will be the appearance on the display of its number, type of firmware, its version and the developer's website. After a few seconds it will be possible to observe the sine waves and the scale with the probe turned off.

Computer prefix

When assembling this simple device, you will need a minimum number of parts, knowledge and skills. The circuit diagram is very simple, except that you will need to make the board yourself to assemble the device.

The dimensions of the do-it-yourself oscilloscope attachment will be about the same as a matchbox or a little larger, so it is best to use a plastic container or a battery box of this size.

Having placed the assembled device with ready-made outputs in it, you can begin to organize work with a computer monitor. To do this, download the Oscilloscope and Soundcard Oscilloscope programs. You can test their work and choose the one you like best.

The connected microphone will also be able to relay sound waves to the connected oscillator, the program will reflect the changes. Such a set-top box is connected to a microphone or line input and does not require any additional drivers.

DIY oscilloscope photo


This simple and cheap USB oscilloscope was designed and made just for fun. A long time ago, I had a chance to repair some kind of muddy video processor, in which the input was burned up to the ADC. ADCs turned out to be affordable and inexpensive, I bought a couple just in case, one went to replace it, and the other remained. Recently, he caught my eye and after reading the documentation for it, I decided to use it for something useful in the household. As a result, we got such a device. It cost a penny (well, about 1000 rubles), and a couple of days off. When creating, I tried to reduce the number of parts to a minimum, while maintaining the minimum functionality necessary for an oscilloscope. At first I decided that it turned out to be some kind of painfully frivolous device, however, now I constantly use it, because it turned out to be very convenient - it does not take up space on the table, it easily fits in my pocket (it is the size of a pack of cigarettes) and has quite decent characteristics:

Maximum sampling rate - 6 MHz;
- Input amplifier bandwidth - 0-16 MHz;
- Input divider - from 0.01 V/div to 10 V/div;
- Input resistance - 1 MOhm;
- Resolution - 8 bits.

The schematic diagram of the oscilloscope is shown in Figure 1.

Fig.1 Schematic diagram of the oscilloscope


For various settings and troubleshooting in any power converters, household appliances control circuits, for studying all kinds of devices, etc., where accurate measurements and high frequencies are not required, but you just need to look at the waveform with a frequency of, say, up to a couple of megahertz - more than enough.

The S2 button is part of the hardware needed for the bootloader. If you keep it pressed when connecting the oscilloscope to USB, then the PIC will work in bootloader mode and you can update the oscilloscope firmware using the appropriate utility. As an ADC (IC3), a "television" microcircuit, TDA8708A, was used. It is quite available in all sorts of "Chip and Dip" ah and other places for obtaining parts. In fact, this is not only an ADC for a video signal, but also an input switcher, an equalizer and a white-black level limiter, etc. But all these charms are not used in this design. The ADC is very fast - the sampling rate is 30 MHz. In the circuit, it operates at a clock frequency of 12 MHz - no need for faster, because the PIC18F2550 simply cannot read data faster. And the higher the frequency - the greater the consumption of the ADC. Instead of the TDA8708A, you can use any other fast ADC with parallel data output, such as the TDA8703 or something from Analog Devices.

The clock frequency for the ADC was cunningly extracted from PIC "a - PWM was launched there with a frequency of 12 MHz and a duty cycle of 0.25. The positive polarity clock pulse passes in the Q1 PIC cycle", so that any access to port B that occurs in the Q2 cycle data ADC will be ready. The PIC core operates at a frequency of 48 MHz, received through a PLL from a 4 MHz quartz. The copy command from register to register takes 2 cycles or 8 cycles. Thus, ADC data can be stored in memory with a maximum frequency of 6 MHz using a continuous sequence MOVFF PORTB, POSTINC0 commands One PIC18F2550 RAM bank of 256 bytes is used for the data buffer.

Lower sampling rates are implemented by adding a delay between MOVFF instructions. The firmware implements the simplest synchronization on the negative or positive edge of the input signal. The cycle of collecting data into the buffer is started by a command from the PC via USB, after which this data can be read via USB. As a result, the PC receives 256 8-bit samples, which can, for example, be displayed as an image. The input circuit is simple to disgrace. The input voltage divider without any frills is made on a rotary switch. Unfortunately, it was not possible to figure out how to transfer the switch position to the PIC, therefore, in the graphic face of the oscilloscope, there are only voltage values ​​​​in relative units - scale divisions. The input signal amplifier (IC2B) operates at a gain of 10 times, the zero offset required for the ADC (it accepts a signal in the range from Vcc - 2.41V to Vcc - 1.41V) is provided by the voltage from the PIC programmable voltage reference generator (CVREF IC1, R7, R9) and a divider from the negative supply voltage (R6, R10, R8). Because there was an "extra" amplifier (IC2A) in the op-amp package, I used it as a bias voltage follower.

Do not forget about capacitive circuits for frequency compensation of the input capacitance of your op-amp and limiting diodes that are not on the circuit - you need to select capacitances in parallel with the divider resistors and resistor R1, otherwise the frequency response of the input circuit will ruin the entire bandwidth. With direct current, everything is simple - the input resistance of the op-amp and closed diodes is orders of magnitude higher than the resistance of the divider, so the divider can simply be calculated without taking into account the input resistance of the op-amp. For alternating current, it’s different - the input capacitance of the op-amp and diodes is a significant value compared to the capacitance of the divider. From the resistance of the divider and the input capacitance of the op-amp and diodes, a passive low-pass filter is obtained, which distorts the input signal.

To neutralize this effect, you need to make sure that the input capacitance of the op-amp and diodes becomes much less than the capacitance of the divider. This can be done by building a capacitive divider parallel to the resistive one. It is difficult to calculate such a divisor, because both the input capacitance of the circuit and the mounting capacitance are unknown. It's easier to pick it up.

The selection method is:
1. Put a capacitor with a capacity of approximately 1000 pF in parallel with R18.
2. Select the most sensitive limit, apply rectangular pulses with a frequency of 1 kHz and a span of several divisions of the scale to the input and select a capacitor parallel to R1 so that the rectangles on the screen look like rectangles, without peaks or blockages on the fronts.
3. Repeat the operation for each next limit, selecting capacitors in parallel with each divider resistor according to the limit.
4. Repeat the process from the beginning, and make sure that everything is in order at all limits (the capacitance of mounting capacitors may appear), and, if something is wrong, slightly correct the capacitances.

The op-amp itself is an Analog Devices AD823. The most expensive part of an oscilloscope. :) But on the other hand, the band is 16 MHz - which is quite good. And besides, this is the first of the smart ones that came across in retail for sane money.

Of course, this dual op amp can be changed to something like the LM2904 without any modifications, but then you will have to limit yourself to audio range signals. It will not pull more than 20-30 kHz.

Well, the shape of rectangular, for example, signals will be slightly distorted. But if you manage to find something like OPA2350 (38 MHz), then it will be wonderful on the contrary.

The source of the negative supply voltage for the op-amp is based on the well-known charge-pump ICL7660. Minimum binding and no inductance. The output current of -5 V, of course, is small, but we don’t need much. The power circuits of the analog part are isolated from digital interference by inductances and capacitances (L2, L3, C5, C6). The inductances came across with a nominal value of 180 uH, so I installed them. No power interference even at the most sensitive limit. The PIC firmware is loaded via USB using a bootloader that sits from the 0th address in the program memory and starts if you hold down the S2 button when turned on. So before flashing the PIC - fill in the bootloader there first - it will be easier to change the firmware.
The sources of the oscilloscope driver for kernels 2.6.X are in the archive with the firmware. There is also a console utility for checking the performance of the oscilloscope. Its source code is worth looking at to figure out how to communicate with an oscilloscope if you want to write your own software for it.
The computer program is simple and ascetic, its appearance is shown in Figures 2 and 3. Connect the oscilloscope to USB and start qoscilloscope. Requires QT4.

The oscilloscope on the PIC18F2550 measures the average, maximum, minimum, peak voltage and zero crossing. The oscilloscope has a built-in trigger function that can be used to stop a signal for detailed examination. The time scale for display can be easily changed with the changeTimeDivision function. The oscilloscope measures voltage in the range of 0-5V, 0-2.5V and 0-1.25. The main disadvantage of this oscilloscope is the low sampling rate (~60kHz) as well as the fact that the inputs are limited by the ADC limits of the microcontroller. However, it is a very good device and I recommend watching the video to see it in action.

Scheme

The sources and firmware of the oscilloscope can be found at the bottom of the page. Each circuit block is labeled and will be described in detail below.

Nutrition

Voltage is supplied from a 9V battery to a TC1262-5.0V integrated voltage regulator to provide a stable 5V to power the microcontroller and display. The output is a 1uF capacitor.

Display AGM1264F

Graphic LCD display AGM1264F with a resolution of 128 x 64 pixels with built-in controller KS0108, which allows you to easily control it with a microcontroller. It has an LED backlight and a negative voltage generator to drive the display.

Pin A0 is set to analog input. Note that the signal source resistance affects the analog input offset voltage. The maximum recommended resistance is 2.5 kΩ.

The PIC18F2550 microcontroller operates at a frequency of 48 MHz from an internal oscillator. R1 is the load resistor required for operation. C1 is a stabilizing capacitor. The component marked "RES" is a 20MHz resonator.

RS232 converter

The USART pins must be connected to an RS-232 converter to connect to a PC for firmware upgrade. After that, it can be disabled.

Sources and firmware

The microcontroller must be flashed with the file "SAC_tinybld18F2550usb _20MHz_115200_48MHz".

List of radio elements

Designation Type Denomination Quantity NoteScoreMy notepad
IC1 MK PIC 8-bit

PIC18F2550

1 To notepad
IC2 Linear Regulator

TC1264

1 5 Volt To notepad
C1 Capacitor0.22uF1 To notepad
C2 electrolytic capacitor1 uF1 To notepad
R1 Resistor

3.3 kOhm

1 To notepad
R2 Trimmer resistor10 kOhm1 To notepad
R3 Resistor

5 ohm

1 To notepad
RES Quartz resonator20 MHz1 To notepad
LCD displayAGM1264F1 To notepad
G1 Battery power9 V1 To notepad
JP1 Display connector 1 To notepad
JP2 Plug for firmware updateRS-2321


What else to read