Upgrade DIY Mini DSO to a Real Oscilloscope With Awesome Features

6,383

59

20

Introduction: Upgrade DIY Mini DSO to a Real Oscilloscope With Awesome Features

About: Awesome Electronics Tutorials, Projects and How To´s

Last time I shared how to make a Mini DSO with MCU.

To know how to built it step by step, please refer to my previous instructable:

https://www.instructables.com/id/Make-Your-Own-Osc...

Since many people are interested in this project, I spent some time upgrading it overall. After upgrading, the Mini DSO is more powerful.

Specification:

  • MCU: STC8A8K64S4A12 @27MHz Get it from AliExpress
  • Display: 0.96" OLED with 128x64 resolution Get it from AliExpress
  • Controller: One EC11 Encoder Get it from AliExpress
  • Input: Single Channel
  • Sec/div: 500ms, 200ms, 100ms, 50ms, 20ms, 10ms, 5ms, 2ms, 1ms, 500us, 200us, 100us
    100us only available in Auto Trigger Mode
  • Voltage Range: 0-30V
  • Sampling Rating: 250kHz @100us/div

New features:

  1. Show frequency of waveform
  2. Customize trigger level
  3. Auto, Normal and Single Trigger Mode
  4. Scroll waveform along horizontal or vertical
  5. Adjust OLED brightness in settings

Step 1: Watch the Video!

In this video, I will show you the changes, operations and functions about the new version Mini DSO.

Step 2: Prepare Your Part!

We need to add an indicator for new functions.

Material List:

Step 3: Scheme and Circuit!

The changes in circuit is only to add a LED as indicator.

I will show you the use of the indicator later.

Protection of the circuit:
Last time I made a case with foam. The foam may produce static electricity. This issue need to be paid attention definitely.
This time, I use high temperature tape to do the protection.

Step 4: Download the Code!

Download the package below. There are source code and compiled hex file.

Also, available on GitHub: https://github.com/CreativeLau/Mini-DSO

If you do not want to read the codes, just burn the hex into the MCU.

Use a USB to TTL downloader and STC-ISP software to download the code to MCU.

Connect TXD, RXD and GND.

Download STC-ISP software here: http://www.stcmicro.com/rjxz.html

If the interface of STC-ISP is Chinese, you could click upper left icon to change the language to English.

For the detail configuration of STC-ISP please refer my previous video.

The codes were written in C. Use Keil software to edit and compile it.

Step 5: Introduction of Interface!

Parameters in Main Interface:

Seconds Per Division:

"500ms", "200ms", "100ms", "50ms", "20ms", "10ms","5ms", "2ms", "1ms", "500us", "200us", "100us"

100us only available in Auto Trigger Mode

Voltage Range:

Voltage is 0-30V.

Trigger Level:

Trigger voltage level.

Trigger Slope:

Trigger on Rising or Falling Edge.

Trigger Mode:

Auto Mode, Normal Mode, Single Mode.

Status in Main Interface:

'Run': Sampling Running.

'Stop': Sampling Stopped.

'Fail': The Trigger Level beyond the waveform in Auto Trigger Mode.

'Auto': Auto Voltage Range.

Parameters in Settings Interface:

PMode(Plot Mode): Show waveform in Vector or Dots.

LSB: Sampling Coefficient. Calibrate the sampling voltage by adjusting LSB.

100 times of voltage dividing coefficient. e.g. the resistor for voltage dividing is 10k and 2k, calculate the voltage dividing coefficient (10+2)/2=6. Get the LSB = 6 x 100 = 600.

BRT(Brightness): Adjust OLED Brightness.

Step 6: Introduction of Operations!

All operations are completed by the EC11 Encoder. The input include single click, double click, long press, rotate and rotate while pressing. It seems a little complicated, don't worry, there are details below. The resources of this encoder have been almost exhausted. If there are new features, may need additional input component.

Main Interface - Parameter Mode:

  • Single Click Encoder: Run/Stop sampling
  • Double Click Encoder: Enter Wave Scroll Mode
  • Long Press Encoder: Enter Settings Interface
  • Rotate Encoder: Adjust parameters
  • Rotate Encoder While Pressing: Switch between options
  • Switch Auto and Manual Range: Rotate Encoder clockwise continuous to enter auto range. Rotate Encoder anticlockwise to enter manual range.

Main Interface - Wave Scroll Mode:

  • Single Click Encoder: Run/Stop sampling
  • Double Click Encoder: Enter Parameter Mode
  • Long Press Encoder: Enter Settings Interface
  • Rotate Encoder: Scroll waveform horizontally (only available when sampling stopped)
  • Rotate Encoder While Pressing: Scroll waveform vertically (only available when sampling stopped)

Settings Interface:

  • Single Click Encoder: N/A
  • Double Click Encoder: N/A
  • Long Press Encoder: Return to Main Interface
  • Rotate Encoder: Adjust parameters
  • Rotate Encoder While Pressing: Switch between options

Step 7: Introduction of Functions!

Trigger Level:

For repeating signal, trigger level could make it stable on display. For single-shot signal, trigger level could capture it.

Trigger Slope:

Trigger slope determines whether the trigger point is on the rising or the falling edge of a signal.

Trigger Mode:

  • Auto Mode: Sweep continuous. Single click the encoder to stop or run sampling. If triggered, the waveform will be shown on the display and the trigger position will be put at the center of chart. Otherwise, the waveform will scroll irregular, and 'Fail' will be shown on the display.
  • Normal Mode: When complete pre-sampling, you can input signal. If triggered, waveform shown on the display and waiting for new trigger. If no new trigger, the waveform will be kept.
  • Single Mode: When complete pre-sampling, you can input signal. If triggered, waveform shown on display and stop sampling. User need to single click Encoder to start next sampling.
For Normal Mode and Single Mode, be sure the trigger level has been adjusted correctly, otherwise no waveform will be shown on the display.

Indicator:

Generally, the indicator on means the sampling is running. The more important use is in Single and Normal Trigger Mode, before get into the trigger stage, pre-sampling is required. The indicator will not on during pre-sampling stage. We should not input signal until the indicator comes on. The longer time scale selected, the longer waiting time of pre-sampling.

Save Settings:

When exit settings interface, all parameters in settings and main interface will be saved in EEPROM.

Step 8: Test It!

Test 1:

Capture the waveform during a switching power supply power on.

The waveform on Mini DSO is same as that on DS1052E. Small change in the waveform be captured clearly. The precision of voltage is decent.

Test 2:

Capture the waveform in a circuit measuring inductance and saturation current.

The Trigger Level is only 0.1V and sec/div is 200us. For such a small signal could be triggered, that’s pretty good.

Step 9: Limitation and Issues!

1. Same as the first version, it could not measure negative voltages. The waveform will stop at 0V.

2. If input PWM signal at high speed sampling, the sampling result would jump to maximum frequently. I asked STC engineer about this issue, but didn't get a clear explanation. This jumping issue also related to the quality of each MCU. One piece in my hand is very serious, and other pieces are better. But all of them have the sampling jumping issue.

Step 10: Further Plan!

Since there is sampling jumping issue in STC8A8K, and it is not so popular that hard to find. I decide to transfer this project to STM32. Meanwhile, I will try to find a simple way to measure negative voltage.

If you have advices or requirements about this project, please kindly tell me.

Hope you like it.

Feel free to check out my YouTube Channel: https://www.youtube.com/c/CreativeLau

1 Person Made This Project!

Recommendations

  • Retro Tech Challenge

    Retro Tech Challenge
  • Plastic Challenge

    Plastic Challenge
  • Space Contest

    Space Contest

20 Comments

0
av.bemmelen
av.bemmelen

11 months ago

Hi CreativeLau, Please explain the diode and resistor you used in the TxD and RxD wires to the MCU pins 21 and 22. Because it wasn't mentioned in the articles and without those programming the controller obviously never is going to work?!

0
av.bemmelen
av.bemmelen

Reply 10 months ago

Apparently the diode and resistor are not necessary with the USB to serial adapter cable I used. It was just the VDD that needed to be reconnected before the STC processor was recognized by the STC-ISP program and could be programmed. Because this wasn't mentioned in your article my processors looked dead until I removed the VDD and reconnected it. So luckily they were not defect. Now just the way on how the EC11 potentiometer works is very troublesome. The described manual and other EC11 setting modes don't seem to work. I somehow can't select those. And a Sinus signal doesn't really look as much on my Oled display. Probably I also have to add the battery charger and Lithium cell before the oscilloscope works as was presented. I also haven't seen the Oled brightness adjust option yet either! I used firmware v0.3 programmed at the given 27Mhz STC-ISP frequency. But so far I'm not satisfied with the result.

0
Albertv3
Albertv3

Reply 8 months ago

I completed the mini oscilloscope by connecting the battery and the 5V booster/charger board, but the result is sadly the same. Too much interference in the signal input shown. Even with shorted signal input the signals shown are not at all as to be expected, and neither is the measured battery voltage correctly shown. Adjusting the mini scope with the EC11 is still close to impossible too and I think it was sadly not at all as good as I hoped it to be. The promised improvements don't show and I think it never will work showing any signal as clean as yours did show.
And a sinus signal never seems to be correctly shown (if even only the upper half of the signal).
So I probably will use these parts to make something else with them like a two channel oscilloscope with correct signal presentation. This project sadly needs many more improvements before it really is a useful oscilloscope!

0
andymuller
andymuller

Reply 8 months ago

Exactly the same story for me.... it seems it needs a long long way until reaches to a presume one

0
Albertv3
Albertv3

Reply 8 months ago

Yes sadly it is presented to be more than it proves to be in reality. I do not understand why other builders were able to make a good oscilloscope at all! The scope I got when I finished building it was all but correctly working. I think that CreativeLau did something to calibrate his project or he left out some info that needs to be taken in concideration before everything works as promised? Or it was already something that goes wrong in the MCU programming phase we used? CreativeLau sadly didn't answer to these questions. But seeing his 2 different circuit presentations it seems that there is an error in the project somewhere. So I guess in the end it was just a wasted project on parts. Nothing I can change about that, Andy. Anyway hope we will have more success on building other Instructable projects.

0
artmez
artmez

8 months ago

As for accommodating negative voltage inputs: just use a voltage-to-current converter front end like those used on the single 5V supply AD7892 ADC or many insrumentation amps. This technique has been in use for a long time to allow amplifiers to input signals well beyond their supply rail(s).

0
maverick366
maverick366

1 year ago

Great project! STC8A8K64S4A12 is not available in Turkey, so I am waiting for the STM32 version :) Thanks.

0
ShaggyDog18
ShaggyDog18

1 year ago

Great project!
Yes, please, port it to STM32... BluePill module (STM32F103) would be great!
Thank you!

0
c14nz
c14nz

Question 1 year ago

Hi Lau, really nice functions on the new version. I finally finish my one, I'm still missing the rotary encoder and I'm using a 5V power supply not a battery at the moment.

The problem is that the display is staying on for 10-15 seconds and is shutting down, do you have any idea what can have?

IMG_20200602_000515.jpg
0
CreativeLau
CreativeLau

Reply 1 year ago

Congratulation you have done it.
I am not sure what happened in the display. First to confirm the power supply is stable. Try to add while (1){}; in main function before the original while(1). If it still shut down, try to adjust Multiplex Ratio, pre-charge period and VCOM Deselect Level in OLED_Init function according to SSD1306 datasheet.

0
c14nz
c14nz

Reply 1 year ago

Is working perfectly after I use exactly the same DC-DC converter like you, I think you have implemented a function to save battery that is shutting down the Mini DSO when the voltage is over or under some values.

This is such a nice tool, in the image you can see the wave form of one of my power supply when I power it up. Working perfectly every time.

What I don't see in your video is what BRT in the calibration menu is doing, I see that the value is 10. ( V0.3)

Thank you for all your work on this.

IMG_20200622_230956.jpg
0
GianX
GianX

Reply 1 year ago

Hello. May I ask you what display are you using, and whether the only different part is the display? Did you have to modify the code? Thanks.

0
c14nz
c14nz

Reply 1 year ago

Is the SPI OLED, the original one that the author use. What I did I design an PCB to make it more compact and now I even design a case and 3d printed.

IMG_20200628_121757.jpg
0
CreativeLau
CreativeLau

Reply 1 year ago

BRT is the Brightness of OLED .

0
duchanh11sk
duchanh11sk

1 year ago

Thanks you very much.

0
WilkoL
WilkoL

Question 1 year ago

Hi Lau,
Recently I also made a mini oscilloscope ( https://www.instructables.com/id/Mini-Oscilloscop... ). Just a few days later a saw your DSO project (1 and 2) . I wonder if you can tell me how you did triggering. I tried to read your code, but as I cannot read the comments (I'm from the Netherlands and I can only read Dutch, English and some German) I could not figure out how you did it. Triggering looks very stable, where as my solution is not all that stable.

About negative voltages, take a look at my project, just one simple opamp and an offset (made with pwm) fixes that.

Cheers,
Wilko

0
CreativeLau
CreativeLau

Reply 1 year ago

Really nice project you have done and thanks for your suggestion about measuring negative voltages.
About the trigger, the trigger position was found in the function of GetTriggerPos. In PlotWave function, the trigger position was put at the center of chart. As the input signal is repetitive, the waveform seems stable on the display.

0
WilkoL
WilkoL

Reply 1 year ago

Thanks for your reply. I'll have another good look at the GetTriggerPos, but I was actually hoping you could give a short explanation in words about the method.

In my DSO the triggerpoint is found by comparing the measured value with the wanted trigger level. When such a point is found, the next level in the array is checked whether it is higher or lower than the former, if it is higher the triggerpoint is found.
I have the triggerposition in the beginning of the screen (like it is/was on analog oscilloscopes). Putting it in the middle is a very smart trick!

0
noemi90
noemi90

1 year ago

The project for STM32 would be really appreciated! :)

0
GianX
GianX

Question 1 year ago

Greetings! Is it possible to use a larger display such as a 1.3" 240x240 px 3.3 V display instead - for example: https://www.aliexpress.com/item/32964330867.html - with a 3.3 V voltage regulator? If so, what is the exact supply voltage which feeds the display and what voltage regulator would you recommend? Does the code need to be changed?
Thank you.