Proposal of a reliable embedded circuit to control a stepper motor using microblaze soft-core processor

The vast majority of embedded system designs start with a processor-based system, using a microcontroller or microprocessor as the core element to predict and process the basic control tasks. This paper aims to increase the reliability of controlling a stepper motor by an embedded circuit, which generates four digital signals of pulse width modulation (PWM). The manager of this circuit is an embedded processor licensed from Microblaze, which sits within the FPGA architecture Virtex 5. This processor analyzes the parameters to execute the rotation under the best conditions (energy consumption, speed, precision, and reliability). The communication with the PC takes place via the RS232 link to provide feedback. The autonomous processor generates an independent control frequency of the PC. The four digital signals of PWM are simulated on Xilinx's ISim interface and sent to the ULN2803 amplifier circuit to run the stepper motor.


INTRODUCTION
It is a safe bet that embedded systems will no longer lose their primary place in the industry. Simply because of their evolution and the realization of a long-awaited dream. More and more intelligence is being added to systems every day. Intelligent measurement [1]- [3], control [4], [5] and assistance systems [6], [7] in various sectors. Not only are embedded systems multiplying and diversifying, but they are also becoming more and more complex. One of the first current challenges is undoubtedly the creation of an embedded control system or rather embedded circuits. The ultimate goal is to make them cooperate to combine or harvest their functionalities or resources. Conventional old systems cannot be at a high level of reliability. The diversity of embedded devices on which we are dependent makes the productivity of the industries at a high rate. We propose in this paper to establish the key ideas to propose an embedded system to control a stepper motor using the Microblaze processor in field-programmable gate array (FPGA) [8], [9].
The choice was made on the FPGAs which are reprogrammable [10] or for or by system on chipfield programmable gate array (SoC-FPGA) systems [11]; the most important it is the flexibility that offers these last ones and the possibility of parameterizing them with the task to be accomplished, and the material available in the system what is going to generate an optimization which is going to be manifested by the accomplishment of the task asked with a minimum of possible resources. What is a considerable advantage, and also the very reduced energy consumption which characterizes the circuits FPGAs. The configuration of the MicroBlaze that it was necessary to understand well the environments of Xilinx [12], [13] such as Xilinx platform studio (XPS) and software development kit (SDK) [14], we tried to explain each step and the passage from one stage to another. Among all those that we saw the most important is the parameterization of the processor [15]: the addition or the suppression of the peripherals. This allows us to better understand flexibility and optimization [16]. Once the knowledge is acquired, we started the programming of the functions that will be useful for an eventual embedded system.
In this paper, we show another real-time control that is developed around an FPGA hardware architecture that includes the embedded processor Microblaze on XUPV5-LX110T prototyping FPGA's board Virtex-5 of Xilinx. In particular, the hardware implementation of a single-processor system that includes switches, pushbuttons, LEDs, and external connectors (XGI expansion headers), on the FPGA board. While controlling the input/output devices of the board through the implementation of a compiled code in C language on the Microblaze processor [17], [18].
The first part describes the structure of the control system while going through the MicroBlaze and the power circuit. The second part examines the experimental simulation for embedded digital vector pulse width modulation (PWM) and the number of logic gates, the power supply, and the discussion of results. The last section concludes the work with some perspective.

RESEARCH METHOD 2.1. Embedded control circuit
The use of stepper motors is very diverse either in terms of applications or control methods and tools. We find a stepper motor that is controlled and programmed by ATMEGA-328 microcontroller using Arduino [19], in a design of a robotic arm with four degrees of freedom [20], [21]. It is designed to pick objects with a specific weight and place them in the desired location [22]. As well as the control using a digital signal processor (DSP) integrated by FPGA [23]. The stepper motor is used in wide applications for controlling the speed and position by analyzing the FPGA provides [23]. The control is also of three axes based on a hybrid stepper motor. The core of this system incorporates digital technology based on FPGA+Verilog tool HDL+EDA [24]. Studies have been made on the dynamic characteristics in terms of rotational speed and torque [25] with the new velocity profile algorithm for stepper motors that has been proposed and directed squarely on the FPGA architecture [26], [27].

The control system structure (design flow)
The control is mainly implemented using the MicroBlaze embedded processor that ensures speed, reliability, and ease to perform the control algorithms with very precise results. For that the programming way depends on two important stages: − The choice of basic embedded peripherals (Microblaze processor, LEDs, switch, and pushbutton) in the hardware part of the XPS environment (Xilinx platform studio) of the EDK software (Xilinx embedded development kit). Using the Xilinx® microprocessor debugger (XMD) to debug programs and verify systems using the Microblaze processor as shown in Figure 1 and Figure 2 [17], [28].  Figure 3 shows the design of the blocks associated with Microblaze, in which both hardware and software sides are well specified. This work involves controlling a stepping motor by the embedded processor MicroBlaze with these devices (Figure 4). The implementation of C code, in the local memory of the MicroBlaze, can control and link all the inputs/outputs by the processor with its peripherals. These connections are identified by addresses, drivers, and management parameters; for each component when generating the stream bit file of the XPS environment. After having generated all the necessary files for the hardware project, the software part offers us an important list of parameters, functions, variables, and libraries that ensure compatibility between everything that is hardware and software.

Amplify the low power
To operate and control the stepper motor with a respectable power from the MicroBlaze, a ULN2803 [29]-[31] circuit is used to amplify the low power signals and to have 8 switches controlled (8 Darlingtons) each by a circuit pin, as showing in Figure 5. Each of these eight channels can be opened or closed independently of the others and is capable of driving a charge to 40 V with a current of 500 mA. The main limitation resides in the total dissipation power of the circuit and which is around 0.7 W for a temperature of 85 °C [32]- [34].

The stepper motor
The Microblaze will control the unipolar stepping motor whose rotor is made up of a permanent magnet (in ferrite), and the stator by the midpoint windings. The latter is always supplied with a polarity of the same sign and a succession of alternating poles: whose axis model makes a complete round in 24 steps (one step corresponds to 360/24=15°). At each pulse of the control signal corresponds to the level of the rotor, a defined angular displacement called "steps" or "mechanical increment". The rotational speed is a function of the pulse frequency. In our validation example, the motor will be controlled in half-step mode. Each of the above sequences describes the stepping when the stepper motor is within its assigned step size (in this case 15 degrees). The combination of these two sequences allows the intensification of half of the motor. Figure 6 represents ULN2803, used to drive the stepper motor by a four-vector signal of the digital PWM. In this setup, it is used to drive the activation of a half coil. For this, the same control signal from 0 to 219 direct contact of the collector (the half-coil supplied in Vcc) with the emitter linked to the ground. This mode of operation is multiple simultaneously with a time shift in four vectors (four half-coils). The software part of the Xilinx SDK allows us to determine with embedded C, the different operating modes such as full-step mode, half-step mode, and micro-stepping mode. The point of this study is to examine the half-step mode, which doubles the number of steps that the motor can take per round, so two winding halves are powered at a time in the second sequence. This increases motor torque, but also increases the power consumption by the engine system. In fact, in this mode, the chronogram of this command is a mixture of two-phase and onephase. Figure 6. Activation assembly of a half-coil by the darlington transistor

The choice of the PWM frequency
The microcontroller PWM outputs use timers (or counters) with their options. For our case, the timers are embedded with the Microblaze in the FPGA chip by a C code and with the same options [35]. The choice of the resolution, overflow value (or comparator), and prescale come from the frequency of rotation, as demonstrated in Table 1. The generation of a single digital PWM signal is done by a block in the software part programmed in embedded-C. To control this stepper motor, it is necessary to multiply this block by four to attack the four phases. The Microblaze has been configured on the XUPV5110T FPGA card, which uses a clock frequency of 100 MHz with 120 MHz amplification for software analysis in Figure 7. − The frequency with prescale: the prescale can also be the number of instructions loops in the C code.

Experimental results
To obtain a rotation of the motor, it is necessary to apply the special levels in phases. The simulation study on ISim of the XPS interface shows us the supply of four phases following the timing diagram of the voltages for the different power supply sequences of the stepper motor. This simulation allows us to verify the correct operation of the embedded circuit and to ensure the development of both parts (software and hardware), as well as the compilation of the C-embedded code. The ISim interface shows us perfect execution and power synchronization to the stepper motor pins in Figure 8.  Table 2 and Table 3, show the number of the used logic slice registers, slice LUTs, and others for input/output peripherals. Power report for the control system [36]: the power part attacked by the embedded digital PWM creates a low thermal dissipation effect by the PWM. Indeed, all the energy is devoted to motor rotation. Which is interesting for embedded systems running on batteries. The control of the stepper motor, which is based on the Arduino or the microcontrollers with external architecture, shows a strong increase in the level of energy consumption caused by the wiring (big section). On the other hand, the proposed method ensures its connections by MOS transistor, which activates in voltage.

Validation on the FPGA board
This card must therefore transform the continuous signal that it receives into 4 rectangular signals shifted imperatively to turn the stepper motor. In addition, it must be possible through this card to adjust the speed and direction of the motor, as well as its state (on/off). The following oscilloscope allows us to visualize a signal digital PWM of the four control signals in Figure 9.

Comparison and discussion of results
The current technique in the embedded circuit has marked some advantages in front of the configuration in verilog hardware description language (VHDL) at the level of ( Table 4): − "Number of stuck IOBs" 3.87% use of inputs/outputs for the bus against 1% on board, which proves the speed of data transmission for the latter. − "Total memory used (KB)" more than 144 KB of data recording against 144 KB on board, which proves the gain in memory space to store enough data. − The possibility of configuring several embedded microprocessors. A comparative study was made at the level of energy consumption for the control of the stepper motor by the proposed embedded method and the Arduino method. The following table shows that the Microblaze-based control unit consumes 29 times less power than the one based on an Arduino-based microcontroller. This proves the reduction of the Joule effect and the possibility of installing a large number of stepper motors (Table 5).  The FPGA components integrate all the cells necessary to form an autonomous embedded hardware platform: logic gates, microprocessors (MicroBlaze), memories, fast inputs/outputs, and intellectual properties. An embedded system is a programmable electronic circuit dedicated to a specific task. It is a set of hardware and software [17], which often applies the techniques of real-time. The stepping motor control by an embedded system based on Microblaze ensures: − Multi control: the FPGA card allows us to have several inputs/outputs, consequently several stepper motors. − Reduced size: the control unit embeds the Microblaze processor, connections, components, and memories in a single chip at a rate of 25%. This leaves three-quarters of free space for other systems. − Low power consumption: the control unit connections can be integrated into an embedded circuit as MOS transistors, resulting in low power consumption (around 5664 mW). The consumption of the entire system depends on the power part represented by the windings of the stepper motor, the energy conversion circuit, and the connection wires (Joule effect). − Reliable operation: the Microblaze processors generate a digital PWM signal with a stability step and high mechanical torque.

CONCLUSION
Embedded systems surround us and we are invaded by them, faithful to the post and ready to help us. We come across dozens of them every day without knowing it. They are everywhere, discreet, efficient, and dedicated to what they are intended for. And they will be more and more present. They have been saturated with more or less complex electronics and more or less advanced computing. The FPGA card virtex 5 has a large number of inputs/outputs multi-axis control (multi-stepper motor) is possible to be derived by a mono processor electronic structure. In addition, the programming of these multi-axes is done by the C code which puts all the files, drivers, functions, and libraries into service to identify each component. These can be managed and easily controlled in real-time with very low consumption. This embedded control of the stepper motor allows us to propose as perspectives in real-time; the control of a robotic arm made up of three to five stepper motors. As well as the control of intelligent bands which requires very precise positions in the industrial future. Due to the system architecture, an FPGA can drive multiple stepper motors simultaneously without increasing processing time. The embedded method can multiply the number of controlled stepper motors because the configuration of embedded microprocessors requires a larger FPGA. This technique allows the embedded circuit under a 3D printer vis-à-vis the gain in energy and implantation space. The latter allows us to add programs, processing blocks, and command blocks. As perspectives, we can also try to develop or use a hardware module microprocessor for example, and integrate it into the card to allow lightening the calculations to gain in speed and especially to save resources for other applications.

Rachid Elgouri
is a Professor in the National School of Applied Sciences at Ibn Tofail University in Kenitra, Morocco. His research interests in electrical engineering and renewable energy include the modeling and design optimization of renewable energy systems, the development of microelectronic energy management systems and power electronic converters for renewable energy sources applications, and the development of sensors and electronic measurement systems and information security. He can be contacted at email: elgouri.rachid@yahoo.fr.

Laamari Hlou
is the Director of Laboratory electrical engineering and energy systems, Physics department, Faculty of Science, Ibn Tofail University, Kenitra Morroco. His research interests in electrical engineering and renewable energy include the modeling and design optimization of renewable energy systems, the development of microelectronic energy management systems and power electronic converters for renewable energy sources applications, and the development of sensors and electronic measurement systems and information security. He can be contacted at email: hloul@yahoo.com.

Mohammed Benbrahim
is Deputy Director of Pedagogic in the National School of Applied Sciences (ENSA). He is a research professor at the Department of Electrical and Automotive Engineering, Laboratory of Advanced Systems Engineering (ISA), National School of Applied Sciences (ENSA), Ibn Tofail University, Kenitra, Morocco. He works on a research project in instrumentation and measurements and telecommunication engineering. He can be contacted at email: benbrahimsimo@yahoo.fr.