11
Research Article Microcontroller-Based Direct Torque Control Servodrive Rafael Rodr´ ıguez-Ponce and Francisco Gustavo Mota-Muñoz Departamento de Ingenier´ ıa Rob´ otica, Universidad Polit´ecnica de Guanajuato, Av. Universidad Sur 1001, Cortazar, Guanajuato 38496, Mexico Correspondence should be addressed to Rafael Rodr´ ıguez-Ponce; [email protected] Received 31 October 2019; Accepted 11 January 2020; Published 8 February 2020 Academic Editor: L. Fortuna Copyright © 2020 Rafael Rodr´ ıguez-Ponce and Francisco Gustavo Mota-Muñoz. is is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Robot technology has become an integral part of the automotive industry in several tasks such as material handling, welding, painting, and part assembly. erefore, the knowledge and skills to control the electric motors in these manipulators are essential for undergraduate electrical engineering students. Currently, the digital signal processor (DSP) is the core chip in industrial motor-control drives; however, the implementation of DSP control algorithms can be quite challenging for an experienced programmer, even more so for the novice. Considerable research has been done on this topic, although authors usually focus on DSP-based motor drives using popular control techniques such as field-oriented control (FOC). Although highly efficient, this approach is usually reserved for postgraduate education due to its complex structure and functionality. In this paper, the authors present a modular servodrive design on a low-cost, general-purpose microcontroller using the direct torque control (DTC) method, an alternative known for greater simplicity and torque response, compared with FOC. e system design was based on Micropython language allowing the software structure to be more manageable and the code to be more understandable. is design will be useful to undergraduates and researchers with interests in motor control design. 1. Introduction It is well known that robotic machines are becoming an extensive and vital part of our everyday life. Especially in manufacturing industries such as the automotive, robotic manipulators are used for a wide variety of applications such as material handling, arc and spot welding, painting, and part assembly, among others. Almost any task, which may be repetitive, difficult, or hazardous for a human being, will usually involve some kind of robotic machinery [1]. For this reason, it is paramount for electrical engineering under- graduate students to learn the fundamentals of industrial servomotor control. To achieve fast and accurate movements in a robot, servomotors are controlled employing high-performance techniques, such as field-oriented control [2, 3]. is method allows control of the motor’s speed while maintaining constant torque. Although FOC is commonly used in in- dustrial motor controls due to high efficiency, its physical implementation can be quite challenging since complicated mathematics is involved. Also, it requires a fast and robust processor and great design efforts [3]. For these reasons, FOC-based servodrive design is a topic usually reserved for graduate or postgraduate engineering education. Direct torque control (DTC) is another high-perfor- mance motor control method which may not be as popular or widely spread as FOC; however, it has many merits such as a more simplistic structure, low computational com- plexity, quick-response time, and a good dynamic perfor- mance [4]. is allows the implementation to require a less powerful processor [5], and a less experienced programmer for the software design. DTC has minor disadvantages compared with FOC, such as difficulty to control the motor at low speeds, variable switching frequency, and high-fre- quency ripple present on flux and torque signals [3]. Several techniques have been proposed to overcome these issues in classical DTC drives; however, the torque dynamics and the simplicity of the algorithm structure are mostly lost [2, 3]. In this paper, the authors present a prototype servo- controller based on the classical DTC technique. e Hindawi Journal of Robotics Volume 2020, Article ID 9152494, 11 pages https://doi.org/10.1155/2020/9152494

ResearchArticle Microcontroller

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Research ArticleMicrocontroller-Based Direct Torque Control Servodrive

Rafael Rodrıguez-Ponce and Francisco Gustavo Mota-Muntildeoz

Departamento de Ingenierıa Robotica Universidad Politecnica de Guanajuato Av Universidad Sur 1001 CortazarGuanajuato 38496 Mexico

Correspondence should be addressed to Rafael Rodrıguez-Ponce rrodriguezupgtoedumx

Received 31 October 2019 Accepted 11 January 2020 Published 8 February 2020

Academic Editor L Fortuna

Copyright copy 2020 Rafael Rodrıguez-Ponce and Francisco Gustavo Mota-Muntildeoz 0is is an open access article distributed underthe Creative Commons Attribution License which permits unrestricted use distribution and reproduction in any mediumprovided the original work is properly cited

Robot technology has become an integral part of the automotive industry in several tasks such as material handling weldingpainting and part assembly 0erefore the knowledge and skills to control the electric motors in these manipulators are essentialfor undergraduate electrical engineering students Currently the digital signal processor (DSP) is the core chip in industrialmotor-control drives however the implementation of DSP control algorithms can be quite challenging for an experiencedprogrammer even more so for the novice Considerable research has been done on this topic although authors usually focus onDSP-based motor drives using popular control techniques such as field-oriented control (FOC) Although highly efficient thisapproach is usually reserved for postgraduate education due to its complex structure and functionality In this paper the authorspresent a modular servodrive design on a low-cost general-purpose microcontroller using the direct torque control (DTC)method an alternative known for greater simplicity and torque response compared with FOC 0e system design was based onMicropython language allowing the software structure to be more manageable and the code to be more understandable 0isdesign will be useful to undergraduates and researchers with interests in motor control design

1 Introduction

It is well known that robotic machines are becoming anextensive and vital part of our everyday life Especially inmanufacturing industries such as the automotive roboticmanipulators are used for a wide variety of applications suchas material handling arc and spot welding painting andpart assembly among others Almost any task which may berepetitive difficult or hazardous for a human being willusually involve some kind of robotic machinery [1] For thisreason it is paramount for electrical engineering under-graduate students to learn the fundamentals of industrialservomotor control

To achieve fast and accurate movements in a robotservomotors are controlled employing high-performancetechniques such as field-oriented control [2 3]0is methodallows control of the motorrsquos speed while maintainingconstant torque Although FOC is commonly used in in-dustrial motor controls due to high efficiency its physicalimplementation can be quite challenging since complicated

mathematics is involved Also it requires a fast and robustprocessor and great design efforts [3] For these reasonsFOC-based servodrive design is a topic usually reserved forgraduate or postgraduate engineering education

Direct torque control (DTC) is another high-perfor-mance motor control method which may not be as popularor widely spread as FOC however it has many merits suchas a more simplistic structure low computational com-plexity quick-response time and a good dynamic perfor-mance [4] 0is allows the implementation to require a lesspowerful processor [5] and a less experienced programmerfor the software design DTC has minor disadvantagescompared with FOC such as difficulty to control the motorat low speeds variable switching frequency and high-fre-quency ripple present on flux and torque signals [3] Severaltechniques have been proposed to overcome these issues inclassical DTC drives however the torque dynamics and thesimplicity of the algorithm structure are mostly lost [2 3]

In this paper the authors present a prototype servo-controller based on the classical DTC technique 0e

HindawiJournal of RoboticsVolume 2020 Article ID 9152494 11 pageshttpsdoiorg10115520209152494

electronic device used is the Espressif ESP32 which is a32 bit low-cost embedded processor For the completecoding of DTC Micropython programming language wasused Experimental results were carried out to validate theeffectiveness of the design 0is allowed for the imple-mentation of an open-source user-friendly controller forpermanent magnet synchronous motors (PMSMs) Al-though the aforementioned disadvantages of the DTCtechnique are present the aim of this project is the design ofa modular DTC test-bed for educational purposes 0is willallow a fundamental understanding of DTC as well as asimplified implementation and experimental verification offuture improvements

2 Motor Control Strategies

Industrial AC motors are used in a wide variety of appli-cations that run at a constant speed regardless of the load forexample fans or pumps But there are also instances where itmay be necessary to control the speed or torque and in thiscase a motor drive is required Currently there are severaltechniques used bymanufacturers for motion control two ofthe most dominating are scalar controls and vector controls[6]

Scalar control is based on mathematical expressions thatdescribe the machine in the steady-state In this type ofcontrol there is no motor feedback therefore torquecontrol is inefficient [7] Speed control is carried out byvarying the voltage and frequency ratio (VHz) so that thisquotient is always constant Although these motor drives aresimple and economical speed regulation is only around 3percent of the motorrsquos base frequency and more than thattorque is greatly diminished [8] For this reason this methodis not adequate for high-precision applications such asindustrial robot manipulators or metal-machining centers

Alternatively vector control techniques such as FOC aremore powerful and efficient although the control algorithmis significantly more complicated than VHz [6] 0ismethodology developed by Blaschke [9] in the early 1970sfor induction machines is a closed-loop system motoroutput signals such as voltage current and shaft position areconstantly monitored to estimate the current and magneticflux spatial vectors 0e basic idea is to reorient these vectorsperpendicular to each other in order to achieve maximumtorque per amp regardless of the motorrsquos speed [3]

Unlike scalar control FOC is based on mathematicalexpressions that describe the steady and transient statemodel of the machine 0is technique not only manipulatesthe magnitude and angular velocity but also controls theinstantaneous position of the spatial vectors of voltagecurrent and magnetic flux allowing a more stable andprecise speed and torque control [2]

Although FOC is a high-performance and well-establishedtechnology widely applied in power electronics it is well knownthat certain features make it difficult to implement in a motordrive For instance it has a cascaded architecture that involvescoordinate-transformation blocks proportional-integral (PI)controllers which containmany parameters to be tuned currentregulators and pulse width modulation (PWM) signal

generators all of which increases implementation complexityand execution time [10] 0erefore FOC usually requires aspecialized electronic device optimized for processing digitalsignals in real time Such a device is usually a DSP since itsarchitecture is enhanced for this kind of task In other cases afield-programmable gate array (FPGA) may also be a goodalternative considering that it is possible to design in it cus-tomized parallel operations to lower execution times [11ndash13]0e main requirement for using these devices is certain ex-pertise in programming languages such as C++ for theDSP forthe FPGA it usually will be either VHDL (Very-High-Speed-ICHardware Descriptive Language) or Verilog [14 15]

3 Classical DTC Principle

DTC is a motor control strategy that works differently thanFOC It was proposed in the mid-1980s by I Takahashi forcontrolling induction motors [16] 0e main idea in DTC isto estimate the stator flux and electromagnetic-torque spatialvectors and control their magnitude separately and inde-pendently with the use of hysteresis controllers [17 18] 0eoutputs of the hysteresis controllers are applied directly to apredefined table to select the optimum voltage vector for thevoltage-source inverter (VSI) With it torque and fluxvectors are controlled directly and maintained within twohysteresis bands [19]

In DTC there is no need for PI or current controllersAlso since DTC is in the stator reference frame no coor-dinate transformation is applied Additionally due to thedirect control feature of torque and flux a PWMmodulatoris not necessary [20ndash22] For these reasons execution time islower and dynamic torque response is higher comparedwith FOC [23] A block diagram of the classical DTCstrategy is shown in Figure 1

31 Torque andFluxEstimation 0eDTC algorithm is quitestraightforward 0e process starts by sensing two lines ofthe three-phase motor current (ia ib) 0e values are con-verted from the stator three-phase reference frame (a b c) toa two-phase reference frame (α β) as

Iα Ia

3

radic

3Ia + 2Ib( 1113857

(1)

0e DC link voltage (Vdc) is also measured and con-verted to a two-phase reference frame together with the lastvector applied to the VSI (Sa Sb Sc) the two-phase voltagereference components are obtained as

Vα Vcd

32Sa minus Sb minus Sc( 1113857

3

radic

3Vdc Sb minus Sc( 1113857

(2)

To estimate the stator magnetic flux vector (ψS) thefollowing expression is applied using stator resistancevoltage and current (Rs Vs Is) as

2 Journal of Robotics

ψS 1113946 VS minus RSIS( 1113857dt (3)

However since the DTC strategy must be implementeddigitally this expression must be formulated as a discreteoperation 0erefore by changing the integration to an ac-cumulated sum and by using the stator voltage and currenttwo-phase reference components it can be rewritten as follows

ψα(n + 1) ψα(n) + Vα(n) minus Rsiα(n)( 1113857Ts (4)

ψβ(n + 1) ψβ(n) + Vβ(n) minus Rsiβ(n)1113872 1113873Ts (5)

where n is the notation to indicate the current discretesample and n+ 1 is the next discrete sample As for Ts itrepresents the sampling time where its value is based onfactors such as microcontroller speed and algorithm exe-cution time

Now by using the flux components calculated in (4) and(5) the total magnitude of the stator flux vector will be

ψs

11138681113868111386811138681113868111386811138681113868

ψα

2 + ψβ2

1113969 (6)

Also the angle of the flux vector can be calculated withthe following expression

θs tanminus 1ψβ

ψα (7)

0is angle is of major importance since it will helpdetermine in which sector the flux vector is located

To estimate the electromagnetic torque the two-phasecurrent and flux frame reference components and the motorpole pairs (p) are used as

Te(n + 1) 34

p ψα(n + 1)iβ(n + 1) minus ψβ(n + 1)iα(n + 1)1113872 1113873

(8)

Once the torque and flux have been estimated they arecompared with their respective reference values to obtain thetorque error (eT) and the flux error (eψ) 0ese error valueswill be the input to the hysteresis comparators

32 Hysteresis Comparators In DTC hysteresis compara-tors are used as a fast and simple equivalent to the PIcontrollers used in FOC 0eir function is to restrict themagnitude of the torque and flux errors to values betweentwo limits Narrow hysteresis bands lead to smooth sinu-soidal current and torque waveforms although they will alsocause high switching frequencies and greater switchinglosses [10] 0erefore the hysteresis comparators must havethe appropriate limits for a good DTC performance

0e flux-controller output (ϕ) has two possible values 0or 1 depending if the flux error (eψ) is under the lower limitor over the upper limit respectively On the contrary thetorque-controller output (τ) has three possible values minus 1 1or 0 depending on if the torque error (eT) is either under thelower limit over the upper limit or between both re-spectively Both hysteresis controllers are shown in Figure 2

0e output values of both controllers together with thespatial placement of the flux vector are used to select theoptimal voltage vector for the VSI from the vector table

33 Optimal Vector Selection 0e flux vector rotation spaceis divided into six equally spaced sectors (1ndash6) containing sixactive vectors (V1 to V6) and two null vectors (V0 and V7)Figure 3 shows how the voltage vectors are distributed ineach sector

To select the optimum vector to apply to the VSI thehysteresis outputs (ϕ τ) are used 0e flux vector angle θs isalso required but only to determine in which sector the fluxvector is located

Both torque and flux can be controlled directly byselecting the appropriate active voltage vector and regulatetheir magnitudes within their respective hysteresis limitsWhen a null vector is applied to the VSI it serves as a softtransition from one switching state to the next Also theyprevent a short circuit in the DC bus due to a delay in theturn-off time of the power switches [24 25]

To understand the effect of the voltage vector on the fluxor torque vector an example is presented In Figure 3 theflux vector ψs is located in sector 1 and is currently rotating

Motor

Optimalvectortable

Estimator

Flux and torque

ree-phase line

SaSbSc

Hysteresiscomparators

Rectifier

Flux position

CurrentVoltage

Vector

VSI

Flux Sector

Torquereference

ESP32

DC link

Power circuit

Torque

+ndash

ndash+

τϕ

Figure 1 Block diagram for the classical DTC strategy

Journal of Robotics 3

counterclockwise From the optimal vector table (Table 1)the vectors that would have a greater impact on both torqueand flux are V2 V3 V5 and V6 Applying V2 would in-crement both the torque and the flux whereas V5 woulddecrease both Instead if V3 is applied it would increase thetorque but would decrease the flux Similarly if V6 is appliedit would increase the flux and decrease the torque ApplyingV1 or V4 would have an impact mostly on the flux vectoreither decreasing or increasing it respectively Lastly ifeither null vector is applied it would slowly decrease bothvectors 0erefore for this example if sector 1 ϕ 1 andτ 1 it can be seen in Table 1 that the vector to be appliedwould be V2

Once the optimal vector is selected it is applied directlyto the VSI for torque and flux correction

4 DTC Servodrive Description

0e DTC servodrive was designed as a customized andmodular test-bed for industrial servocontrol 0e main ideais that each one of the modules may be replaced by anotherwith different types of hardware For example the currentsensor module in this design uses inductive sensors but canbe replaced easily by a Hall-effect sensor module or a shuntresistor module Also the processing module which cur-rently uses a 32 bit microcontroller may be replaced in the

future by a different type of embedded system Even the DTCalgorithm has an open-source architecture so that the mainblocks can be modified or enhanced or even new func-tionalities may be easily added 0e primary reason is to beable to experimentally test and visualize the effects thesechanges have on the motor performance 0e servodrivesystem is shown in Figure 4

A list of the electronic components used in this proto-type is presented in Table 2

41 Current-Voltage Sensing and Signal ConditioningCircuitry One of the most important stages of the DTCprocess starts in current sensing Since the flux and torqueestimations are based on the current values it is necessaryto have a precise current sensor Firstly the currentsignals of two of the motor lines are measured andconverted to a DC signal by adding an offset voltageSecondly the signal is amplified and filtered so it can beconverted to a digital signal using the analog to digitalconverters (ADC) Antialiasing filters are employed toeffectively cut off frequencies higher than about half themaximum frequency of interest

For this project a MURATA 56300C inductive currentsensor was used As shown in Figure 5 the current is sensedpositive offset and amplified using operational amplifiers

To calculate the two-phase reference components for thevoltage the DC power bus must be monitored in case ofvoltage drops For the DC voltage sensing (Figure 6) aresistive divider circuit was used and also amplified usingJFET-Input operational amplifiers Since this voltage is al-ways positive no offset is required 0e signal is scaledamplified and filtered so it can be converted to a digitalsignal

+LfndashLfFlux

Error

ϕ = 0

ϕ = 1

(a)

+Lt

ndashLt Torque

Error

τ = ndash1

τ = 0

τ = 1

(b)

Figure 2 Hysteresis controllers for (a) magnetic flux and (b) electromagnetic torque

Sector 1α

Sector 2Sector 3

Sector 4

Sector 5 Sector 6

Flux hysteresisband

Fluxreference

V1(100)

V2(110)V3(010)

V4(011)

V5(001) V6(101)

V3 V2

V6V5θs

ψs

ωe

β

Figure 3 Active voltage vectors and sectors of the flux vector space

Table 1 List of all optimal vectors for the VSI based on the sectornumber (1ndash6) the torque error (τ) and the flux error (ϕ)

ϕ τSector

1 2 3 4 5 6

ϕ 1τ 1 V2 V3 V4 V5 V6 V1τ 0 V7 V0 V7 V0 V7 V0τ minus 1 V6 V1 V2 V3 V4 V5

ϕ 0τ 1 V3 V4 V5 V6 V1 V2τ 0 V0 V7 V0 V7 V0 V7τ minus 1 V5 V6 V1 V2 V3 V4

4 Journal of Robotics

Table 2 Main electronic components used in the DTC servodrive

Components DescriptionA50l-2001-0232 Diode rectifier bridge FUJI ELECTRIC 800V 30AA501-0001-0230 IGBT power module FUJI ELECTRIC 600V 50AHCGF4A HITACHI electrolytic capacitors 1000 μF 400Vdc surge 450Vdc56300C MURATA current sensor 300 turns 10 A 180ndash335mH 1V 10KHzIR2110 IGBT driver INTERNATIONAL RECTIFIER 500V 2ATL084 JFET-input OPAMPS TEXAS INSTRUMENTSLTC1564 LINEAR antialias filter ICESP32 ESPRESSIF 32 bit microcontroller

Currentsensor

Motor current line

ndashVcc

R1

R2

R3

R4

R5

ndash+

ndash+

R6

R7300Ω

To ADCAntialiasfilter

ndash+

ndash+

Figure 5 Circuitry for current sensing and signal conditioning

100Ω

22Ω 460uFTo ADC

+DC bus

+ndash R1

R2 R4

R3 Antialiasfilter+

ndash

+ndash

+ndash

Figure 6 Circuitry for Vdc sensing and signal conditioning

Figure 4 DTC servodrive prototype including (a) the three-phase rectifier bridge (b) capacitor filters (c) the IGBTpower module (d) theinductive current sensors (e) the IGBT gate drivers (f ) the signal conditioning modules (g) the ESP32 microcontroller and (h) the DCpower supply for low-power integrated circuits

Journal of Robotics 5

42 Power Electronics Circuitry In this stage the three-phase voltage is converted to a DC signal so that it can beconverted back again to a controlled AC signal for themotor For this stage industrial-grade power modules wereused for the rectifier bridge and the VSI (Figure 7) Two1000 μF electrolytic capacitors are connected in parallel forthe DC filtering stage

43 DTC Processing Module 0e processor used for theimplementation of the DTC technique is the ESPRESSIFESP32-WROVER-B 32 bit microcontroller which runs at240MHz ESP32 is a great development board for IoT ap-plications as it is a low-cost device and has many powerfulfeatures (Table 3) ESP32 can be programmed in variousenvironments and programming languages such as ArduinoIDE Espressif-IDF Lua Micropython and CC++

In this project Micropython was used for the design andimplementation of the DTC technique Micropython is areimplementation of Python 3 programming languagetargeted to microcontrollers and embedded systems Bothprogramming languages are very similar Apart from a fewexceptions all the language features of Python are availablein Micropython

0e main reason for using Micropython in the DTCprototype is that today Python is one of the most widely usedsimple and easy to learn programming languages currentlyavailable and well suited for computational analysis and design[26 27] With the emergence of Micropython it becomes easyto program microcontrollers and embedded devices 0ismakes ESP32 and Micropython a great experimental platformfor students teachers and researchers [28]

0e DTC scheme presented previously in Figure 1 wasimplemented in Micropython and the ESP32 with the use ofperipherals such as ADCs DACs (digital to analog con-verters) and timers A summarized workflow of the DTCalgorithm is shown in Figure 8

0e DTC algorithm is programmed in a Micropythoninterrupt service routine (Figure 9) which is triggered every250 μS by the timer Once initiated the current and voltageanalog signals are converted to digital values 0ese valuesare used to estimate flux components flux and torque valuesand then compared with reference values to select the op-timal vector for the VSI Any of these signals can be visu-alized in an external oscilloscope utilizing the internalDACs

5 Experimental Results

0e experimental testing was carried out using a standard1 kW PMSM servo and the main parameters of which aregiven as follows Rs 1557Ω pole pairs p 8 ratedvoltage V 130V rated current I 25 A rated torqueT 27Nm and rated speed ωe 5000RPM

To validate the DTC servodrive performance severaltests were executed with the main focus being on the fluxtorque and current signals If the output signals are similarto the simulated signals then it means that the algorithm hasbeen properly implemented Also the torque output wasmeasured to verify that it is as close as possible to the torquereference value

Although it is important to clarify that the performanceof the DTC algorithm and the quality of the output signalsare directly related to the hysteresis controllers [29 30] Forthis reason most of the tests were made by observing theeffect of the hysteresis bands on the output signals

51 Effects of the Hysteresis Flux Band 0e hysteresis fluxband has a considerable effect on the output signals Forinstance if the band is narrow the switching frequency willbe higher the flux locus will tend to a circular path and thecurrent signal is very close to a sine wave however currentripple will increase since a narrow band will make it easierfor the hysteresis limits to be exceeded On the contrary awide band will lower the ripple content but the switchingfrequency will decrease the flux locus will tend to a hex-agonal path and the current signal is distorted [30] 0iseffect can be observed in simulations (Figure 10) and ex-perimental tests (Figure 11)

0e effect of the flux hysteresis band can also be observedin the current signals When the band is narrow the currentsignal will have greater ripple content but the shape will beclose to a sine wave If instead the band is wider the ripplewill be lower but the signal will be heavily distorted 0isbehavior can be seen in simulations (Figure 12) and theexperimental motor current signal (Figure 13)

52 Effects of the Hysteresis Torque Band 0e width of thehysteresis torque band also has a considerable effect on DTCperformance mainly on the inverter switching frequencyAlthough it also influences the total harmonic distortion

+Vcd

ndashVcd

2000uF

a b cRa

Rb Rc

nree-phaseAC supply

IGBT module 600V 50ARectifier bridge800V 30A

Filter

Motor

Figure 7 Power circuitry for the servodrive system

6 Journal of Robotics

(THD) in the current signals this effect is due to bothhysteresis bands

Firstly the switching frequency is defined as

Fsw Ns

Tf(9)

whereNs is the number of commutations per period and Tf isthe period of the fundamental signal

To observe the effect on the switching frequency bothhysteresis bands were varied In Figure 14 it can be seen thateven though both hysteresis bands affect the switchingfrequency the torque band has a greater influence

As for the THD on the current signal it is defined as

THD

I2 minus I21( 1113857

I21

1113971

(10)

Table 3 ESP32-WROVER-B specifications and peripherals

Components DescriptionCPU Xtensa dual-core 32 bit LX6 240MHz processor Includes ultralow power coprocessorEmbeddedmemory 448KB ROM 4MB SPI flash 8MB PSRAM

Peripherals SD card LED PWM motor PWM IR pulse counter GPIO capacitive touch sensor 2 x ADC 2 x DAC and Hall-effect sensor

Communication Wi-fi (24GHz) Bluetooth 42 CAN bus 20 SPI UART I2C and I2S

Figure 9 Micropython code example for the DTC interrupt service routine

Start

Peripheralsetup

Timerinterrupt

A to Dconversion

Fluxestimation

Torqueestimation

Yes Hysteresiscomparators

Sectorestimation

VectortableVSI

No

D to Aconversion

Yes Scope

CurrentFlux Torque

DIP switchselection

No

Figure 8 DTC algorithm workflow

Journal of Robotics 7

where I is the RMS value of the current and I1 is the RMSvalue of the fundamental harmonic component

Both hysteresis bands were varied but in this case theflux band had a greater influence on the current signaldistortion as shown in Figure 15

53 Output Torque Measurements To validate the torqueperformance of the servocontroller measurements were

made using a 10Nm rotary torque sensor In these tests itwas important to verify that the torque output correspondsto the torque reference and that the ripple content is rela-tively low

Once again the hysteresis bands were varied to observethe effect on the torque signal Since the original DTCscheme with no enhancements was implemented it wasexpected to have relatively high ripple content 0e besttorque performance with the lowest ripple was obtained

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(a)

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(b)

Figure 10 Flux locus simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)Fl

ux ψ

α (W

b)

(a)

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)

Flux

ψα (

Wb)

(b)

Figure 11 Flux locus on the experimental output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(a)

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(b)

Figure 12 Current output simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

8 Journal of Robotics

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

electronic device used is the Espressif ESP32 which is a32 bit low-cost embedded processor For the completecoding of DTC Micropython programming language wasused Experimental results were carried out to validate theeffectiveness of the design 0is allowed for the imple-mentation of an open-source user-friendly controller forpermanent magnet synchronous motors (PMSMs) Al-though the aforementioned disadvantages of the DTCtechnique are present the aim of this project is the design ofa modular DTC test-bed for educational purposes 0is willallow a fundamental understanding of DTC as well as asimplified implementation and experimental verification offuture improvements

2 Motor Control Strategies

Industrial AC motors are used in a wide variety of appli-cations that run at a constant speed regardless of the load forexample fans or pumps But there are also instances where itmay be necessary to control the speed or torque and in thiscase a motor drive is required Currently there are severaltechniques used bymanufacturers for motion control two ofthe most dominating are scalar controls and vector controls[6]

Scalar control is based on mathematical expressions thatdescribe the machine in the steady-state In this type ofcontrol there is no motor feedback therefore torquecontrol is inefficient [7] Speed control is carried out byvarying the voltage and frequency ratio (VHz) so that thisquotient is always constant Although these motor drives aresimple and economical speed regulation is only around 3percent of the motorrsquos base frequency and more than thattorque is greatly diminished [8] For this reason this methodis not adequate for high-precision applications such asindustrial robot manipulators or metal-machining centers

Alternatively vector control techniques such as FOC aremore powerful and efficient although the control algorithmis significantly more complicated than VHz [6] 0ismethodology developed by Blaschke [9] in the early 1970sfor induction machines is a closed-loop system motoroutput signals such as voltage current and shaft position areconstantly monitored to estimate the current and magneticflux spatial vectors 0e basic idea is to reorient these vectorsperpendicular to each other in order to achieve maximumtorque per amp regardless of the motorrsquos speed [3]

Unlike scalar control FOC is based on mathematicalexpressions that describe the steady and transient statemodel of the machine 0is technique not only manipulatesthe magnitude and angular velocity but also controls theinstantaneous position of the spatial vectors of voltagecurrent and magnetic flux allowing a more stable andprecise speed and torque control [2]

Although FOC is a high-performance and well-establishedtechnology widely applied in power electronics it is well knownthat certain features make it difficult to implement in a motordrive For instance it has a cascaded architecture that involvescoordinate-transformation blocks proportional-integral (PI)controllers which containmany parameters to be tuned currentregulators and pulse width modulation (PWM) signal

generators all of which increases implementation complexityand execution time [10] 0erefore FOC usually requires aspecialized electronic device optimized for processing digitalsignals in real time Such a device is usually a DSP since itsarchitecture is enhanced for this kind of task In other cases afield-programmable gate array (FPGA) may also be a goodalternative considering that it is possible to design in it cus-tomized parallel operations to lower execution times [11ndash13]0e main requirement for using these devices is certain ex-pertise in programming languages such as C++ for theDSP forthe FPGA it usually will be either VHDL (Very-High-Speed-ICHardware Descriptive Language) or Verilog [14 15]

3 Classical DTC Principle

DTC is a motor control strategy that works differently thanFOC It was proposed in the mid-1980s by I Takahashi forcontrolling induction motors [16] 0e main idea in DTC isto estimate the stator flux and electromagnetic-torque spatialvectors and control their magnitude separately and inde-pendently with the use of hysteresis controllers [17 18] 0eoutputs of the hysteresis controllers are applied directly to apredefined table to select the optimum voltage vector for thevoltage-source inverter (VSI) With it torque and fluxvectors are controlled directly and maintained within twohysteresis bands [19]

In DTC there is no need for PI or current controllersAlso since DTC is in the stator reference frame no coor-dinate transformation is applied Additionally due to thedirect control feature of torque and flux a PWMmodulatoris not necessary [20ndash22] For these reasons execution time islower and dynamic torque response is higher comparedwith FOC [23] A block diagram of the classical DTCstrategy is shown in Figure 1

31 Torque andFluxEstimation 0eDTC algorithm is quitestraightforward 0e process starts by sensing two lines ofthe three-phase motor current (ia ib) 0e values are con-verted from the stator three-phase reference frame (a b c) toa two-phase reference frame (α β) as

Iα Ia

3

radic

3Ia + 2Ib( 1113857

(1)

0e DC link voltage (Vdc) is also measured and con-verted to a two-phase reference frame together with the lastvector applied to the VSI (Sa Sb Sc) the two-phase voltagereference components are obtained as

Vα Vcd

32Sa minus Sb minus Sc( 1113857

3

radic

3Vdc Sb minus Sc( 1113857

(2)

To estimate the stator magnetic flux vector (ψS) thefollowing expression is applied using stator resistancevoltage and current (Rs Vs Is) as

2 Journal of Robotics

ψS 1113946 VS minus RSIS( 1113857dt (3)

However since the DTC strategy must be implementeddigitally this expression must be formulated as a discreteoperation 0erefore by changing the integration to an ac-cumulated sum and by using the stator voltage and currenttwo-phase reference components it can be rewritten as follows

ψα(n + 1) ψα(n) + Vα(n) minus Rsiα(n)( 1113857Ts (4)

ψβ(n + 1) ψβ(n) + Vβ(n) minus Rsiβ(n)1113872 1113873Ts (5)

where n is the notation to indicate the current discretesample and n+ 1 is the next discrete sample As for Ts itrepresents the sampling time where its value is based onfactors such as microcontroller speed and algorithm exe-cution time

Now by using the flux components calculated in (4) and(5) the total magnitude of the stator flux vector will be

ψs

11138681113868111386811138681113868111386811138681113868

ψα

2 + ψβ2

1113969 (6)

Also the angle of the flux vector can be calculated withthe following expression

θs tanminus 1ψβ

ψα (7)

0is angle is of major importance since it will helpdetermine in which sector the flux vector is located

To estimate the electromagnetic torque the two-phasecurrent and flux frame reference components and the motorpole pairs (p) are used as

Te(n + 1) 34

p ψα(n + 1)iβ(n + 1) minus ψβ(n + 1)iα(n + 1)1113872 1113873

(8)

Once the torque and flux have been estimated they arecompared with their respective reference values to obtain thetorque error (eT) and the flux error (eψ) 0ese error valueswill be the input to the hysteresis comparators

32 Hysteresis Comparators In DTC hysteresis compara-tors are used as a fast and simple equivalent to the PIcontrollers used in FOC 0eir function is to restrict themagnitude of the torque and flux errors to values betweentwo limits Narrow hysteresis bands lead to smooth sinu-soidal current and torque waveforms although they will alsocause high switching frequencies and greater switchinglosses [10] 0erefore the hysteresis comparators must havethe appropriate limits for a good DTC performance

0e flux-controller output (ϕ) has two possible values 0or 1 depending if the flux error (eψ) is under the lower limitor over the upper limit respectively On the contrary thetorque-controller output (τ) has three possible values minus 1 1or 0 depending on if the torque error (eT) is either under thelower limit over the upper limit or between both re-spectively Both hysteresis controllers are shown in Figure 2

0e output values of both controllers together with thespatial placement of the flux vector are used to select theoptimal voltage vector for the VSI from the vector table

33 Optimal Vector Selection 0e flux vector rotation spaceis divided into six equally spaced sectors (1ndash6) containing sixactive vectors (V1 to V6) and two null vectors (V0 and V7)Figure 3 shows how the voltage vectors are distributed ineach sector

To select the optimum vector to apply to the VSI thehysteresis outputs (ϕ τ) are used 0e flux vector angle θs isalso required but only to determine in which sector the fluxvector is located

Both torque and flux can be controlled directly byselecting the appropriate active voltage vector and regulatetheir magnitudes within their respective hysteresis limitsWhen a null vector is applied to the VSI it serves as a softtransition from one switching state to the next Also theyprevent a short circuit in the DC bus due to a delay in theturn-off time of the power switches [24 25]

To understand the effect of the voltage vector on the fluxor torque vector an example is presented In Figure 3 theflux vector ψs is located in sector 1 and is currently rotating

Motor

Optimalvectortable

Estimator

Flux and torque

ree-phase line

SaSbSc

Hysteresiscomparators

Rectifier

Flux position

CurrentVoltage

Vector

VSI

Flux Sector

Torquereference

ESP32

DC link

Power circuit

Torque

+ndash

ndash+

τϕ

Figure 1 Block diagram for the classical DTC strategy

Journal of Robotics 3

counterclockwise From the optimal vector table (Table 1)the vectors that would have a greater impact on both torqueand flux are V2 V3 V5 and V6 Applying V2 would in-crement both the torque and the flux whereas V5 woulddecrease both Instead if V3 is applied it would increase thetorque but would decrease the flux Similarly if V6 is appliedit would increase the flux and decrease the torque ApplyingV1 or V4 would have an impact mostly on the flux vectoreither decreasing or increasing it respectively Lastly ifeither null vector is applied it would slowly decrease bothvectors 0erefore for this example if sector 1 ϕ 1 andτ 1 it can be seen in Table 1 that the vector to be appliedwould be V2

Once the optimal vector is selected it is applied directlyto the VSI for torque and flux correction

4 DTC Servodrive Description

0e DTC servodrive was designed as a customized andmodular test-bed for industrial servocontrol 0e main ideais that each one of the modules may be replaced by anotherwith different types of hardware For example the currentsensor module in this design uses inductive sensors but canbe replaced easily by a Hall-effect sensor module or a shuntresistor module Also the processing module which cur-rently uses a 32 bit microcontroller may be replaced in the

future by a different type of embedded system Even the DTCalgorithm has an open-source architecture so that the mainblocks can be modified or enhanced or even new func-tionalities may be easily added 0e primary reason is to beable to experimentally test and visualize the effects thesechanges have on the motor performance 0e servodrivesystem is shown in Figure 4

A list of the electronic components used in this proto-type is presented in Table 2

41 Current-Voltage Sensing and Signal ConditioningCircuitry One of the most important stages of the DTCprocess starts in current sensing Since the flux and torqueestimations are based on the current values it is necessaryto have a precise current sensor Firstly the currentsignals of two of the motor lines are measured andconverted to a DC signal by adding an offset voltageSecondly the signal is amplified and filtered so it can beconverted to a digital signal using the analog to digitalconverters (ADC) Antialiasing filters are employed toeffectively cut off frequencies higher than about half themaximum frequency of interest

For this project a MURATA 56300C inductive currentsensor was used As shown in Figure 5 the current is sensedpositive offset and amplified using operational amplifiers

To calculate the two-phase reference components for thevoltage the DC power bus must be monitored in case ofvoltage drops For the DC voltage sensing (Figure 6) aresistive divider circuit was used and also amplified usingJFET-Input operational amplifiers Since this voltage is al-ways positive no offset is required 0e signal is scaledamplified and filtered so it can be converted to a digitalsignal

+LfndashLfFlux

Error

ϕ = 0

ϕ = 1

(a)

+Lt

ndashLt Torque

Error

τ = ndash1

τ = 0

τ = 1

(b)

Figure 2 Hysteresis controllers for (a) magnetic flux and (b) electromagnetic torque

Sector 1α

Sector 2Sector 3

Sector 4

Sector 5 Sector 6

Flux hysteresisband

Fluxreference

V1(100)

V2(110)V3(010)

V4(011)

V5(001) V6(101)

V3 V2

V6V5θs

ψs

ωe

β

Figure 3 Active voltage vectors and sectors of the flux vector space

Table 1 List of all optimal vectors for the VSI based on the sectornumber (1ndash6) the torque error (τ) and the flux error (ϕ)

ϕ τSector

1 2 3 4 5 6

ϕ 1τ 1 V2 V3 V4 V5 V6 V1τ 0 V7 V0 V7 V0 V7 V0τ minus 1 V6 V1 V2 V3 V4 V5

ϕ 0τ 1 V3 V4 V5 V6 V1 V2τ 0 V0 V7 V0 V7 V0 V7τ minus 1 V5 V6 V1 V2 V3 V4

4 Journal of Robotics

Table 2 Main electronic components used in the DTC servodrive

Components DescriptionA50l-2001-0232 Diode rectifier bridge FUJI ELECTRIC 800V 30AA501-0001-0230 IGBT power module FUJI ELECTRIC 600V 50AHCGF4A HITACHI electrolytic capacitors 1000 μF 400Vdc surge 450Vdc56300C MURATA current sensor 300 turns 10 A 180ndash335mH 1V 10KHzIR2110 IGBT driver INTERNATIONAL RECTIFIER 500V 2ATL084 JFET-input OPAMPS TEXAS INSTRUMENTSLTC1564 LINEAR antialias filter ICESP32 ESPRESSIF 32 bit microcontroller

Currentsensor

Motor current line

ndashVcc

R1

R2

R3

R4

R5

ndash+

ndash+

R6

R7300Ω

To ADCAntialiasfilter

ndash+

ndash+

Figure 5 Circuitry for current sensing and signal conditioning

100Ω

22Ω 460uFTo ADC

+DC bus

+ndash R1

R2 R4

R3 Antialiasfilter+

ndash

+ndash

+ndash

Figure 6 Circuitry for Vdc sensing and signal conditioning

Figure 4 DTC servodrive prototype including (a) the three-phase rectifier bridge (b) capacitor filters (c) the IGBTpower module (d) theinductive current sensors (e) the IGBT gate drivers (f ) the signal conditioning modules (g) the ESP32 microcontroller and (h) the DCpower supply for low-power integrated circuits

Journal of Robotics 5

42 Power Electronics Circuitry In this stage the three-phase voltage is converted to a DC signal so that it can beconverted back again to a controlled AC signal for themotor For this stage industrial-grade power modules wereused for the rectifier bridge and the VSI (Figure 7) Two1000 μF electrolytic capacitors are connected in parallel forthe DC filtering stage

43 DTC Processing Module 0e processor used for theimplementation of the DTC technique is the ESPRESSIFESP32-WROVER-B 32 bit microcontroller which runs at240MHz ESP32 is a great development board for IoT ap-plications as it is a low-cost device and has many powerfulfeatures (Table 3) ESP32 can be programmed in variousenvironments and programming languages such as ArduinoIDE Espressif-IDF Lua Micropython and CC++

In this project Micropython was used for the design andimplementation of the DTC technique Micropython is areimplementation of Python 3 programming languagetargeted to microcontrollers and embedded systems Bothprogramming languages are very similar Apart from a fewexceptions all the language features of Python are availablein Micropython

0e main reason for using Micropython in the DTCprototype is that today Python is one of the most widely usedsimple and easy to learn programming languages currentlyavailable and well suited for computational analysis and design[26 27] With the emergence of Micropython it becomes easyto program microcontrollers and embedded devices 0ismakes ESP32 and Micropython a great experimental platformfor students teachers and researchers [28]

0e DTC scheme presented previously in Figure 1 wasimplemented in Micropython and the ESP32 with the use ofperipherals such as ADCs DACs (digital to analog con-verters) and timers A summarized workflow of the DTCalgorithm is shown in Figure 8

0e DTC algorithm is programmed in a Micropythoninterrupt service routine (Figure 9) which is triggered every250 μS by the timer Once initiated the current and voltageanalog signals are converted to digital values 0ese valuesare used to estimate flux components flux and torque valuesand then compared with reference values to select the op-timal vector for the VSI Any of these signals can be visu-alized in an external oscilloscope utilizing the internalDACs

5 Experimental Results

0e experimental testing was carried out using a standard1 kW PMSM servo and the main parameters of which aregiven as follows Rs 1557Ω pole pairs p 8 ratedvoltage V 130V rated current I 25 A rated torqueT 27Nm and rated speed ωe 5000RPM

To validate the DTC servodrive performance severaltests were executed with the main focus being on the fluxtorque and current signals If the output signals are similarto the simulated signals then it means that the algorithm hasbeen properly implemented Also the torque output wasmeasured to verify that it is as close as possible to the torquereference value

Although it is important to clarify that the performanceof the DTC algorithm and the quality of the output signalsare directly related to the hysteresis controllers [29 30] Forthis reason most of the tests were made by observing theeffect of the hysteresis bands on the output signals

51 Effects of the Hysteresis Flux Band 0e hysteresis fluxband has a considerable effect on the output signals Forinstance if the band is narrow the switching frequency willbe higher the flux locus will tend to a circular path and thecurrent signal is very close to a sine wave however currentripple will increase since a narrow band will make it easierfor the hysteresis limits to be exceeded On the contrary awide band will lower the ripple content but the switchingfrequency will decrease the flux locus will tend to a hex-agonal path and the current signal is distorted [30] 0iseffect can be observed in simulations (Figure 10) and ex-perimental tests (Figure 11)

0e effect of the flux hysteresis band can also be observedin the current signals When the band is narrow the currentsignal will have greater ripple content but the shape will beclose to a sine wave If instead the band is wider the ripplewill be lower but the signal will be heavily distorted 0isbehavior can be seen in simulations (Figure 12) and theexperimental motor current signal (Figure 13)

52 Effects of the Hysteresis Torque Band 0e width of thehysteresis torque band also has a considerable effect on DTCperformance mainly on the inverter switching frequencyAlthough it also influences the total harmonic distortion

+Vcd

ndashVcd

2000uF

a b cRa

Rb Rc

nree-phaseAC supply

IGBT module 600V 50ARectifier bridge800V 30A

Filter

Motor

Figure 7 Power circuitry for the servodrive system

6 Journal of Robotics

(THD) in the current signals this effect is due to bothhysteresis bands

Firstly the switching frequency is defined as

Fsw Ns

Tf(9)

whereNs is the number of commutations per period and Tf isthe period of the fundamental signal

To observe the effect on the switching frequency bothhysteresis bands were varied In Figure 14 it can be seen thateven though both hysteresis bands affect the switchingfrequency the torque band has a greater influence

As for the THD on the current signal it is defined as

THD

I2 minus I21( 1113857

I21

1113971

(10)

Table 3 ESP32-WROVER-B specifications and peripherals

Components DescriptionCPU Xtensa dual-core 32 bit LX6 240MHz processor Includes ultralow power coprocessorEmbeddedmemory 448KB ROM 4MB SPI flash 8MB PSRAM

Peripherals SD card LED PWM motor PWM IR pulse counter GPIO capacitive touch sensor 2 x ADC 2 x DAC and Hall-effect sensor

Communication Wi-fi (24GHz) Bluetooth 42 CAN bus 20 SPI UART I2C and I2S

Figure 9 Micropython code example for the DTC interrupt service routine

Start

Peripheralsetup

Timerinterrupt

A to Dconversion

Fluxestimation

Torqueestimation

Yes Hysteresiscomparators

Sectorestimation

VectortableVSI

No

D to Aconversion

Yes Scope

CurrentFlux Torque

DIP switchselection

No

Figure 8 DTC algorithm workflow

Journal of Robotics 7

where I is the RMS value of the current and I1 is the RMSvalue of the fundamental harmonic component

Both hysteresis bands were varied but in this case theflux band had a greater influence on the current signaldistortion as shown in Figure 15

53 Output Torque Measurements To validate the torqueperformance of the servocontroller measurements were

made using a 10Nm rotary torque sensor In these tests itwas important to verify that the torque output correspondsto the torque reference and that the ripple content is rela-tively low

Once again the hysteresis bands were varied to observethe effect on the torque signal Since the original DTCscheme with no enhancements was implemented it wasexpected to have relatively high ripple content 0e besttorque performance with the lowest ripple was obtained

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(a)

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(b)

Figure 10 Flux locus simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)Fl

ux ψ

α (W

b)

(a)

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)

Flux

ψα (

Wb)

(b)

Figure 11 Flux locus on the experimental output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(a)

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(b)

Figure 12 Current output simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

8 Journal of Robotics

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

ψS 1113946 VS minus RSIS( 1113857dt (3)

However since the DTC strategy must be implementeddigitally this expression must be formulated as a discreteoperation 0erefore by changing the integration to an ac-cumulated sum and by using the stator voltage and currenttwo-phase reference components it can be rewritten as follows

ψα(n + 1) ψα(n) + Vα(n) minus Rsiα(n)( 1113857Ts (4)

ψβ(n + 1) ψβ(n) + Vβ(n) minus Rsiβ(n)1113872 1113873Ts (5)

where n is the notation to indicate the current discretesample and n+ 1 is the next discrete sample As for Ts itrepresents the sampling time where its value is based onfactors such as microcontroller speed and algorithm exe-cution time

Now by using the flux components calculated in (4) and(5) the total magnitude of the stator flux vector will be

ψs

11138681113868111386811138681113868111386811138681113868

ψα

2 + ψβ2

1113969 (6)

Also the angle of the flux vector can be calculated withthe following expression

θs tanminus 1ψβ

ψα (7)

0is angle is of major importance since it will helpdetermine in which sector the flux vector is located

To estimate the electromagnetic torque the two-phasecurrent and flux frame reference components and the motorpole pairs (p) are used as

Te(n + 1) 34

p ψα(n + 1)iβ(n + 1) minus ψβ(n + 1)iα(n + 1)1113872 1113873

(8)

Once the torque and flux have been estimated they arecompared with their respective reference values to obtain thetorque error (eT) and the flux error (eψ) 0ese error valueswill be the input to the hysteresis comparators

32 Hysteresis Comparators In DTC hysteresis compara-tors are used as a fast and simple equivalent to the PIcontrollers used in FOC 0eir function is to restrict themagnitude of the torque and flux errors to values betweentwo limits Narrow hysteresis bands lead to smooth sinu-soidal current and torque waveforms although they will alsocause high switching frequencies and greater switchinglosses [10] 0erefore the hysteresis comparators must havethe appropriate limits for a good DTC performance

0e flux-controller output (ϕ) has two possible values 0or 1 depending if the flux error (eψ) is under the lower limitor over the upper limit respectively On the contrary thetorque-controller output (τ) has three possible values minus 1 1or 0 depending on if the torque error (eT) is either under thelower limit over the upper limit or between both re-spectively Both hysteresis controllers are shown in Figure 2

0e output values of both controllers together with thespatial placement of the flux vector are used to select theoptimal voltage vector for the VSI from the vector table

33 Optimal Vector Selection 0e flux vector rotation spaceis divided into six equally spaced sectors (1ndash6) containing sixactive vectors (V1 to V6) and two null vectors (V0 and V7)Figure 3 shows how the voltage vectors are distributed ineach sector

To select the optimum vector to apply to the VSI thehysteresis outputs (ϕ τ) are used 0e flux vector angle θs isalso required but only to determine in which sector the fluxvector is located

Both torque and flux can be controlled directly byselecting the appropriate active voltage vector and regulatetheir magnitudes within their respective hysteresis limitsWhen a null vector is applied to the VSI it serves as a softtransition from one switching state to the next Also theyprevent a short circuit in the DC bus due to a delay in theturn-off time of the power switches [24 25]

To understand the effect of the voltage vector on the fluxor torque vector an example is presented In Figure 3 theflux vector ψs is located in sector 1 and is currently rotating

Motor

Optimalvectortable

Estimator

Flux and torque

ree-phase line

SaSbSc

Hysteresiscomparators

Rectifier

Flux position

CurrentVoltage

Vector

VSI

Flux Sector

Torquereference

ESP32

DC link

Power circuit

Torque

+ndash

ndash+

τϕ

Figure 1 Block diagram for the classical DTC strategy

Journal of Robotics 3

counterclockwise From the optimal vector table (Table 1)the vectors that would have a greater impact on both torqueand flux are V2 V3 V5 and V6 Applying V2 would in-crement both the torque and the flux whereas V5 woulddecrease both Instead if V3 is applied it would increase thetorque but would decrease the flux Similarly if V6 is appliedit would increase the flux and decrease the torque ApplyingV1 or V4 would have an impact mostly on the flux vectoreither decreasing or increasing it respectively Lastly ifeither null vector is applied it would slowly decrease bothvectors 0erefore for this example if sector 1 ϕ 1 andτ 1 it can be seen in Table 1 that the vector to be appliedwould be V2

Once the optimal vector is selected it is applied directlyto the VSI for torque and flux correction

4 DTC Servodrive Description

0e DTC servodrive was designed as a customized andmodular test-bed for industrial servocontrol 0e main ideais that each one of the modules may be replaced by anotherwith different types of hardware For example the currentsensor module in this design uses inductive sensors but canbe replaced easily by a Hall-effect sensor module or a shuntresistor module Also the processing module which cur-rently uses a 32 bit microcontroller may be replaced in the

future by a different type of embedded system Even the DTCalgorithm has an open-source architecture so that the mainblocks can be modified or enhanced or even new func-tionalities may be easily added 0e primary reason is to beable to experimentally test and visualize the effects thesechanges have on the motor performance 0e servodrivesystem is shown in Figure 4

A list of the electronic components used in this proto-type is presented in Table 2

41 Current-Voltage Sensing and Signal ConditioningCircuitry One of the most important stages of the DTCprocess starts in current sensing Since the flux and torqueestimations are based on the current values it is necessaryto have a precise current sensor Firstly the currentsignals of two of the motor lines are measured andconverted to a DC signal by adding an offset voltageSecondly the signal is amplified and filtered so it can beconverted to a digital signal using the analog to digitalconverters (ADC) Antialiasing filters are employed toeffectively cut off frequencies higher than about half themaximum frequency of interest

For this project a MURATA 56300C inductive currentsensor was used As shown in Figure 5 the current is sensedpositive offset and amplified using operational amplifiers

To calculate the two-phase reference components for thevoltage the DC power bus must be monitored in case ofvoltage drops For the DC voltage sensing (Figure 6) aresistive divider circuit was used and also amplified usingJFET-Input operational amplifiers Since this voltage is al-ways positive no offset is required 0e signal is scaledamplified and filtered so it can be converted to a digitalsignal

+LfndashLfFlux

Error

ϕ = 0

ϕ = 1

(a)

+Lt

ndashLt Torque

Error

τ = ndash1

τ = 0

τ = 1

(b)

Figure 2 Hysteresis controllers for (a) magnetic flux and (b) electromagnetic torque

Sector 1α

Sector 2Sector 3

Sector 4

Sector 5 Sector 6

Flux hysteresisband

Fluxreference

V1(100)

V2(110)V3(010)

V4(011)

V5(001) V6(101)

V3 V2

V6V5θs

ψs

ωe

β

Figure 3 Active voltage vectors and sectors of the flux vector space

Table 1 List of all optimal vectors for the VSI based on the sectornumber (1ndash6) the torque error (τ) and the flux error (ϕ)

ϕ τSector

1 2 3 4 5 6

ϕ 1τ 1 V2 V3 V4 V5 V6 V1τ 0 V7 V0 V7 V0 V7 V0τ minus 1 V6 V1 V2 V3 V4 V5

ϕ 0τ 1 V3 V4 V5 V6 V1 V2τ 0 V0 V7 V0 V7 V0 V7τ minus 1 V5 V6 V1 V2 V3 V4

4 Journal of Robotics

Table 2 Main electronic components used in the DTC servodrive

Components DescriptionA50l-2001-0232 Diode rectifier bridge FUJI ELECTRIC 800V 30AA501-0001-0230 IGBT power module FUJI ELECTRIC 600V 50AHCGF4A HITACHI electrolytic capacitors 1000 μF 400Vdc surge 450Vdc56300C MURATA current sensor 300 turns 10 A 180ndash335mH 1V 10KHzIR2110 IGBT driver INTERNATIONAL RECTIFIER 500V 2ATL084 JFET-input OPAMPS TEXAS INSTRUMENTSLTC1564 LINEAR antialias filter ICESP32 ESPRESSIF 32 bit microcontroller

Currentsensor

Motor current line

ndashVcc

R1

R2

R3

R4

R5

ndash+

ndash+

R6

R7300Ω

To ADCAntialiasfilter

ndash+

ndash+

Figure 5 Circuitry for current sensing and signal conditioning

100Ω

22Ω 460uFTo ADC

+DC bus

+ndash R1

R2 R4

R3 Antialiasfilter+

ndash

+ndash

+ndash

Figure 6 Circuitry for Vdc sensing and signal conditioning

Figure 4 DTC servodrive prototype including (a) the three-phase rectifier bridge (b) capacitor filters (c) the IGBTpower module (d) theinductive current sensors (e) the IGBT gate drivers (f ) the signal conditioning modules (g) the ESP32 microcontroller and (h) the DCpower supply for low-power integrated circuits

Journal of Robotics 5

42 Power Electronics Circuitry In this stage the three-phase voltage is converted to a DC signal so that it can beconverted back again to a controlled AC signal for themotor For this stage industrial-grade power modules wereused for the rectifier bridge and the VSI (Figure 7) Two1000 μF electrolytic capacitors are connected in parallel forthe DC filtering stage

43 DTC Processing Module 0e processor used for theimplementation of the DTC technique is the ESPRESSIFESP32-WROVER-B 32 bit microcontroller which runs at240MHz ESP32 is a great development board for IoT ap-plications as it is a low-cost device and has many powerfulfeatures (Table 3) ESP32 can be programmed in variousenvironments and programming languages such as ArduinoIDE Espressif-IDF Lua Micropython and CC++

In this project Micropython was used for the design andimplementation of the DTC technique Micropython is areimplementation of Python 3 programming languagetargeted to microcontrollers and embedded systems Bothprogramming languages are very similar Apart from a fewexceptions all the language features of Python are availablein Micropython

0e main reason for using Micropython in the DTCprototype is that today Python is one of the most widely usedsimple and easy to learn programming languages currentlyavailable and well suited for computational analysis and design[26 27] With the emergence of Micropython it becomes easyto program microcontrollers and embedded devices 0ismakes ESP32 and Micropython a great experimental platformfor students teachers and researchers [28]

0e DTC scheme presented previously in Figure 1 wasimplemented in Micropython and the ESP32 with the use ofperipherals such as ADCs DACs (digital to analog con-verters) and timers A summarized workflow of the DTCalgorithm is shown in Figure 8

0e DTC algorithm is programmed in a Micropythoninterrupt service routine (Figure 9) which is triggered every250 μS by the timer Once initiated the current and voltageanalog signals are converted to digital values 0ese valuesare used to estimate flux components flux and torque valuesand then compared with reference values to select the op-timal vector for the VSI Any of these signals can be visu-alized in an external oscilloscope utilizing the internalDACs

5 Experimental Results

0e experimental testing was carried out using a standard1 kW PMSM servo and the main parameters of which aregiven as follows Rs 1557Ω pole pairs p 8 ratedvoltage V 130V rated current I 25 A rated torqueT 27Nm and rated speed ωe 5000RPM

To validate the DTC servodrive performance severaltests were executed with the main focus being on the fluxtorque and current signals If the output signals are similarto the simulated signals then it means that the algorithm hasbeen properly implemented Also the torque output wasmeasured to verify that it is as close as possible to the torquereference value

Although it is important to clarify that the performanceof the DTC algorithm and the quality of the output signalsare directly related to the hysteresis controllers [29 30] Forthis reason most of the tests were made by observing theeffect of the hysteresis bands on the output signals

51 Effects of the Hysteresis Flux Band 0e hysteresis fluxband has a considerable effect on the output signals Forinstance if the band is narrow the switching frequency willbe higher the flux locus will tend to a circular path and thecurrent signal is very close to a sine wave however currentripple will increase since a narrow band will make it easierfor the hysteresis limits to be exceeded On the contrary awide band will lower the ripple content but the switchingfrequency will decrease the flux locus will tend to a hex-agonal path and the current signal is distorted [30] 0iseffect can be observed in simulations (Figure 10) and ex-perimental tests (Figure 11)

0e effect of the flux hysteresis band can also be observedin the current signals When the band is narrow the currentsignal will have greater ripple content but the shape will beclose to a sine wave If instead the band is wider the ripplewill be lower but the signal will be heavily distorted 0isbehavior can be seen in simulations (Figure 12) and theexperimental motor current signal (Figure 13)

52 Effects of the Hysteresis Torque Band 0e width of thehysteresis torque band also has a considerable effect on DTCperformance mainly on the inverter switching frequencyAlthough it also influences the total harmonic distortion

+Vcd

ndashVcd

2000uF

a b cRa

Rb Rc

nree-phaseAC supply

IGBT module 600V 50ARectifier bridge800V 30A

Filter

Motor

Figure 7 Power circuitry for the servodrive system

6 Journal of Robotics

(THD) in the current signals this effect is due to bothhysteresis bands

Firstly the switching frequency is defined as

Fsw Ns

Tf(9)

whereNs is the number of commutations per period and Tf isthe period of the fundamental signal

To observe the effect on the switching frequency bothhysteresis bands were varied In Figure 14 it can be seen thateven though both hysteresis bands affect the switchingfrequency the torque band has a greater influence

As for the THD on the current signal it is defined as

THD

I2 minus I21( 1113857

I21

1113971

(10)

Table 3 ESP32-WROVER-B specifications and peripherals

Components DescriptionCPU Xtensa dual-core 32 bit LX6 240MHz processor Includes ultralow power coprocessorEmbeddedmemory 448KB ROM 4MB SPI flash 8MB PSRAM

Peripherals SD card LED PWM motor PWM IR pulse counter GPIO capacitive touch sensor 2 x ADC 2 x DAC and Hall-effect sensor

Communication Wi-fi (24GHz) Bluetooth 42 CAN bus 20 SPI UART I2C and I2S

Figure 9 Micropython code example for the DTC interrupt service routine

Start

Peripheralsetup

Timerinterrupt

A to Dconversion

Fluxestimation

Torqueestimation

Yes Hysteresiscomparators

Sectorestimation

VectortableVSI

No

D to Aconversion

Yes Scope

CurrentFlux Torque

DIP switchselection

No

Figure 8 DTC algorithm workflow

Journal of Robotics 7

where I is the RMS value of the current and I1 is the RMSvalue of the fundamental harmonic component

Both hysteresis bands were varied but in this case theflux band had a greater influence on the current signaldistortion as shown in Figure 15

53 Output Torque Measurements To validate the torqueperformance of the servocontroller measurements were

made using a 10Nm rotary torque sensor In these tests itwas important to verify that the torque output correspondsto the torque reference and that the ripple content is rela-tively low

Once again the hysteresis bands were varied to observethe effect on the torque signal Since the original DTCscheme with no enhancements was implemented it wasexpected to have relatively high ripple content 0e besttorque performance with the lowest ripple was obtained

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(a)

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(b)

Figure 10 Flux locus simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)Fl

ux ψ

α (W

b)

(a)

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)

Flux

ψα (

Wb)

(b)

Figure 11 Flux locus on the experimental output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(a)

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(b)

Figure 12 Current output simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

8 Journal of Robotics

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

counterclockwise From the optimal vector table (Table 1)the vectors that would have a greater impact on both torqueand flux are V2 V3 V5 and V6 Applying V2 would in-crement both the torque and the flux whereas V5 woulddecrease both Instead if V3 is applied it would increase thetorque but would decrease the flux Similarly if V6 is appliedit would increase the flux and decrease the torque ApplyingV1 or V4 would have an impact mostly on the flux vectoreither decreasing or increasing it respectively Lastly ifeither null vector is applied it would slowly decrease bothvectors 0erefore for this example if sector 1 ϕ 1 andτ 1 it can be seen in Table 1 that the vector to be appliedwould be V2

Once the optimal vector is selected it is applied directlyto the VSI for torque and flux correction

4 DTC Servodrive Description

0e DTC servodrive was designed as a customized andmodular test-bed for industrial servocontrol 0e main ideais that each one of the modules may be replaced by anotherwith different types of hardware For example the currentsensor module in this design uses inductive sensors but canbe replaced easily by a Hall-effect sensor module or a shuntresistor module Also the processing module which cur-rently uses a 32 bit microcontroller may be replaced in the

future by a different type of embedded system Even the DTCalgorithm has an open-source architecture so that the mainblocks can be modified or enhanced or even new func-tionalities may be easily added 0e primary reason is to beable to experimentally test and visualize the effects thesechanges have on the motor performance 0e servodrivesystem is shown in Figure 4

A list of the electronic components used in this proto-type is presented in Table 2

41 Current-Voltage Sensing and Signal ConditioningCircuitry One of the most important stages of the DTCprocess starts in current sensing Since the flux and torqueestimations are based on the current values it is necessaryto have a precise current sensor Firstly the currentsignals of two of the motor lines are measured andconverted to a DC signal by adding an offset voltageSecondly the signal is amplified and filtered so it can beconverted to a digital signal using the analog to digitalconverters (ADC) Antialiasing filters are employed toeffectively cut off frequencies higher than about half themaximum frequency of interest

For this project a MURATA 56300C inductive currentsensor was used As shown in Figure 5 the current is sensedpositive offset and amplified using operational amplifiers

To calculate the two-phase reference components for thevoltage the DC power bus must be monitored in case ofvoltage drops For the DC voltage sensing (Figure 6) aresistive divider circuit was used and also amplified usingJFET-Input operational amplifiers Since this voltage is al-ways positive no offset is required 0e signal is scaledamplified and filtered so it can be converted to a digitalsignal

+LfndashLfFlux

Error

ϕ = 0

ϕ = 1

(a)

+Lt

ndashLt Torque

Error

τ = ndash1

τ = 0

τ = 1

(b)

Figure 2 Hysteresis controllers for (a) magnetic flux and (b) electromagnetic torque

Sector 1α

Sector 2Sector 3

Sector 4

Sector 5 Sector 6

Flux hysteresisband

Fluxreference

V1(100)

V2(110)V3(010)

V4(011)

V5(001) V6(101)

V3 V2

V6V5θs

ψs

ωe

β

Figure 3 Active voltage vectors and sectors of the flux vector space

Table 1 List of all optimal vectors for the VSI based on the sectornumber (1ndash6) the torque error (τ) and the flux error (ϕ)

ϕ τSector

1 2 3 4 5 6

ϕ 1τ 1 V2 V3 V4 V5 V6 V1τ 0 V7 V0 V7 V0 V7 V0τ minus 1 V6 V1 V2 V3 V4 V5

ϕ 0τ 1 V3 V4 V5 V6 V1 V2τ 0 V0 V7 V0 V7 V0 V7τ minus 1 V5 V6 V1 V2 V3 V4

4 Journal of Robotics

Table 2 Main electronic components used in the DTC servodrive

Components DescriptionA50l-2001-0232 Diode rectifier bridge FUJI ELECTRIC 800V 30AA501-0001-0230 IGBT power module FUJI ELECTRIC 600V 50AHCGF4A HITACHI electrolytic capacitors 1000 μF 400Vdc surge 450Vdc56300C MURATA current sensor 300 turns 10 A 180ndash335mH 1V 10KHzIR2110 IGBT driver INTERNATIONAL RECTIFIER 500V 2ATL084 JFET-input OPAMPS TEXAS INSTRUMENTSLTC1564 LINEAR antialias filter ICESP32 ESPRESSIF 32 bit microcontroller

Currentsensor

Motor current line

ndashVcc

R1

R2

R3

R4

R5

ndash+

ndash+

R6

R7300Ω

To ADCAntialiasfilter

ndash+

ndash+

Figure 5 Circuitry for current sensing and signal conditioning

100Ω

22Ω 460uFTo ADC

+DC bus

+ndash R1

R2 R4

R3 Antialiasfilter+

ndash

+ndash

+ndash

Figure 6 Circuitry for Vdc sensing and signal conditioning

Figure 4 DTC servodrive prototype including (a) the three-phase rectifier bridge (b) capacitor filters (c) the IGBTpower module (d) theinductive current sensors (e) the IGBT gate drivers (f ) the signal conditioning modules (g) the ESP32 microcontroller and (h) the DCpower supply for low-power integrated circuits

Journal of Robotics 5

42 Power Electronics Circuitry In this stage the three-phase voltage is converted to a DC signal so that it can beconverted back again to a controlled AC signal for themotor For this stage industrial-grade power modules wereused for the rectifier bridge and the VSI (Figure 7) Two1000 μF electrolytic capacitors are connected in parallel forthe DC filtering stage

43 DTC Processing Module 0e processor used for theimplementation of the DTC technique is the ESPRESSIFESP32-WROVER-B 32 bit microcontroller which runs at240MHz ESP32 is a great development board for IoT ap-plications as it is a low-cost device and has many powerfulfeatures (Table 3) ESP32 can be programmed in variousenvironments and programming languages such as ArduinoIDE Espressif-IDF Lua Micropython and CC++

In this project Micropython was used for the design andimplementation of the DTC technique Micropython is areimplementation of Python 3 programming languagetargeted to microcontrollers and embedded systems Bothprogramming languages are very similar Apart from a fewexceptions all the language features of Python are availablein Micropython

0e main reason for using Micropython in the DTCprototype is that today Python is one of the most widely usedsimple and easy to learn programming languages currentlyavailable and well suited for computational analysis and design[26 27] With the emergence of Micropython it becomes easyto program microcontrollers and embedded devices 0ismakes ESP32 and Micropython a great experimental platformfor students teachers and researchers [28]

0e DTC scheme presented previously in Figure 1 wasimplemented in Micropython and the ESP32 with the use ofperipherals such as ADCs DACs (digital to analog con-verters) and timers A summarized workflow of the DTCalgorithm is shown in Figure 8

0e DTC algorithm is programmed in a Micropythoninterrupt service routine (Figure 9) which is triggered every250 μS by the timer Once initiated the current and voltageanalog signals are converted to digital values 0ese valuesare used to estimate flux components flux and torque valuesand then compared with reference values to select the op-timal vector for the VSI Any of these signals can be visu-alized in an external oscilloscope utilizing the internalDACs

5 Experimental Results

0e experimental testing was carried out using a standard1 kW PMSM servo and the main parameters of which aregiven as follows Rs 1557Ω pole pairs p 8 ratedvoltage V 130V rated current I 25 A rated torqueT 27Nm and rated speed ωe 5000RPM

To validate the DTC servodrive performance severaltests were executed with the main focus being on the fluxtorque and current signals If the output signals are similarto the simulated signals then it means that the algorithm hasbeen properly implemented Also the torque output wasmeasured to verify that it is as close as possible to the torquereference value

Although it is important to clarify that the performanceof the DTC algorithm and the quality of the output signalsare directly related to the hysteresis controllers [29 30] Forthis reason most of the tests were made by observing theeffect of the hysteresis bands on the output signals

51 Effects of the Hysteresis Flux Band 0e hysteresis fluxband has a considerable effect on the output signals Forinstance if the band is narrow the switching frequency willbe higher the flux locus will tend to a circular path and thecurrent signal is very close to a sine wave however currentripple will increase since a narrow band will make it easierfor the hysteresis limits to be exceeded On the contrary awide band will lower the ripple content but the switchingfrequency will decrease the flux locus will tend to a hex-agonal path and the current signal is distorted [30] 0iseffect can be observed in simulations (Figure 10) and ex-perimental tests (Figure 11)

0e effect of the flux hysteresis band can also be observedin the current signals When the band is narrow the currentsignal will have greater ripple content but the shape will beclose to a sine wave If instead the band is wider the ripplewill be lower but the signal will be heavily distorted 0isbehavior can be seen in simulations (Figure 12) and theexperimental motor current signal (Figure 13)

52 Effects of the Hysteresis Torque Band 0e width of thehysteresis torque band also has a considerable effect on DTCperformance mainly on the inverter switching frequencyAlthough it also influences the total harmonic distortion

+Vcd

ndashVcd

2000uF

a b cRa

Rb Rc

nree-phaseAC supply

IGBT module 600V 50ARectifier bridge800V 30A

Filter

Motor

Figure 7 Power circuitry for the servodrive system

6 Journal of Robotics

(THD) in the current signals this effect is due to bothhysteresis bands

Firstly the switching frequency is defined as

Fsw Ns

Tf(9)

whereNs is the number of commutations per period and Tf isthe period of the fundamental signal

To observe the effect on the switching frequency bothhysteresis bands were varied In Figure 14 it can be seen thateven though both hysteresis bands affect the switchingfrequency the torque band has a greater influence

As for the THD on the current signal it is defined as

THD

I2 minus I21( 1113857

I21

1113971

(10)

Table 3 ESP32-WROVER-B specifications and peripherals

Components DescriptionCPU Xtensa dual-core 32 bit LX6 240MHz processor Includes ultralow power coprocessorEmbeddedmemory 448KB ROM 4MB SPI flash 8MB PSRAM

Peripherals SD card LED PWM motor PWM IR pulse counter GPIO capacitive touch sensor 2 x ADC 2 x DAC and Hall-effect sensor

Communication Wi-fi (24GHz) Bluetooth 42 CAN bus 20 SPI UART I2C and I2S

Figure 9 Micropython code example for the DTC interrupt service routine

Start

Peripheralsetup

Timerinterrupt

A to Dconversion

Fluxestimation

Torqueestimation

Yes Hysteresiscomparators

Sectorestimation

VectortableVSI

No

D to Aconversion

Yes Scope

CurrentFlux Torque

DIP switchselection

No

Figure 8 DTC algorithm workflow

Journal of Robotics 7

where I is the RMS value of the current and I1 is the RMSvalue of the fundamental harmonic component

Both hysteresis bands were varied but in this case theflux band had a greater influence on the current signaldistortion as shown in Figure 15

53 Output Torque Measurements To validate the torqueperformance of the servocontroller measurements were

made using a 10Nm rotary torque sensor In these tests itwas important to verify that the torque output correspondsto the torque reference and that the ripple content is rela-tively low

Once again the hysteresis bands were varied to observethe effect on the torque signal Since the original DTCscheme with no enhancements was implemented it wasexpected to have relatively high ripple content 0e besttorque performance with the lowest ripple was obtained

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(a)

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(b)

Figure 10 Flux locus simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)Fl

ux ψ

α (W

b)

(a)

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)

Flux

ψα (

Wb)

(b)

Figure 11 Flux locus on the experimental output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(a)

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(b)

Figure 12 Current output simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

8 Journal of Robotics

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

Table 2 Main electronic components used in the DTC servodrive

Components DescriptionA50l-2001-0232 Diode rectifier bridge FUJI ELECTRIC 800V 30AA501-0001-0230 IGBT power module FUJI ELECTRIC 600V 50AHCGF4A HITACHI electrolytic capacitors 1000 μF 400Vdc surge 450Vdc56300C MURATA current sensor 300 turns 10 A 180ndash335mH 1V 10KHzIR2110 IGBT driver INTERNATIONAL RECTIFIER 500V 2ATL084 JFET-input OPAMPS TEXAS INSTRUMENTSLTC1564 LINEAR antialias filter ICESP32 ESPRESSIF 32 bit microcontroller

Currentsensor

Motor current line

ndashVcc

R1

R2

R3

R4

R5

ndash+

ndash+

R6

R7300Ω

To ADCAntialiasfilter

ndash+

ndash+

Figure 5 Circuitry for current sensing and signal conditioning

100Ω

22Ω 460uFTo ADC

+DC bus

+ndash R1

R2 R4

R3 Antialiasfilter+

ndash

+ndash

+ndash

Figure 6 Circuitry for Vdc sensing and signal conditioning

Figure 4 DTC servodrive prototype including (a) the three-phase rectifier bridge (b) capacitor filters (c) the IGBTpower module (d) theinductive current sensors (e) the IGBT gate drivers (f ) the signal conditioning modules (g) the ESP32 microcontroller and (h) the DCpower supply for low-power integrated circuits

Journal of Robotics 5

42 Power Electronics Circuitry In this stage the three-phase voltage is converted to a DC signal so that it can beconverted back again to a controlled AC signal for themotor For this stage industrial-grade power modules wereused for the rectifier bridge and the VSI (Figure 7) Two1000 μF electrolytic capacitors are connected in parallel forthe DC filtering stage

43 DTC Processing Module 0e processor used for theimplementation of the DTC technique is the ESPRESSIFESP32-WROVER-B 32 bit microcontroller which runs at240MHz ESP32 is a great development board for IoT ap-plications as it is a low-cost device and has many powerfulfeatures (Table 3) ESP32 can be programmed in variousenvironments and programming languages such as ArduinoIDE Espressif-IDF Lua Micropython and CC++

In this project Micropython was used for the design andimplementation of the DTC technique Micropython is areimplementation of Python 3 programming languagetargeted to microcontrollers and embedded systems Bothprogramming languages are very similar Apart from a fewexceptions all the language features of Python are availablein Micropython

0e main reason for using Micropython in the DTCprototype is that today Python is one of the most widely usedsimple and easy to learn programming languages currentlyavailable and well suited for computational analysis and design[26 27] With the emergence of Micropython it becomes easyto program microcontrollers and embedded devices 0ismakes ESP32 and Micropython a great experimental platformfor students teachers and researchers [28]

0e DTC scheme presented previously in Figure 1 wasimplemented in Micropython and the ESP32 with the use ofperipherals such as ADCs DACs (digital to analog con-verters) and timers A summarized workflow of the DTCalgorithm is shown in Figure 8

0e DTC algorithm is programmed in a Micropythoninterrupt service routine (Figure 9) which is triggered every250 μS by the timer Once initiated the current and voltageanalog signals are converted to digital values 0ese valuesare used to estimate flux components flux and torque valuesand then compared with reference values to select the op-timal vector for the VSI Any of these signals can be visu-alized in an external oscilloscope utilizing the internalDACs

5 Experimental Results

0e experimental testing was carried out using a standard1 kW PMSM servo and the main parameters of which aregiven as follows Rs 1557Ω pole pairs p 8 ratedvoltage V 130V rated current I 25 A rated torqueT 27Nm and rated speed ωe 5000RPM

To validate the DTC servodrive performance severaltests were executed with the main focus being on the fluxtorque and current signals If the output signals are similarto the simulated signals then it means that the algorithm hasbeen properly implemented Also the torque output wasmeasured to verify that it is as close as possible to the torquereference value

Although it is important to clarify that the performanceof the DTC algorithm and the quality of the output signalsare directly related to the hysteresis controllers [29 30] Forthis reason most of the tests were made by observing theeffect of the hysteresis bands on the output signals

51 Effects of the Hysteresis Flux Band 0e hysteresis fluxband has a considerable effect on the output signals Forinstance if the band is narrow the switching frequency willbe higher the flux locus will tend to a circular path and thecurrent signal is very close to a sine wave however currentripple will increase since a narrow band will make it easierfor the hysteresis limits to be exceeded On the contrary awide band will lower the ripple content but the switchingfrequency will decrease the flux locus will tend to a hex-agonal path and the current signal is distorted [30] 0iseffect can be observed in simulations (Figure 10) and ex-perimental tests (Figure 11)

0e effect of the flux hysteresis band can also be observedin the current signals When the band is narrow the currentsignal will have greater ripple content but the shape will beclose to a sine wave If instead the band is wider the ripplewill be lower but the signal will be heavily distorted 0isbehavior can be seen in simulations (Figure 12) and theexperimental motor current signal (Figure 13)

52 Effects of the Hysteresis Torque Band 0e width of thehysteresis torque band also has a considerable effect on DTCperformance mainly on the inverter switching frequencyAlthough it also influences the total harmonic distortion

+Vcd

ndashVcd

2000uF

a b cRa

Rb Rc

nree-phaseAC supply

IGBT module 600V 50ARectifier bridge800V 30A

Filter

Motor

Figure 7 Power circuitry for the servodrive system

6 Journal of Robotics

(THD) in the current signals this effect is due to bothhysteresis bands

Firstly the switching frequency is defined as

Fsw Ns

Tf(9)

whereNs is the number of commutations per period and Tf isthe period of the fundamental signal

To observe the effect on the switching frequency bothhysteresis bands were varied In Figure 14 it can be seen thateven though both hysteresis bands affect the switchingfrequency the torque band has a greater influence

As for the THD on the current signal it is defined as

THD

I2 minus I21( 1113857

I21

1113971

(10)

Table 3 ESP32-WROVER-B specifications and peripherals

Components DescriptionCPU Xtensa dual-core 32 bit LX6 240MHz processor Includes ultralow power coprocessorEmbeddedmemory 448KB ROM 4MB SPI flash 8MB PSRAM

Peripherals SD card LED PWM motor PWM IR pulse counter GPIO capacitive touch sensor 2 x ADC 2 x DAC and Hall-effect sensor

Communication Wi-fi (24GHz) Bluetooth 42 CAN bus 20 SPI UART I2C and I2S

Figure 9 Micropython code example for the DTC interrupt service routine

Start

Peripheralsetup

Timerinterrupt

A to Dconversion

Fluxestimation

Torqueestimation

Yes Hysteresiscomparators

Sectorestimation

VectortableVSI

No

D to Aconversion

Yes Scope

CurrentFlux Torque

DIP switchselection

No

Figure 8 DTC algorithm workflow

Journal of Robotics 7

where I is the RMS value of the current and I1 is the RMSvalue of the fundamental harmonic component

Both hysteresis bands were varied but in this case theflux band had a greater influence on the current signaldistortion as shown in Figure 15

53 Output Torque Measurements To validate the torqueperformance of the servocontroller measurements were

made using a 10Nm rotary torque sensor In these tests itwas important to verify that the torque output correspondsto the torque reference and that the ripple content is rela-tively low

Once again the hysteresis bands were varied to observethe effect on the torque signal Since the original DTCscheme with no enhancements was implemented it wasexpected to have relatively high ripple content 0e besttorque performance with the lowest ripple was obtained

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(a)

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(b)

Figure 10 Flux locus simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)Fl

ux ψ

α (W

b)

(a)

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)

Flux

ψα (

Wb)

(b)

Figure 11 Flux locus on the experimental output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(a)

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(b)

Figure 12 Current output simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

8 Journal of Robotics

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

42 Power Electronics Circuitry In this stage the three-phase voltage is converted to a DC signal so that it can beconverted back again to a controlled AC signal for themotor For this stage industrial-grade power modules wereused for the rectifier bridge and the VSI (Figure 7) Two1000 μF electrolytic capacitors are connected in parallel forthe DC filtering stage

43 DTC Processing Module 0e processor used for theimplementation of the DTC technique is the ESPRESSIFESP32-WROVER-B 32 bit microcontroller which runs at240MHz ESP32 is a great development board for IoT ap-plications as it is a low-cost device and has many powerfulfeatures (Table 3) ESP32 can be programmed in variousenvironments and programming languages such as ArduinoIDE Espressif-IDF Lua Micropython and CC++

In this project Micropython was used for the design andimplementation of the DTC technique Micropython is areimplementation of Python 3 programming languagetargeted to microcontrollers and embedded systems Bothprogramming languages are very similar Apart from a fewexceptions all the language features of Python are availablein Micropython

0e main reason for using Micropython in the DTCprototype is that today Python is one of the most widely usedsimple and easy to learn programming languages currentlyavailable and well suited for computational analysis and design[26 27] With the emergence of Micropython it becomes easyto program microcontrollers and embedded devices 0ismakes ESP32 and Micropython a great experimental platformfor students teachers and researchers [28]

0e DTC scheme presented previously in Figure 1 wasimplemented in Micropython and the ESP32 with the use ofperipherals such as ADCs DACs (digital to analog con-verters) and timers A summarized workflow of the DTCalgorithm is shown in Figure 8

0e DTC algorithm is programmed in a Micropythoninterrupt service routine (Figure 9) which is triggered every250 μS by the timer Once initiated the current and voltageanalog signals are converted to digital values 0ese valuesare used to estimate flux components flux and torque valuesand then compared with reference values to select the op-timal vector for the VSI Any of these signals can be visu-alized in an external oscilloscope utilizing the internalDACs

5 Experimental Results

0e experimental testing was carried out using a standard1 kW PMSM servo and the main parameters of which aregiven as follows Rs 1557Ω pole pairs p 8 ratedvoltage V 130V rated current I 25 A rated torqueT 27Nm and rated speed ωe 5000RPM

To validate the DTC servodrive performance severaltests were executed with the main focus being on the fluxtorque and current signals If the output signals are similarto the simulated signals then it means that the algorithm hasbeen properly implemented Also the torque output wasmeasured to verify that it is as close as possible to the torquereference value

Although it is important to clarify that the performanceof the DTC algorithm and the quality of the output signalsare directly related to the hysteresis controllers [29 30] Forthis reason most of the tests were made by observing theeffect of the hysteresis bands on the output signals

51 Effects of the Hysteresis Flux Band 0e hysteresis fluxband has a considerable effect on the output signals Forinstance if the band is narrow the switching frequency willbe higher the flux locus will tend to a circular path and thecurrent signal is very close to a sine wave however currentripple will increase since a narrow band will make it easierfor the hysteresis limits to be exceeded On the contrary awide band will lower the ripple content but the switchingfrequency will decrease the flux locus will tend to a hex-agonal path and the current signal is distorted [30] 0iseffect can be observed in simulations (Figure 10) and ex-perimental tests (Figure 11)

0e effect of the flux hysteresis band can also be observedin the current signals When the band is narrow the currentsignal will have greater ripple content but the shape will beclose to a sine wave If instead the band is wider the ripplewill be lower but the signal will be heavily distorted 0isbehavior can be seen in simulations (Figure 12) and theexperimental motor current signal (Figure 13)

52 Effects of the Hysteresis Torque Band 0e width of thehysteresis torque band also has a considerable effect on DTCperformance mainly on the inverter switching frequencyAlthough it also influences the total harmonic distortion

+Vcd

ndashVcd

2000uF

a b cRa

Rb Rc

nree-phaseAC supply

IGBT module 600V 50ARectifier bridge800V 30A

Filter

Motor

Figure 7 Power circuitry for the servodrive system

6 Journal of Robotics

(THD) in the current signals this effect is due to bothhysteresis bands

Firstly the switching frequency is defined as

Fsw Ns

Tf(9)

whereNs is the number of commutations per period and Tf isthe period of the fundamental signal

To observe the effect on the switching frequency bothhysteresis bands were varied In Figure 14 it can be seen thateven though both hysteresis bands affect the switchingfrequency the torque band has a greater influence

As for the THD on the current signal it is defined as

THD

I2 minus I21( 1113857

I21

1113971

(10)

Table 3 ESP32-WROVER-B specifications and peripherals

Components DescriptionCPU Xtensa dual-core 32 bit LX6 240MHz processor Includes ultralow power coprocessorEmbeddedmemory 448KB ROM 4MB SPI flash 8MB PSRAM

Peripherals SD card LED PWM motor PWM IR pulse counter GPIO capacitive touch sensor 2 x ADC 2 x DAC and Hall-effect sensor

Communication Wi-fi (24GHz) Bluetooth 42 CAN bus 20 SPI UART I2C and I2S

Figure 9 Micropython code example for the DTC interrupt service routine

Start

Peripheralsetup

Timerinterrupt

A to Dconversion

Fluxestimation

Torqueestimation

Yes Hysteresiscomparators

Sectorestimation

VectortableVSI

No

D to Aconversion

Yes Scope

CurrentFlux Torque

DIP switchselection

No

Figure 8 DTC algorithm workflow

Journal of Robotics 7

where I is the RMS value of the current and I1 is the RMSvalue of the fundamental harmonic component

Both hysteresis bands were varied but in this case theflux band had a greater influence on the current signaldistortion as shown in Figure 15

53 Output Torque Measurements To validate the torqueperformance of the servocontroller measurements were

made using a 10Nm rotary torque sensor In these tests itwas important to verify that the torque output correspondsto the torque reference and that the ripple content is rela-tively low

Once again the hysteresis bands were varied to observethe effect on the torque signal Since the original DTCscheme with no enhancements was implemented it wasexpected to have relatively high ripple content 0e besttorque performance with the lowest ripple was obtained

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(a)

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(b)

Figure 10 Flux locus simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)Fl

ux ψ

α (W

b)

(a)

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)

Flux

ψα (

Wb)

(b)

Figure 11 Flux locus on the experimental output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(a)

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(b)

Figure 12 Current output simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

8 Journal of Robotics

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

(THD) in the current signals this effect is due to bothhysteresis bands

Firstly the switching frequency is defined as

Fsw Ns

Tf(9)

whereNs is the number of commutations per period and Tf isthe period of the fundamental signal

To observe the effect on the switching frequency bothhysteresis bands were varied In Figure 14 it can be seen thateven though both hysteresis bands affect the switchingfrequency the torque band has a greater influence

As for the THD on the current signal it is defined as

THD

I2 minus I21( 1113857

I21

1113971

(10)

Table 3 ESP32-WROVER-B specifications and peripherals

Components DescriptionCPU Xtensa dual-core 32 bit LX6 240MHz processor Includes ultralow power coprocessorEmbeddedmemory 448KB ROM 4MB SPI flash 8MB PSRAM

Peripherals SD card LED PWM motor PWM IR pulse counter GPIO capacitive touch sensor 2 x ADC 2 x DAC and Hall-effect sensor

Communication Wi-fi (24GHz) Bluetooth 42 CAN bus 20 SPI UART I2C and I2S

Figure 9 Micropython code example for the DTC interrupt service routine

Start

Peripheralsetup

Timerinterrupt

A to Dconversion

Fluxestimation

Torqueestimation

Yes Hysteresiscomparators

Sectorestimation

VectortableVSI

No

D to Aconversion

Yes Scope

CurrentFlux Torque

DIP switchselection

No

Figure 8 DTC algorithm workflow

Journal of Robotics 7

where I is the RMS value of the current and I1 is the RMSvalue of the fundamental harmonic component

Both hysteresis bands were varied but in this case theflux band had a greater influence on the current signaldistortion as shown in Figure 15

53 Output Torque Measurements To validate the torqueperformance of the servocontroller measurements were

made using a 10Nm rotary torque sensor In these tests itwas important to verify that the torque output correspondsto the torque reference and that the ripple content is rela-tively low

Once again the hysteresis bands were varied to observethe effect on the torque signal Since the original DTCscheme with no enhancements was implemented it wasexpected to have relatively high ripple content 0e besttorque performance with the lowest ripple was obtained

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(a)

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(b)

Figure 10 Flux locus simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)Fl

ux ψ

α (W

b)

(a)

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)

Flux

ψα (

Wb)

(b)

Figure 11 Flux locus on the experimental output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(a)

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(b)

Figure 12 Current output simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

8 Journal of Robotics

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

where I is the RMS value of the current and I1 is the RMSvalue of the fundamental harmonic component

Both hysteresis bands were varied but in this case theflux band had a greater influence on the current signaldistortion as shown in Figure 15

53 Output Torque Measurements To validate the torqueperformance of the servocontroller measurements were

made using a 10Nm rotary torque sensor In these tests itwas important to verify that the torque output correspondsto the torque reference and that the ripple content is rela-tively low

Once again the hysteresis bands were varied to observethe effect on the torque signal Since the original DTCscheme with no enhancements was implemented it wasexpected to have relatively high ripple content 0e besttorque performance with the lowest ripple was obtained

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(a)

Flux

ψα (

Wb)

0

0ndash05

ndash05 +05

+05Flux ψβ (Wb)

(b)

Figure 10 Flux locus simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)Fl

ux ψ

α (W

b)

(a)

0

0

ndash05

ndash05 +05

+05

Flux ψβ (Wb)

Flux

ψα (

Wb)

(b)

Figure 11 Flux locus on the experimental output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(a)

0

1

2

ndash1

ndash2

Curr

ent (

A)

04 042 044 046 048Time (s)

(b)

Figure 12 Current output simulation to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux reference value

8 Journal of Robotics

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

when the flux band was set to 2 of the reference value(08Wb) and the torque band was set to 1 of the ref-erence value 0e output torque signal is shown inFigure 16

Needless to say the verification of the torque response inthe servodrive is very important since this ensures thatchanges in torque and direction will be carried out by thedrive However the use of a physical torque sensor is usuallyexpensive and requires additional installation and softwareAdditionally torque sensors have a specific range if a widerrange is required the cost becomes prohibitive In futureprojects it would be interesting to make use of virtual in-struments [31] for the monitoring of torque and magneticflux signals and in this way avoid the limitations of physicalsensors especially in electromechanical projects aimed toeducation [32] where funding is usually limited

6 Conclusion

0e proposal of a PMSM drive based on the DTC techniquewas presented 0is motor control algorithm was coded inMicropython for implementation on the ESP32

Curr

ent (

A)

Time (s)

(a)

Curr

ent (

A)

Time (s)

(b)

Figure 13 Experimental motor current output to observe the effect of the flux hysteresis band with (a) 2 and (b) 5 of the flux referencevalue 0e current amplitude is 2Adiv and the period is 5mSdiv

141210

8002

0102

6

Fsw

(Hz)

420

004 008 012Hψ|ψs

lowast|

HTTlowast

016 020 024

Figure 14 Average inverter switching frequency as function of theflux (Hψ) and torque (HT) hysteresis bands

0 004 008 012 016 020 024

0020102

Hψ|ψslowast|

HTTlowast

005015

020025030035040

THD

Figure 15 Total harmonic distortion as a function of the flux (Hψ)and torque (HT) hysteresis bands

Torq

ue (N

m)

Time (s)

Torque reference Tlowast

Torque output

Figure 16 Experimental torque response with a torque referenceTlowast plusmn1Nm torque band HT 1 and flux band Hψ 2 0etorque amplitude is 2Nmdiv and the period is 1 Sdiv

Journal of Robotics 9

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

microcontroller 0e aim of this prototype is to be used indidactic applications for undergraduate engineering stu-dents Experimental and simulation results validate the ef-fectiveness of the design and show that good torqueperformance can be achieved with DTC on a low-costgeneral-purpose processor 0e main benefit of this pro-totype is its simplicity since it did not require any modifi-cation to the original DTC structure and even so currentand torque ripple content was acceptable 0e code writtenonMicropythonmade it easy to understand and to adjust fordifferent testing parameters such as modifying hysteresisbands to observe the quality of current flux and torqueoutput signals

0is will allow students and researchers interested inmotion control to experiment with a simple and practicaltool and in future projects to improve even the performanceand structure of this prototype

Data Availability

No data were used to support this study

Conflicts of Interest

0e authors declare no conflicts of interest regarding thepublication of this paper

References

[1] X Sun Y Zhang and J Chen ldquoRTPO a domain knowledgebase for robot task planningrdquo Electronics vol 8 no 10p 1105 2019

[2] F Wang Z Zhang X Mei J Rodrıguez and R KennelldquoAdvanced control strategies of induction machine fieldoriented control direct torque control and model predictivecontrolrdquo Energies vol 11 no 1 p 120 2018

[3] J Zhu X Wang B Xu H Feng and X Xu ldquoA comparativestudy on field oriented control and direct torque control forpermanent magnet linear synchronous motorrdquo Journal ofComputers vol 8 pp 256ndash263 2013

[4] Q Song Y Li and C Jia ldquoA novel direct torque controlmethod based on asymmetric boundary layer sliding modecontrol for PMSMrdquo Energies vol 11 no 3 p 657 2018

[5] B Metidji N Taib L Baghli T Rekioua and S Bacha ldquoLow-cost direct torque control algorithm for induction motorwithout AC phase current sensorsrdquo IEEE Transactions onPower Electronics vol 27 no 9 pp 4132ndash4139 2012

[6] B K BoseModern Power Electronics and ACDrives Prentice-Hall Upper Sadle River NJ USA 2002

[7] A Munoz-Garcia T A Lipo and D W Novotny ldquoA newinduction motor Vf control method capable of high-per-formance regulation at low speedsrdquo IEEE Transactions onIndustry Applications vol 34 no 4 pp 813ndash821 1998

[8] M S Aspalli S Kalshetti and P V Hunagund ldquoSpeedcontrol of 3Φ induction motor using volts hertz controlmethodrdquo De International Journal of Electrical Engineeringvol 3 pp 231ndash236 2011

[9] F Blaschke ldquo0e principle of field-orientation as applied tothe new transvector closed-loop system for rotating-fieldmachinesrdquo Siemens Review vol 34 no 3 pp 217ndash220 1972

[10] D Casadei F Profumo G Serra and A Tani ldquoFOC andDTC two viable schemes for induction motors torque con-trolrdquo IEEE Transactions on Power Electronics vol 17 no 5pp 779ndash787 2002

[11] M Hamouda H F Blanchette K Al-Haddad and F FnaiechldquoAn efficient DSP-FPGA-based real-time implementationmethod of SVM algorithms for an indirect matrix converterrdquoIEEE Transactions on Industrial Electronics vol 58 no 11pp 5024ndash5031 2011

[12] C Koulamas and M Lazarescu ldquoReal-time embedded sys-tems present and futurerdquo Electronics vol 7 no 9 p 2052018

[13] M Yushkova A Sanchez A de Castro and M A Martınez-Garcıa ldquoA comparison of filtering approaches using low-speed DACs for hardware-in-the-loop implemented inFPGAsrdquo Electronics vol 8 no 10 p 1116 2019

[14] E Monmasson and M N Cirstea ldquorFPGA Design Meth-odology for Industrial Control Systems-A Reviewrdquo IEEETransactions on Industrial Electronics vol 54 no 4pp 1824ndash1842 2007

[15] C-K Lai H-Y Lai Y-X Tang and E-S Chang ldquoFieldprogrammable gate array-based linear shaft motor drivesystem design in terms of the trapezoidal velocity profileconsiderationrdquo Machines vol 7 no 3 p 59 2019

[16] I Takahashi and T Noguchi ldquoA new quick-response andhigh-efficiency control strategy of an induction motorrdquo IEEETransactions on Industry Applications vol IA-22 no 5pp 820ndash827 1986

[17] H Hamidreza A Rassolkin T Vaimann et al ldquoA novelvector control strategy for a six-phase induction motor withlow torque ripples and harmonic currentsrdquo Energies vol 12no 6 p 1102 2019

[18] G Zhang C Chen X Gu Z Wang and X Li ldquoAn improvedmodel predictive torque control for a two-level inverter fedinterior permanent magnet synchronous motorrdquo Electronicsvol 8 no 7 p 769 2019

[19] I M Alsofyani and K-B Lee ldquoEvaluation of direct torquecontrol with a constant-frequency torque regulator undervarious discrete interleaving carriersrdquo Electronics vol 8 no 7p 820 2019

[20] N Pimkumwong and M-S Wang ldquoannsOnline Speed Es-timation Using Artificial Neural Network for Speed Sen-sorless Direct Torque Control of Induction Motor based onConstant VF Control Techniquerdquo Energies vol 11 no 8p 2176 2018

[21] G M Sung W Y Wang W S Lin and C P Yu ldquoPredictivedirect torque control application-specific integrated circuit ofan induction motor drive with a fuzzy controllerrdquo Journal ofLow Power Electronics and Applications vol 7 no 2 p 152017

[22] J Park and X Wang ldquoSensorless direct torque control ofsurface-mounted permanent magnet synchronous motorswith nonlinear kalman filteringrdquo Energies vol 11 no 4p 969 2018

[23] J Rodriguez R M Kennel J R Espinoza M TrincadoC A Silva and C A Rojas ldquoHigh-performance controlstrategies for electrical drives an experimental assessmentrdquoIEEE Transactions on Industrial Electronics vol 59 no 2pp 812ndash820 2012

[24] L Yaohua M A Jian L Jingyu et al ldquoStudy on the use of zerovoltage vectors in the PMSM DTC systemrdquo in Proceedings ofthe 30th Chinese Control Conference pp 3559ndash3564 Yantai

10 Journal of Robotics

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11

China July 2011[25] E-S Jun S-Y Park and S Kwak ldquoA comprehensive double-

vector approach to alleviate common-mode voltage in three-phase voltage-source inverters with a predictive control al-gorithmrdquo Electronics vol 8 no 8 p 872 2019

[26] J Vega and J M Cantildeas ldquoAn innovative python-based ed-ucational framework using real and simulated Arduino ro-botsrdquo Electronics vol 8 no 8 p 889 2019

[27] M Badenhorst C J Barry C J Swanepoel C T Van StadenJ Wissing and J M Rohwer ldquoWorkflow for data analysis inexperimental and computational systems Biology using py-thon as ldquoGluerdquordquo Processes vol 7 no 7 p 460 2019

[28] L O Aghenta and M T Iqbal ldquoLow-cost open source IoT-based SCADA system design using thingerIO and ESP32thingrdquo Electronics vol 8 no 8 p 822 2019

[29] I M Alsofyani N R N Idris and K-B Lee ldquoDynamichysteresis torque band for improving the performance oflookup-table-based DTC of induction machinesrdquo IEEETransactions on Power Electronics vol 33 no 9 pp 7959ndash7970 2018

[30] D Casadei G Grandi G Serra and A Tani ldquoEffects of fluxand torque hysteresis band Amplitude in direct torque controlof induction machinesrdquo in Proceedings of the 20th AnnualConference of IEEE Industrial Electronics pp 299ndash304 Bo-logna Italy September 1994

[31] L Fortuna P Giannone S Graziani and M G XibilialdquoVirtual instruments based on stacked neural networks toimprove product quality monitoring in a refineryrdquo in Pro-ceedings of the IEEE Instrumentation and Technology Con-ference pp 1889ndash1893 Ottawa Canada May 2005

[32] M Bucolo A Buscarino C Famoso L Fortuna andM Frasca ldquoControl of imperfect dynamical systemsrdquo Non-linear Dynamics vol 98 no 4 pp 2989ndash2999 2019

Journal of Robotics 11