You are on page 1of 21

AMERICAN UNIVERSITY OF SCIENCE & TECHNOLOGY

FACULTY OF ENGINEERING
DEPARTMENT OF MECHATRONICS ENGINEERING
LABVIEW
CCE 448
Balancing Ball on Plate
Prepared by
Rayan Haidar
Jad El Khansa

Presented to
Mr. Elie Abdo

January 15, 2016


Achrafieh Campus
1

Abstract
From the moment we decided our project theme, it was clear that a
good construction of the hardware needed was one of key elements
required for this project to work. A concept with two independent
axes was used, and the parts were designed, fabricated and
manufactured at a local mechanical workshop.
The idea of the project was to be able to balance a ball in motion on a flat
surface, receiving at the same time some digital feedback about the exact
position of the ball on surface. For such a procedure, we decided to use a
resistive a 13 inches rectangular resistive touch screen acting as the flat
plane surface, and the screen was to function via RS232 USB to serial
connector in order to relay the coordinates into the PC.
Coordinates of the balls position were to be relayed by the controller
via RS232 into LabView.
To control the actuators a control system was to be implemented
using the touch screen for feedback. Such control was to be
achieved by two servo-motors controlling the actuators. The motors
work through PWM signal that would be generated within LabView
and supplied to each motor respectively based on the X and Y
coordinates relayed into LabView code via the Touch Screen
controller. Such coordination would balance the ball on the plate and
keep it from falling off.
The Ball Balancing project was a challenge to us to complete in a
small amount of time, but we worked well together to achieve best
result possible with the resources we had available.

Table of Contents

Abstract............................................................................................................................
Table of Figures..................................................................................................................
I.

Introduction...............................................................................................................

II.

Objective.................................................................................................................

III.

Project Overview...................................................................................................

System Block Schematic.................................................................................................


Description of the system...............................................................................................
IV.

Labview:................................................................................................................

V. Table of Cost............................................................................................................
Results............................................................................................................................
.........................................................................................................................................
VI.

Conclusion............................................................................................................

VII.

References..............................................................................................................

Table of Figures

Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure

1. Schematic............................................................................................................
2. My DAQ................................................................................................................
3. Servo Motors.......................................................................................................
4. Touch Screen.......................................................................................................
5. Touch Screen Controller.......................................................................................
6. Central Pillar......................................................................................................
7.Servo-Motor connection to axis flexible pillar.....................................................
8. Final System Design complete...........................................................................
9. Reading from touch screen................................................................................
10. Visa Read.........................................................................................................
11. Validate Data...................................................................................................
12. Byte to (x,y).....................................................................................................
13. Byte to nibble..................................................................................................
14. Controlling the two servo Motors.....................................................................
15. Front Panel Final of main VI..............................................................................
16. Testing phase...................................................................................................

I.

Introduction

For the end of this Fall 2015 semester , we had to undertake a project
related to the Virtual Instrumentation course we have taken. Being
Mechatronics engineering students ourselves , we decided to undergo
a project where we can combine coding abilities with mechanical
knowledge. We were to design a system whereby we could balance a
ball on a flat surface using actuators controlled by electrical servo
motors , that themselves were controlled via a LabView PWM code.
This project was a great opportunity for us personally to gain extra
useful experience and knowledge ion the field of Electro-Mechanical
engineering.

II.

Objective

The goal of the project is to build and implement a some kind of


robotic machine that can balance a ball or any kind of rolling objects
by tiling the flat surface allowing the object/ball to roll. The device will
always try to manage to get the ball onto the center to the surface
plate based on the provided exact position of the ball and how far it is
located away from that center.
The resistive touch screen will have to act as the flat surface where
the ball is to roll. With its sensitivity, the touch screen controller will
be able to detect the location of the ball n the screen and thus relay
the information in the form of (X,Y) coordinates to the LabView code
in the PC through a USB to Serial RS232 connector defined in COM1.
The VI code will receive and analyze such data, therefore through NI
My DAQ device connecting and controlling the servo motors by a
PWM code will move the plate according. In other words, the control
system will have to drive the motors based on a feedback system
that will verify the balls known position at all times.

III.

Project Overview

System Block Schematic


Below figure 1 shows a block schematic of the whole system.

Figure 1. Schematic

Description of the system


PC:
On a personal computer / laptop the controllers were implemented
using National Instruments LabView. The system will run with window
XP and higher , with an RS 232 COM port and NI My DAQ installed.
The COM port is needed to input ball position vial Touch Screen Interface.

A USB to RS232 was used to accommodate the touch screen


requirements.
My DAQ devise from NI was connected and installed with all libraries
related to LabView software. The device will provide the power and
control to servo motors. (1 per servo motor)

Figure 2. My DAQ

MOTORS:
Servo Motors will be used for movement of each axis. The models
used here are BMS-995 MG from Blue Bird Technology.
Specifications: - Weight: 55 grams.
-

Dimensions: length (40.7 mm) , width(19.7 mm) , height


(42.9 mm)
Modulation :Digital
Torque at 4.8 V: 9.4 kg.cm
Torque at 6.0 V: 11 kg.cm
Speed at 4.8 v\V : 0.2 sec/60 degrees at no load
Speed at 6.0 V :0.16 sec/ 60 degrees at no load
Motor type : 3 poles
Pulse cycle : 1 ms
7

Figure 3. Servo Motors

Touch Screen:
The touch screen used in the project is a 4 wire analog touch panel by
EELY Enterprise Group.
Major Features are listed below:

Figure 4. Touch Screen

Input Mode: Stylus or Finger pressure.


Cable: Flat flexible cable (FFC)
Frame size :27.1 x 20.5 cm
Total thickness : 2.2 mm
Tail length : 3 cm
Operational Temperature: -10C to 70 C
Loop Resistance: X:20 to 500
Y:20 to 500

Figure 5. Touch Screen Controller

Touch Screen Controller:


The basic information in the whole system we are building is the feedback
that must be provided from the provided from the touch screen indicating
the balls exact location. This link is achieved by the use of the touch
screen digital controller , since the touch screen described above gives us
only analog values from different locations. The controller implements the
9

analog information digitally into LabView. Controller used is from same


manufacturer of screen (EELY).
Below are main specifications of the controller:
-

Power required: +5V DC(+5% -10%).


Max. 100 mA, 50mV peak to peak max ripple.

Protocol : COM: 9600 BPS , 8 Data Bits ; USB: USB 1.1 full
speed.
Resolution: 12 Bits (2096 x 2096)
Report Rate: COM Max. 180 packets per second
Bytes : 5 Bytes
X11-X0 (12 Bit data of X pressure Value)
Y11-Y0 (12 Bit Data of Y pressure Value)

Construction:
In the construction process, the system was fitted over a wooden board.
To raise the plate flat above the ground 3 iron pillars were manufactured
in a mechanical workshop, plus two metallic bases for the motors to be
fixed in.
The main pillar was fixed in the wooden boards, meant to hold the Touch
Screen from its center of gravity in the middle, thus lifting some of the
weight of the servo motors. Length of this pillar is 12.7 cm above the
surface of wooden board, to ensure a comfortable space for the screen to
be moved in al directions.

10

Figure 6. Central Pillar

The other two pillar were designed to be shorter of height 7.1 cm , to


provide movement of each axes accordingly of the screen. They are
connected to the servo motors at a distance of 5,5 cm from the ground,
thus maintaining stability of the screen by reaching total height of the
central pillar at zero level.
The Servo Motors are placed fixed in well specific designed metallic bases
of length 6.7 cm , and lifts the motor to 5.5 cm above the ground where it
control the pillar attached to it safely and freely.
Figure 7 shows the connection of servo motor to a flexible pillar.
Eventually a final system design was achieved fulfilling our expectations
and fully functional shown in figure 8.

11

Figure 7.Servo-Motor connection to axis flexible pillar.

12

Figure 8. Final System Design complete.

IV. Labview:
13

We created a LabView code in order to control the screen by using two servo motors.

Figure 9. Reading from touch screen

This is the main code which reads the x-y coordinates and converts them
to duty cycle values in order to command the motors to move in the
direction needed. The other Sub-Vis will be explained later in the report.

14

Figure 10. Visa Read

This VI in figure 10 is to open the screen. We downloaded the Visa


libraries in order to be able to read the screen. The values used in the
Instr Node are default values.

Figure 11. Validate Data

15

Figure 11 shows the VI that takes input array of x-y coordinates as byte array
and search for value 129, if it was found it sends the data to byte to (x,y) VI.

Figure 12. Byte to (x,y).

In Figure 12 the VI takes byte array and converts it to integer values between 0
and 4096, which is the resolution of screen 4096x4096.

Figure 13. Byte to nibble

In Figure 13 is required because computers can only represent 8-bit data. We


ignored the MSB value because it is always 0. For each axis, the controller gives
2 bytes, so we take the nibble and multiply it by a certain value.

16

Figure 14. Controlling the two servo Motors.

We found this code online and modified it so that it moves the servo
motors with a Duty Cycle controls in our desired matter.. We did the code
twice in order to work with two servo motors using two MyDAQ
apparatuses.

17

Figure 15. Front Panel Final of main VI.

This is how the main front panel looks like. It shows the x-y coordinates, xy duty cycle, graph and the controls to choose ports for the screen and
servo motors.

18

V.

Table of Cost

Table 1: Cost

Materials

Price
90.00 $

Touch Screen + Controller

Two Servo Motors

30.00 $

Metallic Hardware Manufacture +


Wooden Board Stand

310.00 $

National Instruments products + Lab


View Software

0.00 $ (Provided By college)

Total cost

430.00 $

Results
Before complete assembly of the hardware, every part was tested
separately. The touch screen and controller alone were functional and
achieving a link with the Lab View code. Servo Motors where functioning
properly based on commands issued by the control code on Lab View.
After complete assembly, several tests were made to ensure the proper
function of the machine. We have encountered minor errors and low
rate function in the servo motors due to relatively high weight of the
steel ball being used. But the overall result was a complete success,
19

and the axis were moving in the desired directions manipulating the ball
to balance with respect to appropriate X and Y coordinates received
from the touch screen via controller.

Figure 16. Testing phase.

VI. Conclusion
We greatly enjoyed working on such a simple yet complicated project.
We believe it helped us gain a quite amount of experience and
knowledge in our field of study that is Mechatronics. The system once
built and tested can be used as an excellent test-bed for testing
various other control system. With higher resources given a better
performance can be yet achieved with more optimal controller and
advanced hardware. Such system could act as a gate way to more
advanced industrial applications with respect to world major
manufacturers in the fields of Mechatronics and Electro-Mechanics.
20

VII. References

2016, January , Basic Information (Servo Motors) [online]. Available:


http://www.servodatabase.com/servo/towerpro/mg995

Chung Hua EELY Enterprise Group 2010-2015 copyright, Touch Screen Products
[online].
Available: http://www.eelyecw.com/eelyeng/index.htm

National Instruments , 2016, NI MyDAQ Setup and Support [online].


Available: http://www.ni.com/mydaq/support/

S. Awtar, C. Bernard, N. Bokuland, A. Master ,D Ueda , K. Craig. (2002


December). Mechatronics design of a ball-on-plate balancing system[online].
Available: http://psdl.engin.umich.edu/pdf/ballonplate_mechatronics.pdf

Bruce Appleton. (2012). Ball Balancing Project[online]. Available:


http://techniek-atelier.nl/documentatie/projecten/Ball%20Balacing
%20Project/Balancing_Ball_Final_Report_V3.pdf

21

You might also like