šŸ’» 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
AP7343DAMS1117-3.3TPS73733 (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

MCUSTM32F401STM32F411
Sampling Rate2 KSa/s ā€“ 1.4MSa/s2 KSa/s ā€“ 1.6MSa/s
Bandwidth0.7 MHz1 MHz
Memory Buffer16K samples (2CH) 32K @ 3.8 MSa/s32K samples (2CH) 64K @ 4.2 MSa/s
TriggerHardware ā€“ checked after each complete scan, not centered, may loose samplesHardware, real-time, position within first 500 samples
Modules Supported in HScope280 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 CH340:Ā  ch340_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

HS402_V1.6_F401.bin

HS402_V1.8_F411.bin

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:

STLINKGNDSWCLKSWDIO3.3V
STM32GNDCLKDIO3V3

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

15.32K
0
Dr X 2 years ago #

Very good,.waiting for next part.

0
admin admin 2 years ago #

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

0
Hitesh 1 month ago #

What is maximum frequency it can measure accurately ?

0
admin admin 1 month ago #

I would say up to ~700 kHz, if we talk about rectangular signal.

See the PWM-signal (50% duty cycle) chapter for more details with tests 10 Hz to 1 MHz.

0
jose antonio 1 month ago #

Is there a way to know how to do ADC sampling I tried to do something similar but the signal is lost and it is distorted a lot, will you have any suggestion to replicate something similar of your project ?

Cookies?