STONE STVC070WT-01 HMI Screen+Arduino+Musical Metronome

  Article Introduction

  Music education has a long history of development. In recent years, with the continuous improvement of China’s economic level, its development trend is extremely rapid. Taking piano, the king of Musical Instruments, as an example, the duration of music education in 2019 reached 5.422 billion yuan, a year-on-year increase of 10.71% compared with 2018. Metronome, as an indispensable auxiliary tool in piano learning, plays a role in cultivating the concept of speed, playing more smoothly, and providing the efficiency of piano practice.

  This paper developed a music metronome based on the Stone-STVC070WT screen. This scheme uses the Stone-STVC070WT HMI screen as the display control platform and the Arduino board as the beat audio output terminal to create a simple and easy-to-use music metronome.

  The realization of the function

  Metronome UI functional interface, providing touch function;
Frequency setting function, which can be adjusted from 40 to 120 times/min with an interval of 10 by touching the button;
Beat setting function. By touching the button, 1/4, 2/4, 3/4, and 4/4 beats can be set by hanging;
Play control function, start or stop the beat execution;
The Arduino board drives the buzzer to realize the audio of the beat;
Serial communication realizes the information exchange between the screen and Arduino.

  System principle and composition

  The system is mainly composed of two parts, front-end display control platform and back-end execution terminal, the specific implementation principle is as follows.

  As a display control platform, the STONE HMI screen is responsible for displaying the UI interface and providing touch buttons. On the other hand, the user’s Settings and play pause instructions are sent to the execution terminal through the serial port.

  19-STONE-STVC070WT-01-HMI-Screen-ARDUINO-Musical-Metronome (3)

  The back-end execution terminal adopts the scheme of Arduino board outward expanding buzzer. First of all, it receives the setting parameters sent by the Stone HMI screen through the serial port, adjusts the beat function accordingly, and then controls the drive of the buzzer according to the play and pause instructions.

  The electrical rhythm principle is relatively simple, through the PWM pin drive buzzer to send out two tones (essentially two frequencies) of sound as strong and weak signals, and the timer controls the frequency of the rhythm.

  The system hardware design

  1. Display control front-end hardware design

  1.1 Stone HMI module

  This paper adopts the HMI screen of Beijing STONE Technology Co., Ltd., the model is STVC70WT-01, which integrates TFT display and touch controller. It includes a processor, control program, drive, flash memory, RS232/RS485/TTL port, touch screen, power supply, etc., is powerful, easy to operate overall display system operating system, can be controlled by any single-chip microcomputer. Have such as text display, image display, curved display, and touch, video, and audio playback functions, enrich the user interface. Built-in flash memory can store data, profiles, images, and more.

  (1) Product characteristics of STVC070WT-01

Controlled by any MCU;
Display pictures/text/curves;
65536 color TFT display;
With/without touch screen;
RS232/RS485/TTL UART interface and USB port;
Wide voltage range;

  (2) Scope of application

  Widely used in various industrial fields, medical beauty equipment, engineering machinery and vehicle equipment, electronic instruments, industrial control systems, power industry, civil electronic equipment, automation equipment, transportation.

  1.2 Electrical connection

  (1) Power supply

  The power supply of the HMI screen is the starting current of 5V and above 600mA, which is generated by the Buck Buck circuit of the back-end data acquisition and processing platform. For details, see the schematic diagram in the next section.

  (2) Communication

  HMI display control terminal uses a UART port to communicate with the back-end platform. Since the model I use is STVC070WT-01 and the tail -x1 (X=0 RS232, X=4 RS485, X=1 TTL), I communicate with it through the UART interface of the TTL, and the baud rate is set to 9600BPS.

  1.3 Development steps

  TFT LCD module with STVC070WT-01 requires only 4 steps:

Using TOOL-2019 development software, designed a group of beautiful “graphical user interfaces”.
Download the edited graphical user interface to the TFT LCD screen through debugging tools.
Connect directly with the customer’s MCU through RS232, RS485, or TTL level.
in the MCU end to write a simple program, let the MCU through the command control of the TFT LCD module (hexadecimal code) nothing more.

  2. Execute the hardware design of the terminal in the background

  2.1 Hardware Composition

  (1) The control circuit adopts Arduino Uno development board.

  STONE-STVC070WT-01-HMI-Screen-ARDUINO-Musical-Metronome

Micro-controller: ATmega328P;
Working voltage: 5V;
Input voltage (recommended) : 7-12V;
Input voltage (limit) : 6-20V;
Analog input pin: 6;
DC current per I/O pin: 40mA;
3.3V pin: 50mA;
Flash memory: 32KB (Atmega328);
EEPROM: 1KB (Atmega328);
Clock speed: 16MHz;

  (2) The buzzer adopts passive buzzer

  STONE-STVC070WT-01-HMI-Screen-ARDUINO-Musical-Metronome

  The buzzer is a kind of electronic sound component, can emit “BEEP” sound, only need a DC power supply, the application is very wide; There are two kinds of buzzer: active buzzer and passive buzzer. The difference is whether there is a shock source inside. We choose a passive buzzer, which needs to be driven by 2K-5K waveform pulse signal to occur.

  2.2 Main control chip

  ATmega328p is a high-performance 8-bit micro-controller produced by AVR Company. It has 32KB ISP FLASH, 1024B EEPROM, 2KB SRAM, 23 GPIO, 3 timers, 10-bit ADC, and USART and SPI interfaces. Its resources are shown as follows.

  1 – UART, 2 – SPI, 1 – I2C;

  1 Input Capture, 1 CCP, 6PWM;

  System software design

  1. Display control front-end software design

  (1) Development process

  First, build the project, and load the required images into the project. Here we make a background image, with “speed” and “beat” options, adjusted by “+” and “-“, plus two play and pause ICO ICONS, to meet the requirements of control.

  Second, the use of TOOL-2019 control production, dynamic correlation relationship;The main controls are: “Text”, “Button”, “Ico”, “Button Return”, “Incremental Adjustment”;

  Third, software simulation, compilation, and generation of executable files;

  Fourth, connect the HMI screen to the PC through debugging tools, and download the executable files to the screen.

  (2) How to establish the control of “speed”

  Set the value display control “Data Variable Display” and name it Speed, and the value of more is “120”. Then place the increment and decrease adjustment control “Incremental Adjustment” around it, and set the increment interval as “10”.

  (3) set the “beat” in the same way

  (4) Realize the rotating play button

  Be clear and give instructions on how communications are to be handled;

  (5) Realize the serial communication control of “play” and “pause”

  2. Software design of back-end execution terminal

  (1) The tone that drives the buzzer to produce the beat

  The Arduino has encapsulated a function called tone() that takes driver pins and frequency as its input parameters. The higher the frequency, the higher the tone and the principle is PWM.

  In order to achieve the beat effect, two sounds are needed. We choose the representative ones, 300Hz, and 600Hz, and the default is 600Hz as the strong beat.

  (2) Set the speed of the beat

  In fact, it is very simple to calculate the tempo Speed, mainly because the Speed is the set value, and the rhythm method is mainly 1/4, 2/4, 3/4, 4/4, that is, the last beat of each bar with enhanced music (600Hz) is OK;

  For example, if the speed is 120 and the beat is 3/4, then the duration of each beat (including buzzing and silence) is 60S ÷120=0.5s, and there are 4 beats in each section. The first 2 beats are 300Hz pianissimo, and the third beat is 600Hz forte.

  The tone ordering is:

  (3) Serial communication

  Initialize the Serial port with Serial. Begin function, write the Serial port like interrupt receiver function and parse function, and declare the Serial port receive buffer char Uart_RX_Buf[9];

  The processing instruction is parsed and executed as follows:

  System operation effect test

  STONE-STVC070WT-01-HMI-Screen-ARDUINO-Musical-Metronome

  Adjust the speed and print instructions synchronously from the serial port. Connect to Arduino and start field operation. The effect is shown in the figure below.

  STONE STVC070WT-01 HMI Screen+Arduino+Musical Metronome

  

   

STONE STVC070WT-01 HMI Screen+Arduino+Musical Metronome