Hardware Design of Basketball Robot based on Flyback Topology and Verilog HDL

This paper mainly introduces the mechanical structure of the basketball robot and its motion control system. The framework of basketball robot is made of aluminum section 2020, which provides steady support while running. Upper chassis and lower chassis bring the parts closer producing an integration of the whole structure. Motion control of robot depends on a method of using Verilog HDL to generate PWM in order to control the velocity of motor and to detect it. This method is successfully applied to basketball robot.


Introduction
The Basketball Robot Competition is an international robot competition launched and sponsored by the Taiwan Yushan Robot Association. The research parts on basketball robot were mainly divided into bottom control system, host computer control system, vision system and electromagnetic ejection system.

The framework of robot
The density of aluminum profile is only 2.7g/cm3, which is about 1/3 of that of steel, copper or brass density (7.83g/ cm3, 8.93g/ cm3) respectively. Under most environmental conditions, aluminum can display excellent corrosion resistance, including air, water (or brine), petro-chemistry and many chemical systems. Aluminum profiles are non-ferromagnetic, which is an important feature for the electrical industry and the electronics industry. Aluminum profiles are not self-ignited, which is important for the application of loading and unloading or contact with flammable and explosive materials.
The use of aluminum section 2020 to establish the framework gives robot better stability and the lighter weight.

Electromagnetic ejection system
For shooting robot, the ejection structure of basketball is a very important part. At present, the most common way of ejection is electromagnetic ejection.
Electromagnetic ejection is to use electromagnetic energy to drive the projectile to move outward. It is a new linear propulsion technology, which is suitable for short stroke to launch large load. It has a wide application prospect in military, civil and industrial fields. Because its working mechanism is to use the coupling magnetic field between the driving coil and the accelerated object, the essence of the coil type electromagnetic ejector can be understood as a linear motor. The electromagnetic ejection mechanism is mainly composed of three parts: coil, armature and nylon bar. Its basic principle is: at the beginning, the iron core is located in the rear position of the electromagnet, and the electromagnetic iron will produce a strong magnetic field at the moment. Under the effect of the magnetic field, the iron core is forced to move forward and ejected the basketball. Because the magnetic field generated by the ejection moment affects the data communication between the computer and Compact RlO, shielding the magnetic field. A shielding material with high permeability and not easily magnetized is added to the periphery of the electromagnet. After the electromagnet is added to the shield, the magnetic force line above 90% passes through the shielding body, and the external magnetic field of the shield is very weak, thus eliminating the influence of the magnetic field on the data communication. The quality of armature and nylon rods made in this paper is 0.546kg, capacitance capacity C is 1000F, and the initial voltage U is 420V.
The core of DC switching power supply is a DC -DC converter. DC DC -DC rotation The converter can be divided into the non-isolated DC -DC converter and the isolated DC -DC converter, and the isolated DC -DC converter of single tube has two kinds of forward and flyback.
For the conventional topology, we only consider the limited boost ratio of the boost chopper, which cannot meet the requirements of the electromagnetic ejection mechanism of the shooting robot. (its schematic diagram and work waveform as shown.) The flyback topology is used to achieve the high lift ratio. The transformer in the flyback circuit acts as an energy storage element and can be regarded as a couple of coupled inductors. After being switching on, the D is off state, the current of the winding W1 increases linearly, and the inductance energy storage increases. After the T1 is shut down, the current of the winding W2 is cut off, and the magnetic energy in the transformer is released to the output end through the winding and the D.
The output voltage can be regulated by adjusting the duty ratio or the load value of the switch tube. According to the above principle, the circuit diagram and circuit board are designed based on the actual needs. By inputing PWM signal from the PWM in end, the different output voltage U0 values are adjusted.

Measuring wheel
3 motors separated in 120°to drive 3 wheels which provide the multidirectional choices. Each wheel gets a corresponding measuring wheel that is equal to odometer. Odometer is a method of estimating the position of an object as time changes by using data obtained from a mobile sensor. The method is used on many kinds of robot systems (wheel or leg) to estimate, rather than determine the distance between the robots moving relative to the initial position. This method is very sensitive to errors caused by velocity and time integration. Fast and accurate data acquisition, equipment calibration and processing are essential for efficient use of this method.

PWM function module
The basketball robot is mainly composed of decision-making upper computer, vision subsystem and tackled subsystem. The electromagnetic ejection subsystem and the bottom motion control system are made up. The work flow of the whole system is as follows: the visual subsystem collects the target image information to the decision computer. After the upper computer is analyzed and processed, the signal is sent to the ground motion control system to control the movement and send the command signal to the shoveling subsystem to carry out the shovel, and after the shovel is completed, the ground motion control system is driven to control the machine. People continue to exercise, open the visual subsystem, continue to look for the calibration board, and send the information of the calibration board to the decision. Verilog HDL is used to program and generate PWM modules. The compiling environment is Quartus II 8.0 Quartus II providing a fully integrated development package environment independent of the circuit structure. It has all the characteristics of digital logic design. It is a more practical EDA software.
The hardware system used in this paper is the Cyclone II series FPGA device of Altera Company, but Altera does not provide the ready PWM kernel. Therefore, the user needs to design the corresponding IP module and integrate it into SOPC Builder to realize the reuse of the IP kernel. The IP kernel here is implemented in the Verilog speech. The software system of this paper is mainly embodied in the decision-making host computer. In the VC2010 compiler environment, the C++ programming protocol is connected to the lower machine through the USB communication module. The main function is to make the decision path planning by obtaining the speed of the motor.
The realization of PWM function module software is mainly to read and write PWM related registers, so as to control the output of PWM signals. PWM control software program mainly includes: PWM hardware initialization program, PWM parameter setting function, PWM output control function and so on. The PWM signal drive motor will produce life and death zone when the motor is running. This is because the full bridge circuit will lead to the upper and lower bridge arm at the same time, causing the short circuit and avoiding the dead zone. The method is to call the delay function before the PWM signal output, which can avoid the dead zone phenomenon and play the dead zone protection. .
The hardware logic of PWM is mainly composed of three parts: Task logic. The PWM task logic structure is used to describe the logic of the PWM functional modules, mainly composed of clock signals (CLK), output signals (PWM_OUTPUT), enabling registers, 32 bit counters, and 32 bit comparison circuits, as shown in Figure 2. Task logic is the most basic and critical part.
Register file. Register is the way of internal task logic and external information exchange. The peripheral control of Avalon bus interface can be realized by accessing the value of registers.
Avalon bus interface

Measuring speed
There are three commonly used methods of motor speed measurement, M, T and M / T. The M method is suitable for the high speed rotation of the motor; the T method is suitable for the low speed rotation of the motor; the M / T method combines the two, and is more suitable when the motor is rotating at high speed and low speed. M / T speed measurement: when the motor runs, the speed of the robot is fast and slow, and the first two have some limitations. For the first method, the number of M1 at high speed is relatively large, and the error is relatively small. At low speed, M1 is relatively small or even less than 1, and the error is relatively large. On the contrary, the error of the second methods is small, and the error is very high at high speed. The M / T method combines the first two, and the error is relatively small at high speed and low speed. The number of pulses output in the Tc time is M1, the number of high frequency clocks in the same time interval is M2, the frequency of the high frequency clock is f, the number of the output pulse of the motor is Z, then the accurate velocity is Tt = M2 / F, the speed of the motor is: when the motor turns, the calculated values of M1 and M2 will vary. At high speed, the speed of M is equal to that of T. This paper uses the M / T method to measure the speed, and uses Verilog HDL to realize it. In the process of writing, 2 orthogonal pulse signals, A and B, are taken into account of the grating output of the photoelectric encoder of the motor. When the wheel is clockwise, the A pulse exceeds the 1 / 4 cycles of the B pulse; when the wheel rotation is anti-clockwise, the A pulse is backward B pulse 1 / 4. A cycle. The processor judges the positive and negative rotation of the wheels according to the phase relationship between A and B pulses. At the same time, the four frequencies doubling of the counter can be realized by capturing the rising and descending edge of the A and B phase signals; and the discrimination is realized by judging the level of the A and B at each jump edge.

The controller part of the system hardware design
The controller of the robot is controlled by microchip PIC16F873A microcontroller.
The chip, plus the necessary peripheral circuit, is the main control board of the cost robot. Among them, PIC16F873A is the 8 bit microprocessor of microchip. It has the characteristics of small size, high integration, easy expansion, low power consumption, strong interruption processing ability and low price. It has a FLASH program memory of up to 4K * 14 bits, a 128 byte EEPROM data memory, and a PWM output with a 2 path selectable polarity and a wide operating voltage (2.0~5.5V).

The power supply part of the system hardware design
Because the electric current is very large in the beginning, it will destablize the power supply voltage, which affects the stability and reliability of the work of the MCU and the input circuit. Therefore, the dual power supply scheme is adopted to isolate the power supply from the single chip computer. Single chip microcomputer and sensor circuit are powered by 5V, the motor is powered by 12V, and the two parts of the power supply adopt Ni MH rechargeable battery with larger capacity. In addition, increasing the power supply voltage of the motor can improve the speed and strength of the robot trolley, thus improving the performance of the robot.

The hardware design of the motor driving part of the trolley
In order to make the robot car rotate in two directions and achieve precise speed regulation, the motor should be driven by H PWM circuit. Accordingly, I choose a small DC motor drive chip L298N with superior performance. The chip has the following advantages: 1) the output current is large (2A), and the voltage range is wide(6~46V), which can drive high power motor and provide the robot with strong power; 2) high efficiency, low power consumption; 3) overheating automatic shutoff function and feedback current detection function.
In order to make sure its smooth operation, six external demand diodes are added to the chip. Two motors on the left front and back wheels of the robot are connected to the H bridge type circuit A between Out1 and Out2, and two motors on the right front and back wheels are connected to the H bridge circuit B between Out3 and Out4. By adjusting the duty ratio of the pulse voltage waveform on the motor, the motion speed of the car can be adjusted. Through the control of the left and right motors, the basic control of the trolley's forward, backward and right turn can be realized.

Analysis of simulation results
The hardware part of the hardware description language Verilog HDL is made up of three files, which are p w V air interface. V, P M register file. V and PM t as K logic. V. The function is the task logic of design interface, register file and hardware, respectively. The interface part is connected to the Avalon bus, and the task logic part is connected to the robot motor drive part. Finally, it will be encapsulated into IP core and added to the SOPC component.
Because the PWM module designed in this experiment is applied to the universal wheel of the basketball robot, three PWM waveforms are needed to correspond to the three motors, but in the process of designing, we have devised a lot of PWM out D which is used to prevent any other waveform output problems.