打印
[国产单片机]

51单片机示波器

[复制链接]
1708|7
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
happy0god|  楼主 | 2020-12-21 08:59 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
开源的51单片机的简易示波器,下面是我分享的B站老刘的开源作品
Mini-DSO
PreviewThis is a simple oscilloscope made with STC8A8K MCU. Only servral components and easy to bulit. The functions could cover simple measurement.




Specification
  • MCU: STC8A8K64S4A12 @27MHz
  • Display: 0.96" OLED with 128x64 resolution
  • Controller: One EC11 Encoder
  • 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
Material list

STC8A8K64S4A12 MCU x 1SSD1306 OLED(SPI) x 1Resistor:
  • 1W 10k x 1
  • 1/4W 2k x 2
  • 1/4W 10k x 1
  • 1/4W 5k x 1
Capacitor:
  • 47uF x 1
  • 0.01uF x 1
LED x 1EC11 Encoder x 1Toggle Switch x 12-Pin Terminal x 1Socket Strip:
  • 7-Pin x 1
  • 2-Pin x 1
3.7V Li-ion Battery5V Booster Module with charge managementUSB-TTL Downloader



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: 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.
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.
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.

    Tutorial
    • First Version: How to bulit step by step.
      • Bilibili: https://www.bilibili.com/video/BV1ai4y1t79R
      • YouTube: https://youtu.be/c6gBv6Jcz7w
      • Instructables: https://www.instructables.com/id/Make-Your-Own-OscilloscopeMini-DSO-With-STC-MCU-Ea/
    • V0.3: Changes in new version, interduction of interface, operations and functions.
      • Bilibili: https://www.bilibili.com/video/bv1XV411k7UV
      • YouTube: https://youtu.be/-8PadlS7c4c
      • Instructables: https://www.instructables.com/id/Upgrade-DIY-Mini-DSO-to-a-Real-Oscilloscope-With-A/
    Further planSince 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.

Mini-DSO-master.zip

5.13 MB

使用特权

评论回复

相关帖子

沙发
happy0god|  楼主 | 2020-12-21 09:02 | 只看该作者
本帖最后由 happy0god 于 2020-12-21 09:13 编辑

需要看B站的视频,上面有示波器的操作方法,视频下方有GitHub的链接,也可以自己去下载

使用特权

评论回复
板凳
happy0god|  楼主 | 2020-12-21 09:10 | 只看该作者
我是新人,传个图片都传不上去啊,请谅解

使用特权

评论回复
地板
happy0god|  楼主 | 2020-12-21 09:12 | 只看该作者
看一下效果图

IMG_6298.jpg (569.13 KB )

IMG_6298.jpg

使用特权

评论回复
5
LcwSwust| | 2020-12-21 09:24 | 只看该作者
不错不错

使用特权

评论回复
6
LcwSwust| | 2020-12-21 10:40 | 只看该作者
从GetWaveADC函数来看,“自动触发”模式与普通示波器相比还是有区别的,
程序中是直接采集波形,示波器其实应是先类似于“普通触发”模式等待触发,若这个时间内有触发则和“普通触发”的操作相同,若一段时间内无触发则直接采集。
程序我并未看完,上面是我的片面之词,仅供参考。

使用特权

评论回复
7
coody| | 2020-12-21 17:32 | 只看该作者
我也用STC8A8K32S4A12-LQFP44做了示波器,跑33MHz,最高500KHz采样,上升沿或下降触发,自动、标准、单脉冲触发方式,抛物线插补。使用480x320 TFT LCD,屏幕够宽。

还做了一个外挂采样的ADC,采样25MHz。

使用特权

评论回复
8
happy0god|  楼主 | 2020-12-22 08:34 | 只看该作者
coody 发表于 2020-12-21 17:32
我也用STC8A8K32S4A12-LQFP44做了示波器,跑33MHz,最高500KHz采样,上升沿或下降触发,自动、标准、单脉冲 ...

你的源码和资料能够开源一下吗?我也想更换个大屏的玩一下

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

166

帖子

0

粉丝