Skip to content

dgatf/oscilloscope_rp2040

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oscilloscope RP2040 - OpenHantek protocol

An oscilloscope for the RP2040 that implements OpenHantek6022 protocol.

Specifications

  • 2 MS/s
  • 2 channels

Usage

  1. Upload the binary oscilloscope.uf2 to RP2040.

  2. Install OpenHantek. OpenHantek6022 needs to be modified for the RP2040: OpenHantek6022 fork

  3. Launch OpenHantek6022 (modifed version).

Pins

  • Channel 1 -> GPIO 26
  • Channel 2 -> GPIO 27
  • Calibration signal -> GPIO 22
  • No conversion -> GPIO 19
  • Debug enable/disable -> GPIO 18
  • Debug output -> GPIO 16

Without the external circuit, voltage at channels (GPIO 26 & 27) must be between 0 and 3.3V.

Debug output is on GPIO 16 at 57600bps. To enable debug, connect to ground GPIO 18 at boot.

Led is on during the capture process.



External circuit

Configure the input signal from +3.3V-0V to +5V-5V and add AC coupling.

For the gain an opamp could be added, but since we've 12bits ADC on the RP2040, will scale from 12bits value to 8bits. Maximum gain is 16. For bigger gains, use an additionnal opamp before centering the signal.

Signal conversion:

  • Step down from 5V to 3.3V
  • AC/DC coupling
  • Gain (not designed)
  • Center and scale zero voltage to Vcc/2

Materials

  • 1 x IC switch CD4066
  • 1 x op amp LM358
  • 2 x ceramic capacitor 100nF
  • 6 x 10k resistor
  • 2 x 33k resistor
  • 2 x 22k resistor

Delete calibration file, if already copied to config folder.

Pins

  • AC/DC coupling channel 1 -> GPIO 20
  • AC/DC coupling channel 2 -> GPIO 21


Calibration file Openhantek

If not using the external circuit we need to convert the signal from +3.3V-0V to +5V-5V. In order to use the full range (0-255), the conversion is done with the calibration file. Set the offsets to -127 and gains to 0.33

Copy RP2040_0_calibration.ini to ~/.config/OpenHantek/ (linux) or %USERPROFILE%.config\OpenHantek (windows).

If using the external cirucuit, set the offsets to 0 and gains to 1 or delete the calibration file.

Remarks

RP2040 is overclcked to 240MHz. Use at your own risk.

For rates of 1MS/s and higher, some samples are dropped. This is a limitation of the USB full speed of the RP2040.

For rates over 500kS/s, the ADC is overclocked to 240MHz. It is maybe less accurate.

Binaries

References