Introduction: Medical Ventilator With STONE HMI ESP32

About: I am an embedded engineer working in Beijing. I like to share my projects with you.

The novel coronavirus has caused nearly more than 80 thousand confirmed cases nationwide, and the respirators and respirators are in short supply in recent months. Not only that, but the situation abroad is also not optimistic. The cumulative number of confirmed cases has reached three million and five hundred thousand cases, with a death toll of 240 thousand. As a result, the demand for foreign ventilators is also surging.

So here I decided to make a small project related to the ventilator. It is very convenient to develop with the STONE TFT LCD serial port screen. I use it as the display interface. In addition, I need an external main controller to upload data. Here I chose esp32, which is also a popular chip, and the development is relatively simple.

In this tutorial, you will build a serial port screen project. The screen can interact with MCU, control and generate waveform through esp32, and display it on the screen. This project will be very helpful to collect the patient's respiratory rate waveform.

Step 1: Project Overview

Here we will do a ventilator project. After the ventilator is powered on and turned on, there will be a start-up interface, and the word "open ventilator" will be displayed. Clicking on it will have a click effect, accompanied by a voice prompt, indicating that it has been turned on successfully. Finally, it will jump to a function selection interface. In this interface, we can choose the ventilator mode: CMV PCV SIMV PS CPAP PEEP, If the setting is wrong, you can click Reset, and then click OK to return. Next, click the "vendor waveforms" button, there will be the same button effect, and then enter the heart rate waveform display interface. At this time, the STONE TFT LCD screen will send the serial command, triggering the esp32 MCU to start uploading the waveform data.

That is, the following functions: ① STONE TFT LCD serial port screen to realize button setting ② STONE TFT LCD serial port screen realizes page switching; ③ STONE TFT LCD serial port screen realizes serial port command issuing; ④ STONE TFT LCD serial port screen to display the waveform. Modules required for the project: ① STONE TFT LCD ② Arduino ESP32 ③ Voice play module

Step 2: Hardware Introduction and Principle


Because STONE TFT LCD has an audio driver and reserved corresponding interface, it can use the most common magnet speaker, commonly known as a loudspeaker. The loudspeaker is a kind of transducer which transforms the electrical signal into an acoustic signal. The performance of loudspeaker has a great influence on the sound quality. Loudspeakers are the weakest component in audio equipment, and for audio effect, they are the most important component. There are many kinds of loudspeakers, and the prices vary greatly. Audio electric energy through electromagnetic, piezoelectric, or electrostatic effects, so that it's a paper basin or diaphragm vibration and resonance with the surrounding air (resonance) and produce sound.

l 10.1 inch 1024x600 industrial grade TFT panel and 4-wire resistance touch screen; l brightness is 300cd / m2, LED backlight; l RGB color is 65K; l visual area is 222.7mm * 125.3mm; l visual angle is 70 / 70 / 50 / 60; l working life is 20000 hours. 32-bit cortex-m4 200Hz CPU; l CPLD epm240 TFT-LCD controller; l 128MB (or 1GB) flash memory; l USB port (U disk) download; l toolbox software for GUI design, simple and powerful hex instructions.

Step 3: Basic Functions

Touch screen control / display image / display text / display curve / read and write data / play video and audio. It is suitable for various industries.

UART interface is RS232 / RS485 / TTL; voltage is 6v-35v; power consumption is 3.0w; working temperature is - 20 ℃ / + 70 ℃; air humidity is 60 ℃ 90%. STONE STVC101WT-01 module communicates with MCU through a serial port, which needs to be used in this project. We only need to add the designed UI picture through the upper computer through the menu bar options to buttons, text boxes, background pictures, and page logic, then generate the configuration file, and finally download it to the display screen to run.

The manual can be downloaded through the official website:

Step 4: ESP32 EVB

Esp32 is a single-chip scheme integrated with 2.4 GHz Wi-Fi and Bluetooth dual-mode. It adopts TSMC's ultra-low power consumption 40 nm technology, with ultra-high RF performance, stability, versatility, and reliability, as well as ultra-low power consumption, which meets different power consumption requirements and is suitable for various application scenarios. At present, the product models of esp32 series include esp32-d0wd-v3, esp32-d0wdq6-v3, esp32-d0wd, esp32-d0wdq6, esp32-d2wd, esp32-s0wd and esp32-u4wdh. Esp32-d0wd-v3, esp32-d0wdq6-v3 and esp32-u4wdh are chip models based on Eco v3.

Wi-Fi • 802.11 b/g/n • 802.11 n (2.4 GHz) up to 150 Mbps • wireless multimedia (WMM) • frame aggregation (TX / RX A-MPDU, Rx A-MSDU) • immediate block ACK • defragmentation • beacon automatic monitoring (hardware TSF) • 4x virtual Wi-Fi interface Bluetooth • Bluetooth v4.2 complete standard, including traditional Bluetooth (BR / EDR) and low power Bluetooth (BLE) • supports standard class-1, class-2, and class-3 without external power amplifier • enhanced power control Output power up to +12 dBm • nzif receiver has – 94 DBM ble reception sensitivity • adaptive frequency hopping (AFH) • standard HCI based on SDIO / SPI / UART interface • high-speed UART HCI up to 4 Mbps Support for Bluetooth 4.2 BR / EDR and ble dual-mode controller • synchronous connection-oriented/extended synchronous connection-oriented (SCO / ESCO) • CVSD and SBC audio codec algorithms • piconet and scatternet • multi-device connection with traditional Bluetooth and low power Bluetooth • support simultaneous broadcast and scanning

Step 5: Development Steps

Arduino ESP32

First of all, the development of the software part requires the installation of IDE. Esp32 supports the development and compilation in the Arduino environment, so we need to install the Arduino development tool first. Download IDE IDE Link:

Here we choose according to the actual computer operating system, download and install.
Install Arduino After downloading, double-click to install it. It should be noted that Arduino ide depends on Java development environment and requires a PC to install Java JDK and configure variables. If double-click startup fails, the PC may not have JDK support.

Step 6: Code

The edit command is as shown above, and

Interweave is the button command to enter the oscillogram sent from the identification screen The backlog is the command to exit the oscillogram button sent from the recognition screen Start wave is the initial waveform data sent to the screen. Then click compile, first click the first tick, and then click the second to download the esp32 development board.

Step 7: TOOL 2019

Add picture

Use the installed tool 2019, click the new project in the upper left corner, and then click OK.

After that, a default project will be generated with a blue background by default. Select it and right-click, then select remove to remove the background. Then right-click picture file and click Add to add your own picture background, as follows:

Step 8: Set Picture Function

Firstly, set the boot image, tool - > screen configuration, as follows

Then you need to add a video control to automatically jump after the power-on page stops.

Step 9: Setting of Selection Interface

Here take the first one as an example, set the button effect to page 3, and jump to page 4.

Here you need to set a button freeze effect for each option to indicate the selected option icon.

Step 10: Show

To learn more about this project please visit:STONE TFT LCD + ESP32 +MEDICAL VENTILATOR