eU0Yu

LCSC*Liangshanpai Portable Multifunctional Oscilloscope/Instrument

 
Overview
Project Introduction
This project is a portable multi-functional instrument designed based on the Liangshanpai development board and the matching 4.3-inch RGB touch screen priced at 98 yuan. It has functions such as dual-channel oscilloscope, signal generator, and serial port data viewer. The 148 yuan version will also be open source after the subsequent program is adapted.
The specific usage video has been released on Bilibili. Welcome to watch: [Click to jump to Bilibili physical demonstration video!]
1. The overall system block diagram is as follows:
Some contents of this project refer to the official case of Liangshanpai oscilloscope [oscilloscope expansion board], and supplement and improve it in many aspects to realize the functions of rechargeable portability, dual-channel signal acquisition, 4.3-inch large screen, full touch human-computer interaction, serial port signal viewing (supports Chinese characters) etc.
2. The performance parameters are as follows:
(1) Oscilloscope
① Supports dual-channel maximum ±10V peak-to-peak signal input, sampling rate of 2MSPS, and the measured waveform can be displayed stably.
② Supports one-key Auto function, which automatically adjusts the waveform to the appropriate display conditions.
③ It has a trigger function, which can realize the adjustment of waveform vertical offset, horizontal offset, trigger threshold, etc.
(2) Signal generator
① Supports the output of five waveforms: sine wave, square wave, triangle wave, positive sawtooth wave, and anti-sawtooth wave.
② The output frequency supports continuous adjustment in 1KHZ-50KHZ.
③ The output peak-to-peak value supports continuous adjustment in 0.1V-2.5V.
(3) Serial port data viewer
① Supports adjustment of multiple baud rates.
② Supports text display, HEX data display, and waveform analysis display functions. 
③ Supports receiving and displaying any Chinese characters.
Hardware circuit design
1. Signal coupling circuit
The microcontroller controls the corresponding GPIO high and low levels, thereby controlling the solid-state relay to realize AC/DC coupling of the input signal.
2. Analog Front-End Circuit:
The analog front-end circuit is based on the official case study of the Liangshanpai oscilloscope expansion board. For details, please refer to: [Oscilloscope Expansion Board]
Signal Attenuation Circuit:
Signal Gain Processing and Vertical Shift Circuit:
Signal Generator Circuit.
3. Power Supply Circuit
: An SGM3204 charge pump generates -5V to power the dual power supply of the operational amplifier.
A CJ431 generates 2.5V as the reference voltage for the microcontroller's ADC. Note that the default reference voltage for the Liangshanpai ADC is 3.3V. Therefore, it is absolutely essential to remove the 0-ohm jumper resistor for the corresponding A3.3V AGND on the Liangshanpai; otherwise, the measured data will be incorrect, and the circuit may even be damaged.
An ME2159AM6G is used to boost the lithium battery voltage to 5V.
The lithium battery charging management uses an LP4056HSPF. During charging, an LED will light up to indicate that charging is in progress; the LED will turn off when charging is complete. Due to space constraints, this project uses a 3mm thick, 50mm*60mm 1200mAh lithium battery to power the entire system. Hot melt adhesive is used to install it between the PCB and the RGB screen.
( See Taobao shopping cart link: 77₤WEYTWPyGCsC₤ https://m.tb.cn/h.5uFXj1X CZ3460) I've shared some awesome content with you, come check it out! 4. RGB Screen: This project uses the 4.3-inch RGB screen that comes with the LCSC development board, with an 800*480 pixel resolution, providing a detailed display. Since the LCSC board has a built-in RGB interface, the hardware circuitry does not need to be designed separately. Purchase Link: https://item.szlcsc.com/8351841.html?t=1708862395529&s=1708862395529 5. PCB Design Instructions: Because the width of the 4.3-inch RGB screen exceeds 10cm, the width of the board outline will be shortened to within 10cm to ensure free prototyping. This project's PCB uses a double-layer PCB layout, employing two ground planes, AGND and GND, which are connected by a 0-ohm resistor. LED4 is a charging indicator light, placed near the edge of the board outline. When charging is initiated, the LED lights up; when charging is complete, the LED turns off. Simultaneously, when the board is powered on, charging details can be viewed on the battery icon at the top of the screen. The PCB physical image and interface function descriptions are as follows . A base plate dimension drawing is provided in another PCB file. An acrylic base plate can be customized, and copper pillars can be used to fix it to the back for protection. Function Usage Instructions: 1. Oscilloscope Function Description: The overall UI interface is shown in the figure. All human-computer interaction uses a touch screen, making operation more convenient. Note that the noise level of the sine wave shown in this image is quite high. This is because the entire system was powered by a computer's USB port, and the ripple from the USB power supply is likely large, causing some jitter in the data converted by the ADC. However, this phenomenon is much better when powered by a lithium battery! Observing the UI interface, the top left corner displays the battery level; next is the AUTO button. When the waveform display density is too dense or too sparse, pressing the AUTO button will automatically adjust the ADC sampling rate and vertical voltage gain to adjust the waveform to a suitable display state; the MEASURE button displays the signal acquisition from two channels in a small window; the RUN button starts or pauses sampling; the FFT button displays the spectrum (amplitude spectrum) of the Fast Fourier Transform for the current channel; the UART button switches the serial data viewer interface; pressing the OUT button displays the signal generator window, where the output signal type, frequency, and peak-to-peak value can be adjusted; the right side of the screen has buttons for adjusting the oscilloscope signal acquisition parameters; the two sliders on the left and right can adjust the vertical offset and trigger threshold of the waveform respectively; finally, there is a rotation button in the lower left corner, which rotates the screen. 2. Serial Port Data Viewer Function Description: I have integrated the functions of a serial port assistant from a computer into this instrument. It allows adjustment of the baud rate and different data parsing and display modes, making the serial port assistant portable. In character mode, in addition to receiving ASCII characters, it also receives and displays arbitrary Chinese characters; HEX mode displays received data in hexadecimal format; in waveform mode, the transmitter sends frames in the format "x,x,x,x", which this instrument can parse into waveforms, supporting up to six channels of floating-point waveform parsing (theoretically ten channels are also possible, but the final result may have bugs, as ten channels of data would result in a very long serial port data). An attached Python program generates six sine wave strings and sends them to the serial port, which can be used to test the waveform mode of the serial port data viewer. Software Code Description: 1. Project Structure : The App folder contains oscilloscope function code files, serial port data viewer function code files, and signal generator function code files. The Hardware folder contains various driver files. 2. Parameters








 

 

 

 













The OSC.h and Wave_out.h files define relevant structures that encompass almost all modifiable parameters of the oscilloscope.
The Init_Oscilloscope function allows for convenient initialization of parameters such as sampling channel waveform color, initial sampling rate, initial signal gain, and AC_DC.
3. Screen Touch Control:
The 4.3-inch screen used in this project supports up to 5-point simultaneous touch, but for ease of control, this project only supports single-point touch. As shown in the program below, when the touch_judge variable equals 1, it indicates that the screen has been pressed. Then, touch_x and touch_y are used to determine the area pressed, finally identifying the pressed position and executing the corresponding function. Based on the different touch priorities of each button, the touch position determination is placed in the timer interrupt service function and the corresponding function. Due to my limited experience, I feel this method is somewhat inefficient (or perhaps requires LVGL?). I welcome expert advice and suggestions for simpler and more convenient coding methods.
4. The method for receiving and displaying Chinese data in the serial port data viewer
is more in line with language habits. Since we sometimes use Chinese for serial port data debugging, this project saves the font information to the SPI_Flash on the Liangshanpai board, adding the function of receiving and displaying Chinese serial port data. It has functions such as baud rate adjustment, data parsing mode adjustment, start/stop monitoring data, and clear window. The Chinese display is shown in the figure below.
The steps for flashing the font into the SPI_Flash are simple. Just prepare a 16G or 32G TF card (other capacities haven't been tested, so I don't know if they will work), insert it into a card reader and connect it to the computer. Create a folder named FONT in the root directory of the TF card, decompress the font file (provided in the attachment) and store it there. Then insert the TF card into the TF card slot of the Liangshanpai board, flash the Chinese font flashing program in the attachment, and reset. Next, use a serial port assistant on the computer to monitor the real-time status of the font library writing process. The whole process takes about one or two minutes. When you receive "FLASH font_init success!", the font library writing is complete, and the serial port data viewer can then receive and display Chinese data!
5. Screen Refresh
This project uses EXMC to refresh screen data. After initializing the screen display parameters, simply modifying the screen cache data stored in the external SDRAM will automatically refresh the screen data. Users do not need to manually refresh, which is very convenient, and the display frame rate is also very high. The Liangshanpai has a built-in RGB FPC interface, which can be connected to the screen's RGB interface using a ribbon cable, which is also very convenient.
Since the waveform and some components need to be superimposed on the grid, if the screen display function is called immediately every time the screen display content is changed, the waveform will flicker. Why is this? If you refresh the waveform grid (raster) to the screen first, and then refresh the waveform itself, the previously displayed waveform will be overwritten during the grid refresh process. This will cause a brief period where the waveform is not displayed on the screen. Then, when the waveform is refreshed again, it reappears. This intermittent display of the waveform creates a flickering effect. To address this, a dual-buffering approach is used: Buffer 1 is used for screen refresh, and Buffer 2 is used for temporary pixel data modifications. When an update is needed, Buffer 2 is moved to Buffer 1. However, this is a rather crude approach, using direct copying. This has obvious drawbacks: it blocks CPU operation (on an 800*480 screen), reducing efficiency. Therefore, I welcome suggestions from experts on more efficient display methods (such as alternating between the two buffers for screen display; I tried this, but it didn't work, so frustrating!).
Finally
, I would like to express my sincere gratitude to JLCPCB for providing such a great platform, which has significantly lowered the barrier to entry for electronic design, allowing more people's creative ideas to be transformed into tangible products. "Not making money by selling boards, but taking the cultivation of Chinese engineers as our mission" is LCSC's motto for its development boards. LCSC is not only saying this, but also constantly putting it into practice! I would also like to express my sincere gratitude to Engineers Mo, Wu, Chen, Sister Ju, and Xiao Xu, who patiently answered many of my questions.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-28 17:41:13

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号