📟 HS402 3.0 ANDROID STM32 Oscilloscope PCB and assembling

Image

This article describes how to build android oscilloscope HS402, includes a few ways to flash firmware with PC and Android. 

Electrical circuit

Image

K1, K2 – Solid-state (PhotoMOS) relay for DC/AC choose;
R2, R3 – voltage divider;
D1, D2 – input protection (GND-0.3V; GND+0.3V);
U1, U3 – input signal gain with different coefficient;
U2 – virtual ground (3.3V/2 = 1.65V);

🧾 SCH_HS402-WIFI_V3.0_210327.pdf
🧾 SCH_HS402-WIFI_V3.1_220108.pdf

Components

Image

Full list of components you can look in the .PDF document.Image

Ceramic capacitors C8 and C11 (47 uF) could be rare and expensive, so it can be replaced by 10uF 16V X5R/X7R.

🧾 HS402_Component_List_V3.1.pdf

Power supply options

Option #1 (simplest!) Option #2 Option #3
AP7343D AMS1117-3.3 TPS73733 (v3.0) or RT9193-33GB (v3.1)
Use onboard regulator of STM32 board (shortcut J1 jumper). Separate regulator if supply voltage 5V or more. Allow 3.6V-5V input voltage. Need Vref modification.

Microcontroller

Both modules are pin-to-pin compatible development board, but STM32F411 is more powerful than STM32F401, but it twice as expensive.

Image

MCU STM32F401 STM32F411
Sampling Rate 2 KSa/s – 1.4MSa/s 2 KSa/s – 1.6MSa/s
Bandwidth 0.7 MHz 1 MHz
Memory Buffer 16K samples (2CH) 32K @ 3.8 MSa/s 32K samples (2CH) 64K @ 4.2 MSa/s
Trigger Hardware – checked after each complete scan, not centered, may loose samples Hardware, real-time, position within first 500 samples
Modules Supported in HScope 280 KSa/s (1CH), 140KSa/s (2CH) 280 KSa/s (1CH), 140KSa/s (2CH)

I strongly recommend don't solder module on the board, because if you want to take devboard comeback – it'll be super-hard, so just use PBS connector:

Image

BNC (RF connector)

Presented plastic white BNC connectors are really bad, if you can, replace it with more reliable.

Image

Programmable Amplifier

MCP6S21 is rail-to-rail amplifier with SPI-programmable gain, that allows change voltage range by application.

Image

Solid-state relay

AQY210 is a solid-state relay (PhotoMOS), that have internal LED (input), solar panel (convert light emitting into voltage) and transistor (output).

Image

Voltage Regulator for Virtual Ground

Voltage regulator  AMS1117-1.2 give a chance to get 1.65V (half of 3.3V) for virtual ground, what is require for take input signal polarity in both sides.

Image

PCB

This is 3.0 version of the board. Now is available 3.1 newest and better version.

Image

The Gerber files is available for download and order with PCB factories (current ver. is 3.1)

Image

    💾 PCB_HS402-WIFI_V3.1_220108.zip

Assembling

Before assembling find minimum required components for the oscilloscope by the list and put in case.

Image

You can use soldering iron, but the easies way is using hot air gun. Before mounting you have to prepare PCB pads. If you have solder paste put it on pads manual or with help SMT-stencil, I don't have it, so I must coat pads by using soldering iron.

Image

Don't forget to shortcut J1 jumper, if you use Option #1 power supply.

Image

Then mount leftover THT components with soldering iron.

Image

Settings

Visual inspection

After soldering thoroughly inspect soldering quality and components values.

Image

Check input and output voltage

I use on-board voltage regulator 3.3V (Option #1).

Image

Check input voltage ( GND and 5V) and output (GND and 3V3).

Image

Flashing firmware

There are many ways to load firmware into microcontroller's flash-memory:

USB-TTL converter (Android/PC) STLINK programmer(Android/PC) USB DFU (Android/PC)

USB-TTL converter

Android

The easiest way for you it's to use USB-TTL. I use CH340, you can use: CP2102, FTDI232RL, PL2303HX) converter. CH340 Driver for Windows 10, 11 (must be installed manually): 

Image

💾 Download driver for CH340ch340_driver_win10.zip

Connect it to  STM32 board according to the wire diagram and then to android phone:

Image

Download and install STM32 Utils (from Play Store):

Image

Check connection again and connect it to the phone:

Image

Press both buttons NRST and BOOT0 and connect it to the phone, release first NRST and then BOOT0:

Image

Open application and init chip. Press on blue cube, choose vendor Martinloren and select the last version of the HS402 oscilloscope firmware, press FLASH FW.

Image

Wait for erasing data and writing chosen firmware, that's all.

Image

PC

Also, you can use computer software STM32CubeProgrammer. Download it on official site (need registration), or in telegram.

Image

After connection to the PC open Device Manager and check, that your converter is properly identificated (drivers properly installed).

Image

Press both buttons NRST and BOOT0 and connect it to the phone, release first NRST and then BOOT0:

Image

Open Cube Programmer, choose UART and select COM-port (in my case it's COM5, we have seen it before), press Connect.(If you do previous step wrong, you will see that, disconnect power and press buttons again)

Image

Image

Download firmware binary file (available on  GitHub):

Image

Also you can get reserve copy HS402_V1.8_F411.bin in telegram.

Press Open file and choose it.

Image

Now we have opened binary file, press Download. Wait about 20 seconds and that's all!

Image

Programmer STLINK

PC

The easiest way for me is using programmer-debugger STLINK, connect it appropriate to table:

STLINK GND SWCLK SWDIO 3.3V
STM32 GND CLK DIO 3V3

Check connection and connect it to the PC.

Image

Android

By the way, you can use android application ZFlasher STM32.

Image

USB (in DFU mode)

Another simple way is using DFU (Device Firmware Update) mode.

Image

Connect board to the PC (using USB cable), then press both buttons NRST and BOOT0, release first NRST and then BOOT0 (within 0.5s) to enter load mode:

Image

Choose USB connection and select USB1 port:

Image

Press Connect:

Image

Open Open file and select firmware file (see above where to get), press Download and wait some time.

Image

Android

By the way, you can use android application StmDfuUsb.

Image

First connection

Download and install HScope app from Google Play. The most convenient connection way is is USB Type-C—USB Type-C cable and Android phone with USB-C socket.

Virtual ground tune

Most likely, even if no signal on input you will see non-zero value, don't worry.

Image

Just tune line to zero (must no input signal!) by rotation variable resistor.

Image

Fronts tune

Connect first channel to rectangular waveform signal (use can use PWM output pin), if angle is no acute rotate trimmer capacitor (better use plastic/ceramic screwdriver).

Image

The same tune do with second channel.

Image

Calibration Zero Level

Shortcut ground and first channel input and do zero calibration.

Image

Image

Do the same with second channel.

Ready to use

Generally, the oscilloscope is ready to use, I want to test it on the generator based on comparator.

Test

I have got another STM32, let's generate PWM-signal and observe it with android oscilloscope.

PWM-signal (50% duty cycle)

10 Hz, 100 Hz

Image

10 kHz, 100 kHz

Image

200 kHz, 400 kHz

Image

666 kHz, 1 MHz

Image

Comparator-based relaxation oscillator

Image

RC (Differentiator)

Image

Previously generated signal connected to the input (yellow CH1), output on CH2 (green).

Image

LC (Resonant circuit)

We can see the damped oscillations.

Image

Level trigger (red line) is set, then battery (power supply) connected for a moment.

Image

PWM generator

You also have got a PWM-signal generator with frequency and width regulation.

Image

It can be used for tests or like voltage regulator, if transistor is connected.

Image

Video

Conclusions

As you can see, assembling an HS402 oscilloscope is not difficult at all, but in any case the effort and time invested are considerable.

The most worth of this oscilloscope is possibility to get wireless data transmission to your phone, so you can observe electrical values remotely. To add this feature you need add ESP32 Wi-Fi microcontroller module, I will do this in next part.

Image

2.89K
0
Dr X 6 months ago #

Very good,.waiting for next part.

0
admin admin 5 months ago #

Next part is already available: https://refcircuit.com/articles/16-hs402-wifi-android-oscilloscope-esp32-stm32.html

Cookies?