Balancing Ball Final Report V3
-
Upload
alex-mustaine -
Category
Documents
-
view
220 -
download
0
Transcript of Balancing Ball Final Report V3
-
7/30/2019 Balancing Ball Final Report V3
1/32
MECHATRONICS FINAL YEAR PROJECTFONTYS UNIVERSITY OF APPLIED SCIENCES
Ball Balancing Project
Group Members:
-Rabindra Rijal
-Huynh Phu Khanh
-Frank Dooms
-Bruce Appleton
Author: Bruce Appleton
-
7/30/2019 Balancing Ball Final Report V3
2/32
Ball Balancing Project Page 1
Summary
From the early stages of the project it became clear that a good construction was one of the key
elements needed for this project to work. A couple of concepts were sketched and finally a
construction concept with two independent axes was used. Some of the parts were to be designedfrom scratch in Autodesk Inventor (CAD) and later fabricated using the machinery in the mechanical
engineering labs.
The project was to balance a ball on a flat surface and to achieve this some form of feedback for the
balls exact position on the flat surface was needed. For this it was decided to use a ten inch resistive
touch screen. The touch screen can then provide the necessary feedback for position. A dedicated
touch screen controller was added to read the coordinates and relay them to the PC via RS232.
The touch screen controller relayed the touch screen coordinates via RS232 into labview. Although
the touch screen controller supports USB, it was decided to use the RS232 interface due to protocol
simplicity. The means to read the coordinates via RS232 had to be implemented in labview.
To control the actuators a control system would have to be implemented using the touchscreen for
feedback. It was decided to implement the controller in labview so we could change its parameters on
the fly. To control the servo-motors a PWM signal would need to be generated within labview and
supplied to each motor.
The Ball Balancing project was a challenge, but we worked well together to achieve a lot.
-
7/30/2019 Balancing Ball Final Report V3
3/32
Ball Balancing Project Page 2
Glossary
SISOSingle Input Single Output
MIMOMultiple Input Multiple Output
PWMPulse Width Modulation
CADComputer Aided Design
VIVirtual Instrument
-
7/30/2019 Balancing Ball Final Report V3
4/32
Ball Balancing Project Page 3
List of Figures, Graphs and Tables
Figure 1 5-wire resistive touch screen concept ....................................................................................... 8
Figure 2 touch screen controller.............................................................................................................. 8
Figure 3 construction concept sketch...................................................................................................... 9
Figure 4 aluminium brace (CAD view) ................................................................................................ 10Figure 5 aluminium brace dimensions.................................................................................................. 11
Figure 6 Translation arm (CAD view) .................................................................................................. 11
Figure 7 translation arm dimensions..................................................................................................... 12
Figure 8 universal joint (CAD) ............................................................................................................. 12
Figure 9 HUCO universal joint dimensions.......................................................................................... 13
Figure 10 Rod-end bearing (CAD) ....................................................................................................... 13
Figure 11 IGUS rod-end bearing (EBRM-05) dimensions ................................................................... 14
Figure 12 Construction CAD model ..................................................................................................... 14
Figure 13 Final Construction (real image) ............................................................................................ 15
Figure 14 Ball on plate model concept ................................................................................................. 16Figure 15 Motor time constant measurement circuit ............................................................................ 18
Figure 16 System Connections .............................................................................................................. 23
http://e/DocD/Mechatronics%20Project/Documents/Balancing_Ball_Final_Report_V2.docx%23_Toc284185048http://e/DocD/Mechatronics%20Project/Documents/Balancing_Ball_Final_Report_V2.docx%23_Toc284185048 -
7/30/2019 Balancing Ball Final Report V3
5/32
-
7/30/2019 Balancing Ball Final Report V3
6/32
Ball Balancing Project Page 5
-
7/30/2019 Balancing Ball Final Report V3
7/32
Ball Balancing Project Page 6
Introduction
For our final year of study we were to undertake a project in mechatronics lasting the semester. The
project chosen was the Ball Balancing project. We were to design a system whereby we could
balance a ball on a flat surface using actuators. This project was a great opportunity to gainknowledge in the field of mechatronics.
The goal of the project is to build and implement a device that can balance a ball at any set point by
tilting the flat surface allowing the ball to roll. The surface is tilted by actuators located below it. The
mechanics by which the actuators transfer torque to the flat surface will have to be designed and built.
The control system will have to drive the motors to make the ball move to the allocated position. In
addition a feedback system will need to be implemented so the balls current position can be known at
all times.
-
7/30/2019 Balancing Ball Final Report V3
8/32
Ball Balancing Project Page 7
Project overview
Block schematic of the system
Below is a block schematic of the entire system.
Description of Individual Blocks
PC:
The controllers are implemented on a Personal Computer using National Instruments LabVIEW. The
system must be running Windows XP or higher with a RS 232 COM port and PCI cards installed.
- The COMport is required to input current position of the ball via Touch Screen Interface.A USB to RS232 converter maybe used where no COM port is available.
- A PCI card is required to connect the National Instruments Adapter BNC 2110.Motors:
The existing servo motors will be used for movementon each axis. The servo motors used are BMS-620MG from Blue Bird Technology.
They have following specifications:
Weight: 50 grams
Dimensions: 40.5 X 20 X 42 mm
Torque at 4.8V: 9.1 kg-cm
Torque at 6.0V: 10.6 kg-cm
Speed at 4.8V: 0.15 sec/ 60 deg at no loadSpeed at 6.0V: 0.13 sec/60 deg at no load
Touchscreen:
The Touch Screen used for the project is a Five-Wire Analog Touch Panel from Higgstec Company.
Major features and specifications of this device are noted below:
Input Mode: Stylus or Finger
Cable: FFC (Flat Flexible Cable)
Frame Size: 248.920.30 X 186.690.30 mm
View Area: 219.900.20 X 167.830.20 mm
Active Area: 215.900.20 X 163.830.20 mm`
Total Thickness: 2.200.20 mmTail Length: 2056.00 mm
PC
(LabVIEW)
Motor Construction
+ Touch Screen
Touch ScreenInterface
X, Y
-
7/30/2019 Balancing Ball Final Report V3
9/32
Ball Balancing Project Page 8
Operational Temperature: -100C to +700C
Loop Resistance: X: 20 to 500 Y: 20 to 500
Figure 1 5-wire resistive touch screen concept
Touch Screen Contr oller :
As we intended to build a control system for our project, we need feedback from the touchscreen to
know the current exact location of the ball. However the touch screen described above gives us only
analogue values from different locations and our controller will be implemented in LabVIEW inside a
PC (digital form). Additionally, these analogue signals from the screen need further calculation to be
read as X & Y positions of the ball. For these reasons, and also to save time, we intend to use a
dedicated touchscreen controller with USB interface to PC (USB-R5W-HT580-R) from Higgstec
Company (same as Touch screen manufacturer).
Figure 2 touch screen controller
Power required: +5VDC (Max. 150mA, 50mV peak to peak max ripple)
Protocol: COM: 9600 BPS baudrate 8 Data Bits
USB: USB1.1 full speedResolution: Sample 1024 X 1024 (12 Bits)
Report Rate: COM: Min. 63 Points Per Second (PPS)
USB: Min. 86 PPS
Response Time: Max 20 ms
Requirements:Resistance 30 to 500
-
7/30/2019 Balancing Ball Final Report V3
10/32
Ball Balancing Project Page 9
Construction
Concept
The figure below shows the construction concept for the balancing ball project.
Figure 3 construction concept sketch
The main parts:The main parts described below can be found in the concept sketch above.
LINKAGE JOINTSLocated either side of the linkage bars, providing connections between the
motor and the backing plate.
U-JOINT- Allows the screen plane to move in X and Y directions only.ALUMINIUM BRACEProvides a means for the linkage bars to be connected to the backing plate.TOUCHPAD SENSORResistive touch screen used for position information.BACKING PLATE - Provides added strength and a supporting base for the glass touch screen.GAURDRAILSKeeps the ball on the touch screen.GROUND PLATEProvides a stable base for the whole construction.
TRANSLATION BARConnects motor shaft to the linkage bar.
-
7/30/2019 Balancing Ball Final Report V3
11/32
Ball Balancing Project Page 10
After some thought we decided this would be the best construction for our project. Reasons forchoosing this construction:
Axes are independent. This gives us the advantage of being able to develop and test each axisseparately; because a single motor works on each axis.
Firm and stable if built correctly.
Project implementation time is reduced using a simpler axes concept, whereby the motors arenot coupled.
Modelling and controller development are less complex with independent axes.
Construction components
However some of the parts such as the aluminium brace and translation arms would have to be
fabricated out of aluminium from scratch. The linkage bars would need to be threaded both ends to fit
into the rod end bearings as well as building the whole supporting structure. All in all there was quite
a lot of work to be done in the mechanical engineering labs. The parts are described below in more
detail.
Aluminium Brace
The aluminium brace is fabricated from a single piece of aluminium and is located underneath the
perspex plane. Two rod-end bearings are located either side, fixed in place with pins. At the centre of
the brace there is an extrusion for the universal joint to fit in. The aluminium brace provides a means
to transfer torque to the plane.
Figure 4 aluminium brace (CAD view)
-
7/30/2019 Balancing Ball Final Report V3
12/32
Ball Balancing Project Page 11
Figure 5 aluminium brace dimensions
Aluminium Tr anslation Arms
The translation arms are connected to each motor.
Figure 6 Translation arm (CAD view)
-
7/30/2019 Balancing Ball Final Report V3
13/32
-
7/30/2019 Balancing Ball Final Report V3
14/32
Ball Balancing Project Page 13
Figure 9 HUCO universal joint dimensions
Rod-end Beari ng
Type 1: IGUS rod-end bearings (EBRM-05)
Figure 10 Rod-end bearing (CAD)
-
7/30/2019 Balancing Ball Final Report V3
15/32
Ball Balancing Project Page 14
Figure 11 IGUS rod-end bearing (EBRM-05) dimensions
The Final Construction
CAD Model
The final CAD model has motion just like the real construction. Each axis can be moved
independently and an animation for the working principal can hence be created.
Figure 12 Construction CAD model
-
7/30/2019 Balancing Ball Final Report V3
16/32
Ball Balancing Project Page 15
Construction implemented in reality
The images below are taken of the real construction.
Figure 13 Final Construction (real image)
-
7/30/2019 Balancing Ball Final Report V3
17/32
Ball Balancing Project Page 16
Modelling Section
Our system model is divided into 2 sub models:
- The motors + the construction: input is the duty cycle of the PWM signal controlling themotor and output is the angle of the plate: H(s)
- The ball on a plate with an angle: input is the angle of the plate and output is the position ofthe ball: G(s)
Ball and plate
Figure 14 Ball on plate model concept
The angle of the plate will create force acting on the ball which then again result in a change of theball position.
The inclination is considered the x-coordinate.
Let acceleration of the ball be denoted as ''2
2
xdt
xd
The force due to translational motion is then
Ftx= mx
Rotational kinetic energy of the ball is:
Krot =
Prot = Tr* =
=
''/)/( 22
xR
J
dt
RxdJ
dt
RvdJ
dt
dJT br
H(s) G(s)PWM dut Angle Position
-
7/30/2019 Balancing Ball Final Report V3
18/32
-
7/30/2019 Balancing Ball Final Report V3
19/32
Ball Balancing Project Page 18
Motors and construction
As a servo has internal feedback and control, it would take a lot of time and effort to dismantle the
motor and model it correctly. To simplify our motor model through observation of the motor
behaviour, we will just assume the model as a 1st order transfer function. The only value we will have
to determine in this case is the time constant tau.
In order to obtain this, we will put a load on the motor that is similar to our construction. Then a step
input of the PWM duty cycle (D) will be apply to the motor and we will measure the output angle
over time to find the time constant. After measuring the time required to get from a position zero to a
45 degree position, one can determine the motor constant m which can then be added to the Matlab
system model.
The motor will be attached to a potentiometer, and with a one shot logger, we can measure the voltage
over the potentiometer (which is then proportional to the motor angle) and then determine the time
constant of the motor + construction.
Figure 15 Motor time constant measurement circuit
Motor torques:
On the motor with long shaft:
BARHorriBARVertBARHorriBARHorriBARHorriHingeBARHorriScreenLong LMLMLMLMT 2
1
4
1
4
3
On the motor with short shaft:
BARHorriBARVertBARHorriBARHorriBARHorriHingeBARHorr iScreenShortLMLMLMLMT
2
1
4
1
2
1
-
7/30/2019 Balancing Ball Final Report V3
20/32
Ball Balancing Project Page 19
mscreen = 564g
mhinge = 96 + 2*24 = 144g
mhoribar= 53.5g
mverbar = 4.5g
Base on the formula and data above, we can calculate the load weight use to replace the construction
for the motor with short shaft is 349.25g and one with long shaft is 490.25g.
With the time constant measured as 16ms, we can determine the transfer function of the motor and the
construction:
As the time constant is 16ms, the angle reaches the wanted position after 5 times of = 80ms.
-
7/30/2019 Balancing Ball Final Report V3
21/32
Ball Balancing Project Page 20
Simulation results
A simulation with the 2 models combined show the following result:
With a 0.005 duty cycle step input:
Angle Distance
Potential energy
-
7/30/2019 Balancing Ball Final Report V3
22/32
Ball Balancing Project Page 21
Translation kinetic energy Rotational kinetic energy
As we can see from the simulation result, the change of the potential energy is always equal to the
sum of changes of 2 types of kinetic energy (law of conservation of energy).
The system is then connected to a PID controller which gives the following closed loop response:
Distance
-
7/30/2019 Balancing Ball Final Report V3
23/32
Ball Balancing Project Page 22
Angle
With the help of the PID controller, the ball reached the desired position after approximately 10
seconds. After the ball reached the desired position, the angle of the plate is fluctuating around. This
is an expected behaviour as the plate should change angle to compensate any change in position of the
ball away from the desired position.
-
7/30/2019 Balancing Ball Final Report V3
24/32
Ball Balancing Project Page 23
Implementation in LabVIEW
Connection Diagram
As shown in the above diagram, the controlling of the ball position with LabVIEW is mostly defined
by the interfacing between:
(a)The Touch Screen Controller [via Serial COM Port in PC> 5 wire resistive Touch
Screen]
(b) The NI PCI 6024E - Card [via BNC-2110> Motors [counter 1 and counter 0]] (see
below)
USB/COM Port
[FTDI drivers]
PCI 6024E card
[NI DAQ drivers]
USB Serial
ConverterTouch Screen
Touch Screen
Controller
[COM Mode]
PC
with
LabVIEW
BNC 2110
Connector
X Motor
Y- Motor
Counter -1
Counter -0
5 Wire
Figure 16 System Connections
-
7/30/2019 Balancing Ball Final Report V3
25/32
Ball Balancing Project Page 24
The program layout is such that we read the current position of the ball on the screen and send PWM
signals to the respective motors to bring the ball towards center position.
In short, we will read from the TS controller in Serial mode [COM3 in this case]; condition the signals
via PID Controller and generate PWM signals [Dev1/Ctr0 and Dev2/Ctr1]. These three input and
output processes must be done at the fastest possible rate; for which we will use 3 parallel while
loops:
One for reading from the touch screen One for generating PWM signals based on PID controlled variable for X Motor One for generating PWM signals based on PID controlled variable for Y Motor
For this purpose, following 7 VIs have been generated:
Reading from Touch Screen
Reading from the Touch screen involves following processes:
- Configuring and opening port- Read 5 bytes at a time- The bytes come in following order
o Byte 1: A0this value is prefixed every time with the coordinates, so it is easy tointerpret, validate and convert.
o Byte 2 and 3X Coordinateso Byte 4 and 5Y Coordinates
- Initially, the Read Buffer is filled with :o Byte 1 : A0o Byte 2 : 08o Byte 3: 00o Byte 4: 08o Byte 5: 00
- The conversion of 08 00 gives 512 (described later). Since the touch screen co-ordinatesare (1024, 1024) we always start with (512,512) the center of screen.
-
7/30/2019 Balancing Ball Final Report V3
26/32
Ball Balancing Project Page 25
VISA Open
These are the settings to open the COM Port where the Touch Screen Controller is connected.
By installing the Virtual COM Port drivers from FTDI, the USB ports are now accessibleserially. The Touch Screen Controllers datasheet specifies:
o Baud Rate: 9600 Bpso RTS [Request To Send] set to HIGH
The rest are general settings for a serial transmission.
Validate Data
The coordinates are prefixed with A0, so we search the array for value A0 (=160 decimal) and
take 4 consecutive bytes out of that and convert them to X and Y positions (integers).
Byte to (x, y)
-
7/30/2019 Balancing Ball Final Report V3
27/32
Ball Balancing Project Page 26
For each axis, the controller gives 2 bytes. During the conversion process, each nibble in
hexadecimal system is converted as follows:
If received bytes = 08 and 00 then x-position = 0X163
+ 8X162
+ 0X161
+ 0X160
= 512
So there is a byte to nibble conversion required because computers can only represent 8-bit
data. We ignored the MSB value because it is always 0.
Byte to nibble
This VI splits the byte to 8bit array and takes only last 4 bits (nibble) and converts it to a
number again.
Then the X and Y Values are displayed by configuring the Display Graph accordingly.
-
7/30/2019 Balancing Ball Final Report V3
28/32
Ball Balancing Project Page 27
Controlling the Motor
The loop controlling the motor is as shown below:
This loop interacts with the motor via PCI 6024E card installed inside the CPU and connected via a
BNC2011 connection toolbox. By using the National Instruments Measurement & Automation
Explorer program, one can see that this device is installed as Device 1 and it has 2 counters Ctr0 andCtr1. We will generate PWM signals via these counters and drive the motors on each axis.
From the left side the blocks are described as below:
- DAQmx Create Virtual Channel: Create and initialize a output channel [Dev1/ctr0].The most important parameters are:
o Frequency: we use 50Hz by default, so the duration is 20ms standard.o Starting Duty cycle: 0.06
- DAQmx Timing:The second block is about timing. The Implicit timing is used when nosampling time is needed and continuous samples are taken.
- DAQmx Start Task: The DAQMx VI block initiates the pulse generation.- Then firstly, for each variable PWM controlled variable is determined. We take the input
(a local variablefrom Touch Screen Readers X value).
- DAQmx Write: This sends the actual pulse trends to the hardware. Since the duty cyclechanges with the position of the ball, the duty cycle has to change dynamically. So, the
local variable has been introduced and new values are processed with a CASE
STRUCTURE .
- A delay [50ms] higher than the pulse width of PWM [20ms] is required for efficientoperation
-
7/30/2019 Balancing Ball Final Report V3
29/32
Ball Balancing Project Page 28
PWM_X
The duty cycle required for the motor is a controlled variable with PID Controller. For the PID
Controller:
-- The set-point is 512, the center position.- The process variable is the current ball position.- The gains are and output range are real-time adjustable from front panel.- Time constant = 0.2msBut in this case we brought down the values by decade because the contact surface of the ball never
reached 512 and it kept oscillating. The final control was not fully accurate but the results were
improved. So the value would be floating around 510 ~ 519.
Here are the PID parameters we used:
P = 2.5
I = 0.2
D = 0
Output range: High = 0.0015, Low = -0.0035
PWM_Y
-
7/30/2019 Balancing Ball Final Report V3
30/32
Ball Balancing Project Page 29
Similar to X, but since the motors are aligned in opposite directions, the duty cycle has to be negated.
The dtfor X is 0.2ms and 0.5ms for Y that is because X is longer than Y, so the ball needs a larger
push in X direction.
The parameters used are:
P = 2.5
I = 0.2
D = 0
Output Range: HIGH = 0.0013 LOW = -0.0025
Operators Control Panel
This is the operators control panel with indicators and controls. The PID gains for X and Y shown
and output range for X and Y are default values which we choose. The red dot in the graph shows the
current ball position in touch screen.
-
7/30/2019 Balancing Ball Final Report V3
31/32
Ball Balancing Project Page 30
Problems and Recommendations
The system is mechanically stable and well controllable. In LabVIEW, by using a better
implementation of PID Controller, a stable end result could be obtained.
There is a problem with PWM generation. The
problem says that it cannot update the pulse
trend fast enough. The solution is to keep a
delay greater than the width of the PWM. In
our case the PWM was 50Hz signal (= 20ms)
and the while loop had a 50ms, but it still
didnt fix the problem. More detailed study is
required here.
The two counters must be synchronized for
stable operation which we could not
implement due to time shortage.
This will be the best educational project for
both for mechanically building and controlling the
system.
-
7/30/2019 Balancing Ball Final Report V3
32/32
Conclusion
Although this project was a challenge our group succeeded in creating a working system. The ball
does not settle at the desired position but instead moves near or around it with close proximity.
Further fine tuning of controllers as well as construction improvements can improve this. Themodelling of the system helped group members to understand but did not help in controlling andtesting the system as we model the process in continuous time, but the actual system works withdigital (discrete) signal.
Recommendations
Improvements to the construction to reduce play between joints.
Servo motors with higher position accuracy (improved construction may also contribute to this).
Adding springs to the construction to dampen certain oscillations.
A MIMO and/or digital control system would work better.
The current system could be enhanced by introducing a profile that the ball could follow as opposed
to a single point.