HS402 DIY Oscilloscope

HS402 Oscilloscope series are quite good DIY oscilloscopes designed for higher performance respect the HS10X series while keeping the best ratio performance/cost/ease to build.

Power consumption is also one of the lowest in the market (~40mA). They can be used only with HScope app for Android (since version 2.2.7).

Warning

This project is still under test, PCB files may be still updated.

Intro

A 2 Channel oscilloscope based on STM32F4x1 Black Pill development board. It provide long memory buffer and high real-time transfer speed.

Technical Specifications

Channels1 or 2
Input RangeCan be built with one of the following variants:
±5V (fixed) | ±15V (fixed) | ±30V (fixed) | PRO (multiple ranges)
PRO input ranges
±15V, ±7.5V, ±3.25V, ±1.6V, ±480mV
Sampling RateSTM32F401
2 KSa/s – 1.4MSa/s
2.8MSa/s, 3.8 MSa/s not linear rates
STM32F411
2 KSa/s – 1.6MSa/s
3.2MSa/s, 4.2 MSa/s not linear rates
ADC Resolution8-12 Bits (8 bit @ max rate, 10bit @ 100KSa/s, 11bit @ 25KSa/s)
Input NoiseSchematic Option 1
0.4% MAX @ 1.4MSa/s
0.12% MAX @ 140KSa/s (in real-time, 2 Channels, 10 bit)
<0.01% @ 50KSa/s (in real-time, 2 Channels)
Schematic Option 2 (REF2033)
0.17% MAX @ 1.4MSa/s
0.13% MAX @ 800KSa/s
0.09% MAX @ 400KSa/s (10 bit)
0.05% MAX @ 200KSa/s
<0.06% @ 160KSa/s (real-time, 2 Channel, 11 bit)
<0.05% @ 50KSa/s (in real-time, 2 Channels)
BandwidthSTM32F401
700 KHz
STM32F411
1MHz
Input Impedance1 Mohm
Memory BufferSTM32F401
16K samples (half when use 2 channels together)
32K @ 3.8 MSa/s
STM32F411
32K samples (half when use 2 channels together)
64K @ 4.2 MSa/s
TriggerSTM32F401
Hardware – checked after each complete scan, not centered, may loose samples
STM32F411
Hardware, real-time, position within first 500 samples
HW Options Supported– AC/DC Coupling Module
– PWM Output Generator
– Input Buttons Module to control basic oscilloscope functions (eg. Start/Stop, sampling rate,..)
Modules Supported in HScopeAutomotive Module up to*:
STM32F401
280 KSa/s single channel, 140KSa/s with 2 channels
STM32F411
320 KSa/s single channel, 160KSa/s with 2 channels
OS VersionAndroid 7+ (Android 4.4 supported but Automotive Module cannot reach more than 100KSa/s for 1 channel and 50KSa/s for 2 channels)

*performances dependent from Android hardware and OS version. Check required OS Version. Suggested CPU 2.1GHz+

Schematics & Built

Notes

  • Other STM32 development boards can be used, the important is that the main crystal is 25MHz
  • On the schematic are indicated 2 hardware options. One exclude the other.

I2C Modules

HS402 Oscilloscopes allow the integration with other I2C modules for expanding the oscilloscope capabilities.

Input Buttons Module – Option I2C-IN-1

By connecting the PCF8574 module it is possible to have 8 hardware buttons to control the oscilloscope. These are the pin that should be connected to the STM32: GND, VCC (5V), SDA, SCL, INT. Buttons are triggered by connecting the P0-P7 pins to GND.

Button functions

  • P0: Start / Stop
  • P1: Rate up
  • P2: Rate down
  • P3: Fit waveform to screen
  • P4-P7: (not assigned yet)

Firmware v.1.2 Ready for Testing!

First version of the firmware is available in STM32Utils app (in google play). First 10 user who provide photos / screenshot of the working firmware with HScope will get a free license!
(promotion valid until Aug 2020)

Flash the Firmware

The firmware flashing is made with the app STM32 Utils with an OTG adapter connected to the phone and an USB-TLL adapter connected to the OTG adapter. After connecting the phone to the STM32 Black Pill board like in picture, the red led light up.

By pressing the buttons on the Black Pill as in picture, the board enter into the STM boot loader and it is ready to be flashed. On the App:
1) Go to Init Chipset and check that the app read the chipset


2) Go to the Blue Box icon and in the list under vendor Martinloren select HS402 Oscilloscope, select the chipset from the variants (STM32F411 or STM32F401), then FLASH FW.

3) After flashing disconnect the USB-TTL cable from the STM32 board and connect the STM32 to the phone through the OTG cable. Open HScope, the app should show you the signal from Channel 1.

Connection

First Setup / Calibration

When the oscilloscope is connected go in HScope Settings, General - Hardware. Here:

  • Set the Model to HS402 and Input Type to PRO. When you do this change also the option Hardware AC/DC Coupling will be enabled automatically.
  • Disconnect and reconnect the oscilloscope to get the new configurations.

You can also Enable the input buttons if you have installed the corresponding I2C module.

Frequency Calibration

  • Enable the option Enable Reference Signal. With this setting the HS402 will generate a 1kHz square wave on pin B15.
  • Connect the probe to pin B15. Use an high rate, i.e. 450KSa/s and turn the variable capacitor until the rising part of the square wave reproduce a good square. Do this for each channel.

Now the device is calibrated in frequency response.

Offset Calibration

  • (required just for Hardware Option 1) Connect Channel 1 probe to its GND.
  • (required just for Hardware Option 1) Rotate the precision variable resistor (R8) until the software show a DC voltage quite near to 0.
  • For each channel do the Calib Zero Lvl procedure in the Settings -> Calibration.

Multiplier Calibration

For this calibration you need an accurate voltage source, for example 3.3V or 5V from a voltage stabilizer. 5V from USB port is not accurate and should never be used for this calibration. Batteries also should not be used. At least you can use LM7805 or this kind of linear voltage regulators.

  • For each channel do the Calib Multiplier procedure in the Settings -> Calibration.

HW Debugging

Here the tests you can perform in case of issues:

  • Check that PGND is approximately around 1.65V respect GND. A3 and A5 pins (analog inputs) also should be at the same voltage with no input signal is applied.
  • With a multimeter check that there are no shortcuts among the pins B3, B4, B5, B6 (these are connected to the PGA (U1, U3) which are very small and are easy to get shortcuts between the pins).
  • Check that voltage change on C4 and C5 when on HScope you enable/disable AC/DC option on the channels. To check that the AC/DC coupling works just apply a battery to the input. When DC is selected you should read the voltage of the battery, when AC is selected you should read 0V.

Built by Users

Built by Matt (2020, 3D case files available here)

Built by Sebastian (2020)