11 June

Medical Ventilator +STONE LCD + Arduino UNO

Developing for Arduino


Since December 8, 2019, several cases of pneumonia with unknown etiology have been reported in Wuhan City, Hubei Province, China. In recent months, nearly 80000 confirmed cases have been caused in the whole country, and the impact of the epidemic has been expanding. Not only the whole country has been affected, but also the confirmed cases have appeared in the whole world, and the cumulative confirmed cases have reached 3.5 million. At present, the source of infection is uncertain From where, but we can be sure that everyone needs masks very much, and those who are serious need respirators.

So, taking advantage of this hot spot, I also came to do a project about the ventilator, and there was a STONE in my hand TFT serial port screen is very suitable for the display screen of the ventilator. When the screen is available, I need a single-chip microcomputer to process the commands issued by STONE's serial port screen and upload some waveform data in real time. Here I choose a more general and easy to use MCU, Arduino uno single-chip microcomputer, which is widely used and supports many libraries.

The renderings are as follows:

In this project, you can control the Arduino uno development board by using the STONE TFT LCD serial port screen, and carry out data command interaction through serial port communication. The Arduino uno development board can upload a series of waveform data and display it on the serial port screen. This project is very helpful for making the ventilator display screen.

Project Overview

The ventilator project I do here will have a startup animation effect after power on, then enter a startup initial solution interface, and display the word «open». Click it to have a voice effect, prompt to open the ventilator, and jump to the page selection interface, where there will be an animation effect, which is an animation to show the human breath, and there are two options The first is the oscillogram monitoring chart of respiration. The second is the oxygen and respiratory rate monitoring chart. How to display so many oscillograms at the same time is a problem. After clicking enter, STONE TFT LCD will issue a specific command to control MCU to start to upload the waveform data.

The functions are as follows:

① realize button setting;
② Realize voice function;
③ realize page switching;
④ realize real-time waveform transmission.

Modules required for the project:

STONE HMI display
Arduino uno module;
③ voice play module.

Project block diagram

Hardware introduction and principle


Because STONE TFT LCD has audio driver and reserved corresponding interface, it can use the most common magnet speaker, commonly known as loudspeaker. Loudspeaker is a kind of transducer which transforms electrical signal into 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 its paper basin or diaphragm vibration and resonance with the surrounding air (resonance) and produce sound.


  • 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%.

STVC101WT-01 LCD module communicates with MCU through 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

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.

Arduino UNO

Model Arduino Uno
Microcontroller atmega328p
Working voltage 5 V
Input voltage (recommended) 7-12 V
Input voltage (limit) 6-20 V
Digital I / O pin 14
PWM channel 6
Analog input channel (ADC) 6
DC output per I / O 20 mA
3.3V port output capacity 50 mA
Flash 32 KB (0.5 KB for bootstrapper)
Clock speed 16 MHz
On board LED pin 13
Length 68.6 mm
Width 53.4 mm
Weight 25 g



Development steps

Arduino UNO

Download IDE


Link: www.arduino.cc/en/Main/Software

Here, because my computer is win10, I choose the first one and click in


Select just download

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.



Here you need to set the command to identify the serial port screen, and:

  • Enterbreathwave is a button command sent from the recognition screen to enter the breathing interface
  • Breatbacktobg is the button command sent from the recognition screen to exit the breathing interface
  • Enterhearto2wave is the button command to enter the oxygen interface sent from the identification screen
  • Hearto2backtobg is the button command sent from the recognition screen to exit the oxygen interface
  • Startwave is the initial waveform data sent to the screen.
  • Cleanwave is used to clear the waveform data sent to the screen.
  • Then click the tick to compile. After the compilation is completed, click the second arrow icon to download the code into the development board.

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:


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.


Here, it is set to jump to page 0 when the power on page stops, and the number of repetitions is 0, indicating no repetitions.

Setting of selection interface


Here, the first button icon is set. The button effect adopts page 6, and switches to page 3. At the same time, 0x0001 value is sent to Arduino uno MCU to trigger data generation. The setting of the second key is similar, but the key value command is different.

Animation effect settings


Here we add the 1_breath.ico icon made in advance, and set the animation stop value and start value, as well as the stop picture as 1 and the start picture as 4, and set it to not display the background. This is not enough. If you need the animation to move automatically, you need to make the following settings:


Add audio file

After power on at the beginning, when click open. to realize the voice prompt function, you need to add audio file, where the audio file number is 0.


Real-time Curve


Here I have made two waveforms. In order to realize the separate control, I have adopted two data channels, namely channel 1 and channel 2. It is better to set the Y_Central and YD_Central values and colors. And the command is as follows:

uint8_t StartBreathWave[7] = {0xA5, 0x5A, 0x04, 0x84, 0x01, 0x01, 0xFF};
uint8_t CleanBreathWave[6] = {0xA5, 0x5A, 0x03, 0x80, 0xEB, 0x56};
uint8_t StartHeartO2Wave[9] = {0xA5, 0x5A, 0x06, 0x84, 0x06, 0x00, 0xFF, 0x00, 0x22};
uint8_t CleanHeartO2Wave[6] = {0xA5, 0x5A, 0x03, 0x80, 0xEB, 0x55};
This completes the setting, and then compiles, downloads, and upgrades to the U disk.





//#include <HardwareSerial.h>
#include "stdlib.h"
int incomedate = 0;
//#define UBRR2H
//HardwareSerial Serial2(2);
uint8_t i = 0, count = 0;
uint8_t StartBreathWaveFlag = 0;
uint8_t StartHeartO2WaveFlag = 0;

uint8_t EnterBreathWave[9] =    {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x12, 0x01, 0x00, 0x01};//
uint8_t BreathBackToBg[9] =     {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x14, 0x01, 0x00, 0x02};//

uint8_t EnterHeartO2Wave[9] =   {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x13, 0x01, 0x00, 0x03};//
uint8_t HeartO2BackToBg[9] =    {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x15, 0x01, 0x00, 0x04};//

uint8_t RecievedTemp[9] = {0};

uint8_t StartBreathWave[7] = {0xA5, 0x5A, 0x04, 0x84, 0x01, 0x01, 0xFF};//
uint8_t CleanBreathWave[6] = {0xA5, 0x5A, 0x03, 0x80, 0xEB, 0x56};//

uint8_t StartHeartO2Wave[9] = {0xA5, 0x5A, 0x06, 0x84, 0x06, 0x00, 0xFF, 0x00, 0x22};//
uint8_t CleanHeartO2Wave[6] = {0xA5, 0x5A, 0x03, 0x80, 0xEB, 0x55};//

void setup() {

  Serial.begin(115200); //115200


void loop() {

  if (Serial.available() == 9)//
      for(count = 0; count < 9; count ++)
          RecievedTemp[count] = Serial.read();
      if(RecievedTemp[8] == 0x01)
          StartBreathWaveFlag = 1;
          StartHeartO2WaveFlag = 0;
          Serial.write(CleanBreathWave, 6);
      else if(RecievedTemp[8] == 0x02)
          StartBreathWaveFlag = 0;
          Serial.write(CleanBreathWave, 6);
      else if(RecievedTemp[8] == 0x03)
          StartHeartO2WaveFlag = 1;
          StartBreathWaveFlag = 0;
          Serial.write(CleanHeartO2Wave, 6);
      else if(RecievedTemp[8] == 0x04)
          StartHeartO2WaveFlag = 0;
          Serial.write(CleanHeartO2Wave, 6);
  if(StartBreathWaveFlag == 1)
        Serial.write(StartBreathWave, 7);
                i = rand();
            StartBreathWave[6] = i;
  else if(StartHeartO2WaveFlag == 1)
        Serial.write(StartHeartO2Wave, 9);
                i = rand();
            StartHeartO2Wave[6] = i;
            i = rand();
            StartHeartO2Wave[8] = i;
Hubs: Developing for Arduino
381 2
Comments 1