Close

STONE TFT LCD + ESP32 +MEDICAL VENTILATOR

94754sakura94754sakura wrote 04/29/2021 at 02:05 • 11 min read • Like

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.

Previous rendering:

9-Medical-Ventilator-STONE-HMI-ESP32(1)

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.

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

Block diagram:

9-Medical-Ventilator-STONE-HMI-ESP32(2)

Hardware introduction and principle

Loudspeaker

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.

9-Medical-Ventilator-STONE-HMI-ESP32(3)

STONE STVC101WT-01

•    10.1 inch 1024x600 industrial grade TFT panel and 4-wire resistance touch screen;

•    brightness is 300cd / m2, LED backlight;

•    RGB color is 65K;

•    visual area is 222.7mm * 125.3mm;

•    visual angle is 70 / 70 / 50 / 60;

•    working life is 20000 hours. 32-bit cortex-m4 200Hz CPU;

•    CPLD epm240 TFT-LCD controller;

•    128MB (or 1GB) flash memory;

•    USB port (U disk) download;

•    Toolbox software for GUI design, simple and powerful hex instructions.

 

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.

9-Medical-Ventilator-STONE-HMI-ESP32(4)

9-Medical-Ventilator-STONE-HMI-ESP32(5)

The manual can be downloaded through the official website:

https://www.stoneitech.com/support/download

9-Medical-Ventilator-STONE-HMI-ESP32(6)

In addition to the data manual, there are user manuals, common development tools, drivers, some simple routine demos, video tutorials, and some for testing projects.

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

9-Medical-Ventilator-STONE-HMI-ESP32(7)

9-Medical-Ventilator-STONE-HMI-ESP32(8)

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: https://www.arduino.cc/en/Main/Software

9-Medical-Ventilator-STONE-HMI-ESP32(9)

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 the 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.

Code

9-Medical-Ventilator-STONE-HMI-ESP32(10)

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

The 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.

9-Medical-Ventilator-STONE-HMI-ESP32(11)

TOOL 2019

Add picture

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

9-Medical-Ventilator-STONE-HMI-ESP32(12)

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:

9-Medical-Ventilator-STONE-HMI-ESP32(13)

Set picture function

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

9-Medical-Ventilator-STONE-HMI-ESP32(14)

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

9-Medical-Ventilator-STONE-HMI-ESP32(15)

This is set to jump to page 0.

The setting of a selection interface

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

9-Medical-Ventilator-STONE-HMI-ESP32(16)

9-Medical-Ventilator-STONE-HMI-ESP32(17)

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

Real-time Curve

                                                                                            9-Medical-Ventilator-STONE-HMI-ESP32(18)

Here you need to add a curve control to display the oscillogram. It is mainly used to configure the channel of the data source. Here, select channel 0, the color of the line, the red color, and the interval between the two abscissa points to 25.

The Command is:

uint8_t StartWave[7] = {0xA5, 0x5A, 0x04, 0x84, 0x01, 0x01, 0xFF};

uint8_t CleanWave[6] = {0xA5, 0x5A, 0x03, 0x80, 0xEB, 0x56};

This completes the setting, and then compiles, downloads, and upgrades to the U disk.

9-Medical-Ventilator-STONE-HMI-ESP32(19)

Connection

9-Medical-Ventilator-STONE-HMI-ESP32(20)

9-Medical-Ventilator-STONE-HMI-ESP32(21)

Code

//String temp;

#include

#include "stdlib.h"

HardwareSerial Serial2(2);

uint8_t i = 0, count = 0;

uint8_t StartWaveFlag = 0;

uint8_t EnterWave[9] = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x0E, 0x01, 0x00, 0x01};

uint8_t BackToBg[9] = {0xA5, 0x5A, 0x06, 0x83, 0x02, 0xF1, 0x01, 0x00, 0x02};

uint8_t RecievedTemp[9] = {0};

uint8_t StartWave[7] = {0xA5, 0x5A, 0x04, 0x84, 0x01, 0x01, 0xFF};

uint8_t CleanWave[6] = {0xA5, 0x5A, 0x03, 0x80, 0xEB, 0x56};

char temp;

void setup() {

  // put your setup code here, to run once:

//   Serial.begin(115200);

//   Serial.println("Goouuu HelloWorld!");

   Serial2.begin(115200);

   Serial2.println("Serial2.begin");

   srand(0);

}

void loop() {

  // put your main code here, to run repeatedly:

//    if(Serial.available()!=0)

//    {

//        temp=Serial.read();

//        if(temp=='a')

//        {

//            Serial.println("YESsss!");

//        }

//        

//    }

    if(Serial2.available() != 0)

    {

      for(count = 0; count < 9; count ++)

      {

          RecievedTemp[count] = Serial2.read();

      }

Please contact us if you need a complete procedure:

https://www.stoneitech.com/contact

We will reply to you within 12 hours.

STONE TFT LCD + ESP32 +Medical Ventilator!!!

Appendix

9-Medical-Ventilator-STONE-HMI-ESP32(22)

9-Medical-Ventilator-STONE-HMI-ESP32(23)

9-Medical-Ventilator-STONE-HMI-ESP32(24)

9-Medical-Ventilator-STONE-HMI-ESP32(25)

9-Medical-Ventilator-STONE-HMI-ESP32(26)

9-Medical-Ventilator-STONE-HMI-ESP32(27)

Like

Discussions