Arduino Based Control and Data Acquisition System Using Python Graphical User Interface Gui
Arduino Based Control and Data Acquisition System Using Python Graphical User Interface Gui
Arduino Based Control and Data Acquisition System Using Python Graphical User Interface Gui
Abstract: This paper presents the development of a control and data acquisition system for a machines and equipments.The system is highly beneficial
and applicable for internet of things (IoTs) environment. By utilizing the devised system one can sit on a computer and can use a specially made
Graphical User Interface (GUI) to control a process and obtain data through sensors. Tkinter toolbox in Python language libraries is used to create the
GUI, while Arduino acts as intermediary between the system and the computer. The control section of the GUI is used to control speed of two DC motors
through an H-bridge drive module and the data acquisition section is used to obtain data from an accelerometer. The developed system and software is
successfully tested for the speed regulation and acceleration measurement for DC motors. In the system, microcontroller reads data and transmits it to
the computer using USB connection. Once on the computer data is graphically represented then graphs and data can be saved on the computer or
forwarded to another computer using email.
Index terms: Acceleration monitoring, DC motor, graphical user interface, python programming, speed control.
————————————————————
are the best choice of actuators for smart, intelligent and frequency (RF) data acquisition system and storing the data
automated machines and equipment where just an in a database designed using Visual basic. The setup is
electronic control is used to produce any desirable motion, oriented towards improving the remote controlling abilities
speed, force or torque. As shown in figure 2, the speed of the system, while keeping the hardware requirements
regulation and monitoring (through vibration) of the DC minimum. It used IEEE 802.15.4 standard to interface
motor is depicted. sensors with AVR microcontroller and communicated with
computer using ZigBee protocol. A peripheral interface
controller (PIC) microcontroller has been used to
communicate with a computer based MATLAB program
in[14].The PIC microcontroller controlled both the speed
and direction of the DC motor based on the data it received
from the computer using serial communication. The user
entered the desired values of speed and direction to the
computer using a MATLAB based GUI. This system is able
to control both a stepper motor and a DC motor at the same
time using the same program and setup. A speed control
and monitoring system for a DC motor (12 V, 1000 rpm) has
been reported in[15]. Speed control is done with the help of
pulse width modulation (PWM) pins on Arduino board and
H-bridge IC. Feedback speed monitoring is based on
infrared (IR) pair based interrupt monitoring. The
computation on the sensor‘s data are performed by Arduino
board. On the computer side a GUI is developed in C#
language. The user interacts with the program by
controlling the speed using a track bar and observe speed
data in rpm using the text window. In the work discussed
Figure 2. Control and Data Acquisition for our model in[16] a DC motor speed control and monitoring system is
developed. The hardware and software for DC motor speed
control has been produced. The microcontroller has been
3. Literature review connected to the computer using a 32-bit parallel port
Due to the usefulness of DC motors, a lot of work has been connector. There are different maximum speed (rpm) for
done in the past on the control of DC motors. Data different load conditions and based on this information a
acquisition for a process, machine or equipment is also a control algorithm has been developed. The output of the
research field of interest where much work has been given system is observed using the GUI developed in
performed previously. Sensors are employed to obtain LabVIEW and the coding is performed in the Visual Basic.
information on position and speed of a DC motor to form a The speed and direction control of a DC motor has been
closed loop control system in[11]. A GUI is created using discussed in[17]. In this work the GUI has been developed
LabVIEW software and the control is implemented on using visual basic 6.0 programming language on the
hardware using ATMEGA32 microcontroller. It used optical computer. The computer is connected with the PIC18F452
encoders to obtain information on the angular position and microcontroller through a serial communication. The
speed of the motor. This data is transmitted to the computer analysis on the data is performed within the microcontroller
from the microcontroller, via ZigBee protocol, and is then program. The motor speed is varied using the PWM of the
compared with the desired position and speed input by the microcontroller. Speed, direction and ON/OFF state of the
user using GUI. A ZigBee wireless communicator is motor is also controlled with the developed system. This
implemented to wirelessly control the DC motor directly work developed a motor control and data acquisition
from the computer[12]. This work targets industrial system regulate and monitors the machine, process or
environment where wireless communication is an integral equipment. The devised system monitors sensor‘s data
part of the communication system. The computer is values and simultaneouslycan modify motor speed using a
interfaced with a ZigBee wireless communicator. The computer based graphical user interface (GUI). Work has
computer performs analysis on the data and creates a been done previously on such systems, they used different
backup internally providing real-time monitoring, control and controllers, modes of communication and programming
protection of the system. The sensors are interfaced with an languages (for developing GUI) to monitor different working
8-bit AVR microcontroller to take data like voltage, current, parameters of motor operation and control motors based on
winding temperature, rpm and torque, and transmit that data acquired from these sensors. These parameters
information to computer using IEEE 802.15.4 standard and include motor speed, temperature and position. This work
ZigBee protocol. X-CTU software designed to work with RF monitors motor health and safety by analyzing data on
transmitters is used as GUI in the computer. A remote vibrations caused by the motor and by other sources in the
monitoring and control system for DC motor has been environment of the motor. Accelerometer measures the
developed in[13]. The setup involved the design of remote amplitude and frequency of acceleration. Microcontroller
start/stop, control and monitoring system of a DC motor reads data and transmits it to the computer using USB
through computer interface using a ZigBee wireless motor connection. Once on the computer data is graphically
control module. The module also included the continuous represented then graphs and data can be saved on the
online monitoring of the motor‘s parameters, such as, computer or forwarded to another computer using email.
current, voltage, temperature, speed through a radio
125
IJSTR©2021
www.ijstr.org
INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH VO`LUME 10, ISSUE 06, JUNE 2021 ISSN 2277-8616
4. Python Programming
In this work for the computer based graphical user interface
(GUI), a python toolbox tkinter is used. Python is a general
purpose high level programming language favoured by
companies, like Google, because it is easy to use and
much more comprehensive than any other language.
Rather than requiring all desired functionality to be built into
the language's core, Python was designed to be highly
extensible. Python can also be embedded in existing
applications that need a programmable interface. Its Figure 4. Speed Control Display
comprehensive libraries like, matplotlib, pyserial, pylab,
py2exe and tkinter offer the solution to almost any 4.3 Graph Display in GUI
programming problem which any one can think of. Another The two graphs time-vs-acceleration and the frequency-vs-
useful feature of python is the fact that, the code can be acceleration and their options are displayed below the
compiled into an executable exe file that can be utilized on sliders in two different tabs as shown in Figure 5. The graph
almost any computer without having to install python manipulation widget is displayed at the bottom of the graph
libraries on the computer since most operating systems and the graph options, playback, save data and extract data
come with inbuilt python readers. The GUI has the following (from data saved in Arduino), are displayed to the right of
features: the graph. The graphs are updated every 0.1 sec and each
of the graphs has their own separate options. Due to the
4.1 Menus of GUI method of graph generation used by python programming
The program has three main menus as shown in Figure 3. the data is displayed on the graph after a specific time lag.
Using the options menu users can save the data, open or This lag depends upon how much data is displayed at any
close the serial port, set the port address and baud rate for point in time and how long it takes for the graph to update.
serial communication and safely exit the program. Currently, the program has been set to display 5 min of data
Moreover, using the playback menu users can start, stop or and update the data every 30 sec. It must be noted that this
pause any one of the two motors. The help menu provides has no effect on the data being received by the computer,
user with the information how to use this program. i.e., the computer receives real time data without any lag
thus any control algorithm based upon the data will be
executed in without any lag.
(a)
graph toolbar is used to save the graph, then only the graph
currently displayed will be saved. But if the ‗Save Graph‘
button on the right side is used then it will save graph for
the entire data-set currently saved within the computer.
(a)
(b)
(c) Figure 9 is showing the flow chart for the data acquisition.
When the program starts a display is generated. The
display shows options of ―Play‖, ―Pause‖ and ―Stop‖. An
Figure 7. Sending data through email: (a) Sign in message infinite loop is executed until an option is selected. The
box, (b) Email message attachment message box and (c) selection of ―Stop‖ command clears all variables and the
Received email graph is also cleared. The selection of ―Pause‖ command
A flow chart is presented in Figure 8 to show the options keeps the startup menu available. When the command
avaiable for execution for change of motor speed. The ―Play is selected then command is executed, data is
program starts and display is generated. The startup menu transmitted and graph is updated when the data is received.
is displayed that shows three options that is‖ Play‖, ―Pause‖, The user is prompted to save data. If save data option is
and ―Stop‖. When ―Play‖ is selected the timer starts and the selected then data is saved and startup menu is displayed.
motor starts rotating. Option is available for speed change. If save data option is not selected then save graph option is
When speed is changed then the command is executed displayed. Entering a key saves the graph and the startup
only if done is selected otherwise no effect is taking place. menu is displayed again.
The data is transmitted and the startup menu is displayed.
When ―Pause‖ is selected from the startup menu then the
timer is stoped and the motor is stoped and the data is
transmitted. When the third option of ―Stop‖ is selected then
aentered variablesare cleared and the timer and motor are
stoped. The data is transmitted and the startup menu is
displayed.
127
IJSTR©2021
www.ijstr.org
INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH VO`LUME 10, ISSUE 06, JUNE 2021 ISSN 2277-8616
128
IJSTR©2021
www.ijstr.org
INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH VO`LUME 10, ISSUE 06, JUNE 2021 ISSN 2277-8616
Figure 12. Testing the developed system for regulating the these programmers. In terms of mode of communication,
motor speed and monitoring the vibrations: (a) [11], [12], [13]offer an advantage since they use wireless
Experimental setup and (b) close-up view of the setup communication. The works reported in [11] and [16] offer an
advantage in terms of control system since they use the
7. Comparison and discussion more stable closed loop control systems. However, in terms
The developed system is compared with the similar of generalization [this work] provides an advantage since it
systems reported in literature as shown in Table 1. From the is not model specific in terms of speed data, speed control,
data presented in the table, it can be seen that there are uses speed in terms of percentage of full speed rather than
various advantages provided by using different works. In actual speed. Moreover, if talking in term of data backup
terms of programming language [this work] has the clear then [this work] is at an advantage followed by systems
advantage, as by using Python, a portable application can reported by [12] and[13]. While [12] and[13] only create a
be developed that does not require Python to be installed database to save data, [this work] can save the data in
on the computer to operate, also Python language is easy graphical and spreadsheet formats and can also backup the
to learn and use, thus, making modifications to the program data on a server or another computer by using internet to
is easy for new programmers. In terms of controllers send email from one address to another email address,
depending upon the familiarity and preference of where the receiver can archive the mail (in the email server)
programmers, all reported works will be advantageous to or download it on to the computer.
131
IJSTR©2021
www.ijstr.org