This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
There are so many real world applications that require the task of position control. This includes the motion of the inkjet printer carriage. The carriage itself needs a proper control in order to produce a good quality printing. The visual representation of the carriage as it moves makes it perfect for all people to see and understand the concept of position control system especially for Mechatronics students.
There are several ways to demonstrate the position control system. One of them is using LabVIEW or Simulink program. In this project, emphasise is given to LabVIEW development. By using this software, users will be able to produce a program where it will be able to do position measurement as well as specifying a desired output to move the carriage. Through LabVIEW, it is possible to show in detail how the encoder works and also the methods to control the carriage including all the important parameters. But, this is not entirely depends on the software itself, a careful selection of hardware is important in order to get the best results out of the project.
Several experiments have been done in order to verify the validity of the LabVIEW coding and also to analyse the data. The most important aspects to be considered are the sampling rate and also the initial parameters for the position measurement. These two factors will highly influence the outcome of the project.
The list below shows the nomenclature used throughout the report.
Analogue to Digital Conversion
Digital to Analogue Conversion
I would like to say a lot of thanks to my project supervisor, Dr Neil Sims for his endless encouragement, support and guidance throughout my entire project duration. His great involvement in the project has helped me to achieve a great progress.
Recognition also must be given to Chris Grigson, Technical Staff at the University of Sheffield for his advice. He also helped me to solve some technical difficulties that I have to face to complete the project.
Last but not least, I would also like to express my appreciation to all people who had contributed, whether directly or indirectly.
Generally the back and forth movement of the inkjet printer carriage when printing behaves like the mass-spring-damper system, however in order to get the desired output or good printing quality, a very good position control measures need to be implemented. Hence, it makes the inkjet printer one of the most comprehensive case studies to reinforce the knowledge regarding the position control problem in mechatronics. The demonstration for the position control problem can be done by simulation software like SimuLink or by applying real control using LabVIEW software.
Inkjet Printer in Position Control Case
In real life applications, precise movements of the carriage are important to ensure the output is as desired. In a mass-spring-damper system, stiffness and damping play an important role in order to reduce vibrations and to obtain desirable response, which is analogically similar to the inkjet printer where displacement and velocity feedback needs to be accurately set up. The advantage of using inkjet printer to demonstrate position control system is the visual representation of the printer carriage as it moves. This is because as the control variables are manipulated from LabVIEW, the response can be clearly observed, hence making it suitable for the students to grab the understanding.
All inkjet printers use quadrature encoders to track motion. The quadrature encoder for inkjet printer is made up of a strip with alternating opaque and transparent surface (1). The quadrature encoder also has two channels that are 90 degrees apart from each other, so it naturally needs two sensors which will detect pattern changes in their respective tracks (2). The change order of the signals will give an indication of the direction of motion. Unlike single channel encoders, quadrature encoders are more precise because they provide greater resolution, more immunity to errors caused by noise, and they are capable of detecting changes in direction (2) (3). In order to get the full benefit of the high speed and high precision of the quadrature encoder, a capable hardware must be used to deterministically process quadrature encoder signals to estimate the displacement or velocity and instantaneously output control signals (3).
In this project, LabVIEW software is used to develop a control system for the inkjet printer. LabVIEW is a program development application which uses graphical programming language to create programs in block diagram form (4). LabVIEW has extensive libraries of functions and programming tasks (4). Programs in LabVIEW are called Virtual Instruments (VI) because their functions and appearance are similar to physical instruments, for example oscilloscopes and millimetres (5). This software also contains specific libraries and functions for data acquisition, data analysis, data presentation and data storage (4). In addition, LabVIEW also includes conventional program development tools in which the users can set the breakpoints and animate program execution (4). All of these are important as the output of the LabVIEW model can be easily analysed and also enable the users to amend any errors in LabVIEW coding (4).In general, programs can be created using LabVIEW to acquire and process the input data as well as generating the output data to be sent to the device to be controlled.
AIMS AND OBJECTIVES
The aim of this project is to develop a controller for an inkjet printer to demonstrate an example of position control system using LabVIEW. In order to do that, basic knowledge of LabVIEW is crucial to develop a model to calculate and process the signal received from the encoder to determine the position of the printer carriage as it moves, as well as creating control program to control the carriage motion as desired.
The main objectives are:
To understand how quadrature encoder works
To be able to use and set up the instruments for example the oscilloscope, data acquisition device and current amplifier
Get understanding on how to use LabVIEW
Use LabVIEW to demonstrate the position control problem
Develop LabVIEW model that can do the position counting for the movement of the printer carriage as well as converting it into SI unit
Develop LabVIEW model that can produce an output voltage signal that is proportional to the displacement
Develop LabVIEW model to control the position of the printer carriage
Inkjet carriage motion is a perfect example for position control problem. As all people have known, the carriage motion will greatly influence the printing results. Sometimes it is a trade-off between print quality and print speed (6).
A report by S. Fedigan, D. Schafer and C.Cole highlights the typical inkjet printers' print with user-selectable prints modes that are compromises between quality and throughput (6). Based on these researches, slower carriage speeds will usually lead to a higher quality print modes by reducing the artifacts associated with bi directional printing. Generally, there are two separate zones for carriage motions; they are print zone and non-print zone. In the print zone, a good carriage motion control has to be developed in order to maintain at a constant carriage speed and also to fire the ink at constant interval (6). While for the non-print zone, motion control is less important, hence the carriage can accelerate or decelerate or travel at a higher speed to improve printing performance (6). Since there is always a trade-off between printing speed and printing quality, this report emphasises in finding approaches to increase effective print speed (6). One of the methods suggested includes reducing the percentage of non-print zones by providing the cartridge nozzle firing hardware, which is capable of printing while accelerating or decelerating (6). Also stated is the importance to eliminate disturbances such as stiction, sensor noise as well as unmodeled dynamics. In order to reduce the disturbance effects, it is crucial to compensate for these disturbances with a simple disturbance observer (6). All of these complexities are aiming at one thing which is to achieve a great control of the printer carriage.
Another report from Institute of Technology, Comimbatore, India investigated that in order to tune control parameters, it is best to know the physical parameters of the systems, mainly for the motors that drive the mass (in this case, the printer carriage) (6). It has been said that for motors, it is crucial to determine the load parameters as they have significant effect on the dynamic response of the systems (6). When tuning PID controller, it was found that optimum response was obtained if load parameter is considered (6). Based on the analysis that had been done, it is clear that the performance specifications depend on the load current. Figures below are the results of the experiments conducted by the university (6).
Figure : Step response of PID controlled system at no load
Figure : Step response of PID controlled system at load 1
Figure : Step response of PID controlled system at load 2
Based on the figure 1, figure 2, and figure 3, it is clearly shown that load has effect on system dynamics (6). As seen from the graph, the settling time is significantly increased if there is load current. It is also obvious that the peak overshoot gradually reduced as the load current increases (load 2 is greater than load 1) (6).
The steps to design a good printer carriage controller have started long ago. This can be seen from a patented design filed on January 18th 1978 by a couple of Japanese inventors (7). In short, this patented design is about to create a position control system where it can properly detects and responses to a rotation angle of a servomotor which drives a carriage in a printer by generating an analogue signal (7). The servomotor needs to be responsive to the print command from an input and also from the analogue signal and subsequently drives and stop the carriage upon receiving print and stop command respectively (7). The carriage is then held stationary at a predetermined position which is suitable for the next printing task as determined by the rotation angle of the servomotor (7). These ideas of design were meant to meet several objectives. They are (7):
To stabilise the printing position in a printer having a travelling print head
To provide a carriage position control circuit in a printer
To provide a servomotor control circuit
To provide a detection means suitable for detecting a rotation angle of a servomotor
All of these objectives are focus on designing the best control on the inkjet printer position control system. All these researches also have provided a foundation for this project to take place by showing how important a position control system in an inkjet printer carriage movement.
This project ultimately aims to demonstrate the complex position control problem into a more understandable presentation by using LabVIEW. This is very good for students who is trying to get a deeper understanding on position control problem as they can see a step by step flow diagram to achieve advance control from LabVIEW block diagrams. From LabVIEW, all of the important parameters can be tuned as desired, and the results (motion of the printer carriage) can be visually observed by running the program.
Figure : Data Acquisition Block Diagrams
Figure 4 shows the arrangement of the equipment to be able to process signals from the encoder. DT9837 is a data translation device which is used for ADC and DAC tasks.
Data Acquisition Device
Figure : Block diagrams to receive input and produce output
Figure 5 shows the arrangement of equipment to receive input from the encoder and produce output at the same time. There is another Data Acquisition Device being used for this part. (Will be explained later in Section 7.5)
D:\My Documents\Dropbox\Camera Uploads\2013-04-29 13.44.28.jpg
Figure : Overall experimental setup
Figure 6 shows the overall experimental setup for this project. Diagrams in Figure 5 are derived from all of this equipment.
Inkjet Printer with Quadrature Encoder
Generally, a belt-drive mechanism is always used for all inkjet printers to move the printer cartridge carriage across the page. The quadrature encoder available on this printer (HP printer) requires the belt to function properly. This belt usually has an optical pattern that helps sensor to track the position (3). This optical pattern is made up of opaque and transparent sectors which respectively block and allow light to pass through it. This condition will generate square-wave pulses, which then can be analysed and interpreted into position or motion (4). The encoder in use for this project is Agilent 57 Q9864 0106. Figure and table below shows the pinout for this encoder:
Figure : Encoder Layout
Table : Encoder Connector
This encoder needs to be carefully connected to the instrument, as the wires will be used to provide power to the encoder as well as to read the signals (4). These signals will be processed in LabVIEW for counts measurement which then will be used to find the position, velocity and acceleration of the printer carriage.
Data Translation Device, DT9837
DT9837 is a data translation device specifically used in this project. It is connected to the computer by USB connection and also to the encoder. Generally the function of this device involves analogue to digital conversion (ADC) and digital to analogue conversion (DAC).
Analogue to Digital Conversion (ADC)
The analogue signals obtained from the encoders will be interpreted by the device into digital signals. These signals were then sent to the computer to be processed in LabVIEW to find position, velocity and acceleration of the printer carriage. DT9837 modules can acquire a single value from a single analogue input channel, a single value from all analogue input channels simultaneously, or multiple values from a group of analogue input signals (5).
Digital to Analogue Conversion (DAC)
The device is also responsible to convert the digital signal from LabVIEW to analogue signal and send it to the printer. The DT9837 module provides one analogue output channel with an output range of +10V to -10V (5). Control programming needs to be precisely created to produce an output as desired.
D:\My Documents\Dropbox\Camera Uploads\2013-04-11 15.34.43.jpg
Figure : Data Translation Device DT9837
Data Acquisition Device, NI USB-6211
This is another Data Acquisition (DAQ) Device used in this project. This device is also connected to the computer via USB connection and to the printer motor. The reason for using this additional device is to help on generating output signal since there has been a driver problem for DT9837 to create output signal. From LabVIEW, a program is created using this device's unique VI (block diagrams) to generate an output voltage.
D:\My Documents\Dropbox\Camera Uploads\2013-04-11 15.34.32.jpg
Figure : Data Acquisition Device NI USB-6211
This current amplifier uses Widlar current source concept. This is done by modifying the basic two-transistor current mirror that has an emitter degeneration resistor for the output transistor. Hence, low current can be generated using only moderate resistor values (6) (7) (8).
D:\My Documents\Dropbox\Camera Uploads\2013-04-11 15.35.01.jpg
Figure : Widlar Bidirectional Current Source
In this project, SimuLink is used at first to simulate the response of typical ink-jet printer cartridge carriage as it moves laterally across a page (5). Simulink is part of Matlab environment which is very useful for modelling, simulating, and analysing dynamical systems by providing a graphical user interface for building models as block diagrams (5). This purpose of using Simulink before creating a program with LabVIEW is to get the general overview of the response as well as to simulate the control strategy by manipulating the displacement and velocity feedback value. Figure below shows an example of closed-loop system modelled using Simulink (5).
D:\My pictures\Image 288.jpg
Figure : Closed Loop System Using Simulink
Figure 11 shows the block diagrams modelled in Simulink to control the printer cartridge carriage using feedback. There are three procedures to do the control using Simulink based on this block diagrams:
The carriage position (output signal from the printer) is measured with a sensor (usually inkjet printer is equipped with quadrature encoder in real life).
Using differentiation or integration and amplification, a control strategy is applied by manipulating the feedback signal. The actual input value is subtracted to obtain more accurate data.
When the results are obtained, it is compared to a reference point. Reference point is the actual desired position of the carriage, expressed in voltage. The resulting error signal can then be used as an input.
Progress and development
After simulation using Simulink has been done and all necessary equipment has been setup, the next step is to use LabVIEW to create a program to measure the output from the printer. The data translation device, DT9837 is used to read the signals from the encoder. The analogue signals are converted into digital signals and these signals are sent to LabVIEW. By choosing suitable virtual instrument, the signals are collected from a specified channel and processed inside LabVIEW. Using proper programming, counts are obtained and calculated. Counts are then converted into SI unit, in this case into millimetre by a mathematical equation. It is also important to consider the right sample frequency and also samples per channel as this will affect the accuracy of the measurement.
After data measurement, the next objective in using LabVIEW is to generate an output in term of voltage from LabVIEW to the printer. Technically, the voltage digital output from LabVIEW will be converted into analogue output by the Data Acquisition Device, NI USB-6211. This analogue output will then be sent to the oscilloscope and also to the current amplifier. The motor is connected to the current amplifier to provide a small current to help the motor in moving the carriage. As a result, the printer cartridge carriage can be moved as desired and its position can be recorded from LabVIEW.
The core objective of the project is to demonstrate position control system using inkjet printer carriage. In order to achieve this objective, software called LabVIEW is used to create a program where a data from the encoder can be passed to the computer via data acquisition device to be processed. There are three major steps to achieve the main objectives:
Data Processing and Measurement
The LabVIEW programming is developed in proper flow based on the three steps mentioned above. Data from encoder is passed to LabVIEW via Data Translation Device DT9837. The data input into the LabVIEW program from the encoder is two channel arrays, hence by correct programming, the program will be able to determine counts and position of the printer carriage as well as the direction of motion.
During developing the data acquisition part (or data collection), the current amplifier is not connected to the motor. So the inkjet printer carriage is moved manually by hand. This is because only input from encoder is required for this stage. As soon as the printer carriage is moved, the direction of motion and the position will be detected by the optical sensor that comes with the quadrature encoder. The optical sensor will provide electrical signal in the form of pulse trains, which can, in turn, be translated into motion, direction, or position (4).
The pulses, or signals from the encoder is sent to LabVIEW via DT9837 Data Translation device. The first virtual instrument that the data will be feed into is the OLCreateTask VI. Technically, this is the most important part for this program since this will determine whether it will produce an output from the computer, or receive inputs to be processed.
D:\My pictures\olcreate taks.jpg
Figure : OLCreate Task VI
There are a few options for this particular VI from its dropdown menu:
Analogue input or output
Counter input or output
Digital input or output
Quad Encoder Input
This particular VI has been set to Analogue input (AIN Volts) from its dropdown menu since data collected from the quadrature encoder is in the form of analogue voltage signals. It is important to wire a controller to the channel connector of OLCreateTask VI (AIN Volts), so that it is possible to specify both A and B channels to be fed into the LabVIEW program to receive the signals from both channels to help on determining the position and direction of motion of the printer carriage. Diagram below shows the method of specifying both channels to be included inside LabVIEW from front panel.
D:\My pictures\Image 233.jpg
Another important parameter for the AIN Volts VI is the channel type which will help the program to determine the type of data feeds into LabVIEW.
Generally there two voltage input options:
Connecting one wire from each signal source to the data acquisition interface to be compared to a reference voltage or ground. The measurement is the result of the difference between the signal source to the reference voltage (6).
Conneting two wires from each signal source to the data acquisition interface, in which one wire goes to the '+' input and the other one goes to the '-' input (6). As a result, both voltage signals will be measured based on the same ground and provides noise rejection (7). However, this type of input is only used whenever electromagnetic interference (EMI) or radio frequency (RFI) is present (7).
Single-Ended Inputs has been chosen as it is simpler and the encoder has only single connector to each of its channels, meaning one wire per channel.
For this VI, it is also required to set the voltage limit for the AIN Volts VI according to the hardware capability. For this project, DT9837 can only receive a voltage range of -10V to 10V. This step is important as higher voltage range is not supported by the hardware, hence producing error.
After OLCreateTask VI, the signals are passed to the OLTiming VI. Similar to the previous VI, it is important to select a proper task for this VI.
D:\My pictures\input timing.jpg
Figure : OLTiming VI
In this part, the VI is set to Set Input Timing VI. This is the stage where the program will specify important parameters in order to have better calculations and more accurate results. The parameters are:
Sample per Channel
It is essential to get the most appropriate sample rate and sample per channel as this will highly influence the calculations for the carriage position later. It is also important to find a perfect balance for the sample. Based on experiments carried out, the best sample rate ranges from 10 kHz and above. To provide the best balance, the sample rate is set to 30 kHz. Sample per Channel is as important as Sample Rate in order to get accurate data calculations. A good number must be chosen in order to get the result as accurate as possible but at the same time will not consume too much processing power as this translates into higher time consumption. (Further detail on sample rate in Section 7)
Figure 5 below shows the control interface for the Sample Rate and Sample per Channel on the Front Panel. Generally after the most suitable values for both of these variables are found, users can make these values default by going to 'Edit > Make Current Values Default'. This can be done on the Front Panel Window.
C:\Users\Hidzami M17x\Desktop\sample rate.jpg
Figure : Sample Rate and Sample per Channel
For Sample Mode, in this project Continuous Sampling Mode has been selected. Continuous Sampling Mode means that the Data Acquisition Device will continuously read the voltage at the input and convert the reading into digital number. Since this project involves printer carriage, in which the motion could be different from time to time, it is necessary to collect continuous data from the input. On the other hand, Finite Sampling Mode means that the program will only sample the signals for a certain amount of time, and will stop when the trigger conditions have been met. Finite Sampling Mode is more suitable for a program that requires a fix amount of data.
The advantage of choosing Continuous Sampling Mode is the ability to prevent missing samples which depends on the speed of the computer and also speed of the program (8). Subsequently, more accurate results can be achieved as compared to the Finite Sampling Mode.
The next step of the program is where the data is read and processed to produce position counts.
Data Processing and Measurement
Data Processing and Measurement is a part where the signals collected from previous VI will be filtered, defined, and processed to produce position counts where it will be converted into mm for better understanding. Most of these tasks will be carried out inside a While Loop to make sure every motion of the carriage is recorded and will only stop when the Stop button is pressed.
Defining Initial Values
Before entering the While Loop, the signals are read and subsequently filtered by two separate OLRead VI. The data is filtered and defined before entering the While Loop to prevent the program to start the count before the printer carriage is moved and display arbitrary initial values on start-up.
Figure : OLRead VI prior entering While Loop
OLRead VI is tasked to read the samples specified by the OLTiming VI. Generally there are several reading formats for this particular VI. They are:
Read Single Channel - Single Sample
Read Single Channel - Multiple Samples
Read Multiple Channels - Multiple Samples
For this particular project, the third format is chosen since the program is receiving multiple samples from two channels of the quadrature encoder that send the signals to the Data Translation Device. After passing this VI, the data will exist in the form of two dimensional arrays. Since these arrays are made up of samples specified before, so it consists data with variety of amplitudes. So, to ensure that the data extracted from the samples are useful for position counting, it is necessary to specify a condition so that the program can create True and False Boolean value.
As can be seen from Figure 8, a Greater or Equal Function is used to convert the samples to Boolean values with greater or equal to 1.5V to enter the loop as True, and the rest as False. Then, the extracted arrays are indexed by Index Array Function as shown in Figure 8 to get the first data from the arrays to define the initial value of both channels. By doing this, the start-up error can be eliminated.
Recording and Indexing Arrays
After defining the initial values for both channels, the rest of the samples are feed into the While Loop for further processing. Similar to previous OLRead VI, this VI has been set to Multiple Channel and Multiple Samples. This time the arrays from the OLRead VI are recorded using Waveform Graph.
Figure : OLRead VI connected to the Waveform Graph
From the Waveform Graph, users can view the signals behaviour and amplitude. From here it can be seen that Sampling Rate and Samples per Channel play an important role to ensure the accuracy of the graph. (Refer appendix)
After the Waveform Graph, the arrays are channelled to the Greater or Equal Function again to define the desired samples for position counting.
D:\My pictures\defining samples.jpg
Figure : Defining Samples and Indexing
Based on Figure 10, it can be seen that samples with amplitude higher or equal to 1.5V will produce True value, while the rest will produce False value. To illustrate the False and True value better, an indicator is placed at the wire after the Greater or Equal Function, by doing this, the program will display virtual LEDs to represent True and False value.
Then the samples are channelled into two Index Array Function to differentiate the samples from Channel A or Channel B. In order to do this, those Index Array Functions are programmed to Index Row 0 and Row 1 respectively. As a result, the program now has separate connection for samples from Channel A and Channel B, making it easy to compare the different states for both channels and also helps to predict whether the measurement is counting up or down. Then these two arrays are connected with Array Size Function. This function is used to check whether the program receives the right amount of samples after being defined for a few times (See Appendix).
D:\My pictures\Image 018 crop.jpg
Figure : For Loop
This is one of the most important parts of this program. In this part, samples in the form of Boolean value will be analysed stage by stage, primarily based on the current and previous states of both Channel A and Channel B, to produce an incremental or decremental counts.
This part consists of For Loop, in which all the functions and analysis (subdiagrams) take place. For Loop is a function that allows its subdiagrams to execute as many times as specified by the user. In this case, the For Loop is placed inside the While Loop, hence the duration of running is highly depends on the While Loop. If the Stop button of the While Loop is pressed, the For Loop will also stop running. However, the subdiagrams of the For Loop will only execute 999 times since the program is specified to read 1000 samples from each channel.
Another important aspect of the For Loop is the ability to create shift register. By having shift register, the operations of the subdiagrams can be repeated multiple times by relating previous state (value) to the current state (value).
It is important to define initial condition of samples from Channel A and Channel B (as shown in section 184.108.40.206) and to be used as a previous value inside the For Loop. The main reason is to prevent count on start-up because of arbitrary initial values for both channels. By reading the first sample from both channels and feed them into the For Loop, the program now will always start from zero after rerun.
Before going into detail of each of the process for measurement, it is important to know the principle behind the counts and position measurement for quadrature encoder. Generally the counts highly depend on the state of each channel. If the state of either one of the channels has changed, the program will increment or decrement the position counter (8).
Figures below will explain in detail the steps to start the counts measurement for each channel.
D:\My pictures\previous current a.jpg
Figure : Previous and Current Value Comparison for Channel A
Based on Figure 12, it can be seen that there is one Boolean array (green wire) connected into the For Loop via the down arrow symbol. This indicates the previous value and it is connected to the XOR Function (Exclusive Or) to be compared to the current value (green wire on top). XOR Function will only produce True Value if both inputs are of different value, which means previous and current state of the channels are different.
D:\My pictures\previous current b.jpg
Figure : Previous and Current Value Comparison for Channel B
As seen in Figure 13, arrays from Channel B is also channelled to XOR Function, the array with down arrow symbol (green wire) is a previous value while the green wire on top is current value.
Figure : Position Count Process
After XOR Functions, both Boolean values will be directed into OR Function. Table below shows how will OR Function behaves:
X or Y
Table : Truth Table
In order to do the counting, the X or Y value needs to be True. This is because as seen in Figure 14, the Select 1 Function VI is connected to either '+' sign which lead to counting (if value of OR Function VI is True) or Select 3 Function VI, in which there is no counting occur (if value of OR Function VI is False).
Regarding the counting up or down, it is shown in Figure 14 that Select 2 Function VI is connected to either -1 or +1. This mathematical operation depends on the Boolean state for the previous value of Channel A and current value of Channel B. Equations below explain how the program do the counting.
As shown in Figure 14, Select 1 Function VI is also connected to Select 3 Function VI which is wired to a control button. If there is no change of state for both channels, no position counts will be done, hence it will either receive the previous count value or it will return 0 value when the Reset Position control button is pressed.
An indicator is also wired to the iteration terminal (i) to check the number of iterations that has been done to do the counting.
D:\My pictures\Image 019 crop.jpg
Figure : Unit Conversion and Data Representation
After previous steps, the program has already successfully produces counts value. The next step is to represent the data in a more understandable way. Firstly there is Position History Chart VI as shown in Figure 22. This waveform chart will show the gradual increase or decrease of counts over time. Then, the counts values are connected to counter. This counter will show the calculated position counts as soon as the printer carriage moves.
However, to make the position measurement more understandable, it is important to convert the position measurement from counts into SI unit, in this case millimetre (mm) is used for displacement of the carriage. Position counts are divided by . (This will be explained in detail in Results Section). The resulted displacement in millimetre is connected to Waveform Chart VI to clearly show the exact position of the carriage. As a start to help in designing control coding with LabVIEW, it is important to find the voltage value that is proportional to the carriage position. In order to do this, a proportional constant between voltage and displacement has to be calculated. Then, displacement is divided by the constant to get the voltage value as seen in Figure 22.
After processing data for measurement which involves Analogue to Digital Conversion (ADC), it is also equally important to develop a program for Digital to Analogue Conversion (DAC) to control the carriage. The main objective is to create a program where it is possible to control the carriage using proper feedback and proportional control. However, due to time and technical constraints, there are only a few steps successfully done towards a complete control program. They are:
Producing an output voltage signal that is proportional to the displacement
Producing a fixed voltage output and simulate sine and square waves to move the carriage and recording the position at the same time
Producing output signal proportional to carriage displacement
For this particular task, usages of Queue Operations Functions VI are really important. These are very useful to communicate data between sections of a block diagram or from another VI. It is important to note that the current amplifier is not connected to the motor during this program is run because the carriage is moved by hand and the proportional voltage output is recorded on the oscilloscope. (Not a program to move the carriage back and forth)
D:\My pictures\obtain queue.jpg
Figure : Obtain Queue Function VI
As seen in Figure 18, the Obtain Queue Function is branched into two While Loops; the top one is to read the samples and produces the position count, while the bottom one is to create voltage output that is proportional to the displacement of the printer carriage.
Firstly, it is important to wire a constant value of zero (0) to the Obtain Queue Function VI. This is done to define the element type as well as to set the initial value prior collecting any data.
D:\My pictures\Image 006.jpg
Figure : Enqueue Element Function VI
This VI is wired to Enqueue Element Function VI inside the count processing while loop, as seen in Figure 20. Using this VI, the program will add an element to the back of a queue. This enables the data to be transferred to another Loop or VI.
D:\My Documents\Dropbox\4th year\FYP\Final report\block diagrams proportional voltage value 2.jpg
Figure : Dequeue Function VI inside Output While Loop
Based on Figure 21, this DAC program is started with DAQmx Create Task VI. This VI is configured to AO Voltage, which is used to create an output voltage signal by specifying which output channel is connected to the current amplifier. Similar to the OLCreateTask VI, it is also important to wire the upper limit and lower limit for the voltage value as supported by the hardware (in this case Data Acquisition Device NI USB-6211 is used). This VI is then wired to the DAQmx Write VI. It will produce an output voltage signal with amplitude as defined when the Data Value Connector is wired.
The queued element will now be released from the queue when there is Dequeue Element Function VI. The data then will go through the same process as before to convert it into Voltage, V that is proportional to displacement. The calculated voltage will be fed into the DAQmx Write VI which will write and produces digital signal to be sent to Data Acquisition Device and converted into analogue signal to be sent to oscilloscope. Subsequently, the calculated output voltage value will be displayed on the oscilloscope.
Producing a Fix Voltage Output and Simulate Sine and Square Waves
For this type of output, current amplifier is connected to the motor as we want to move the carriage and record its position and displacement at the same time.
D:\My Documents\Dropbox\4th year\FYP\Final report\block diagrams simulate signal 2.jpg
Figure : Producing an output voltage using Simulate Signal VI
As seen in Figure 17, both outputs While Loop is quite similar, except for this particular program; the DAQmx Write VI is wired to a Simulate Signal Express VI. This VI is very useful in generating alternating output voltage within a certain range, for example +5V to -5V by simulating waveforms of interest. The types of waveforms that can be simulated by this VI are:
This alternating voltage enables the carriage to move back and forth. For this project it is preferable to use Sine wave or Square wave as the movement of the printer ink carriage will be a lot smoother and imitate the real world movement of a printer carriage. Generally, the other VIs in this DAC While Loop work in the same way as in section 220.127.116.11.
results and discussion
Results in this project are mostly related to the accuracy of the data that has been processed. The accuracy of the measurement and calculation depend highly on the parameter used as LabVIEW provides wide range of options to configure the program.
Methods in Calculating Carriage Displacement
After the counts value has been successfully obtained, it is important to convert it into SI units so that it is more understandable. In order to find a method to convert counts into SI unit (mm), an experiment has been conducted. Figure below explains the experimental arrangement as well as objectives to achieve.
D:\My Documents\Dropbox\Camera Uploads\2013-04-23 16.27.55.jpg
Figure : Experimental Setup
The main objectives of the experiments are:
To verify the validity of the LabVIEW coding
To obtain a constant value to convert counts into mm
Based on Figure, these are the procedures in conducting this experiment:
A block is placed at a fix position to create a starting position or zero displacement.
An end point is marked at the other side of the printer. For this experiment, a distance of 185mm is set between the block and the end point.
When the carriage is at the starting position, run the LabVIEW program.
Carefully move the printer carriage manually from the starting position until the end point.
When the carriage reaches the end point, take note of the counts value in LabVIEW.
Move the carriage back to its initial position, observe the counts value.
The experiment is repeated for four times to obtain an average value and reduce error.
Counts value is converted into mm by using the constant obtained.
From this experiment, it is possible to verify the validity of the LabVIEW coding. When moving the printer carriage from left to right, and then back again at the starting position, the counts value in LabVIEW should return to zero (0). Otherwise, there could be some problem in the coding for Count Measurements part. (Section 18.104.22.168)
For the second objective, counts value need to be recorded each time the experiment is done. In this experiment, it is clear that there will be a slight different in counts value, although the carriage is moved through the same distance. Table below shows the data variation out of all four experiments.
Table : Displacement and Counts Value
In order to get the constant value for the counts/mm, the data is calculated as below:
By using this constant value, counts can be easily converted into mm by dividing the counts value with this constant.
It is also useful to convert this unit into inch since most printer uses this unit.
Influence of Sampling Rate to Measurement Accuracy
As discussed in previous sections, sampling rate do affect the accuracy of the measurement. ADCs sample analogue signals and convert all of these values into binary number in regular interval or frequency (15). By having too small sample rate, the data will not be accurate because it essentially means the program will skip a lot of important data from the signals. However, too high sample rate value will cause higher processing power and it will be time consuming although the calculations will be more accurate.
A simple experiment has been carried out to find the perfect sampling rate. The procedures are as follows:
Mark a starting position and end point. In this case a short distance of 80mm is chosen.
Set the sample rate as desired. Then run LabVIEW program.
Move the carriage from the starting position to the end point.
Record the counts value on LabVIEW.
Repeat step 3 several times to get the average count values.
Graphs below show the results of this experiment.
Figure : Position counts against Sample Rate, Hz
Figure : Displacement, mm against sample rate, Hz
Based on figures above, it is obvious that sampling rate highly affects the accuracy of the calculation. In order for the sample to give the original form of the analogue signal, the sample rate needs to be at least twice that of the highest frequency in the analogue signal (15). Hence, with proper sampling rate, it allows the replacement of a continuous band-limited signal by a discrete sequence of its samples without the loss of any information (10). This criterion is known as the Nyquist criterion or Shannon's sampling theorem. When the sampling rate is less than twice the highest frequency, the reconstruction could represent different analogue signal and lead to a false image of the real signal (15). This error is termed aliasing. It is also crucial to note that the high-frequency noise will also contribute to errors in the sampling process. It is recommended to use a low-pass filter to precede the ADC, in which it only allows low frequencies for which the sampling rate will not give aliasing errors (15).
From this experiment, when a very low sample rate is used, the program suffers from loss of information from the original signals, hence producing a very wrong calculation of the displacement. For example, when only 1000Hz is used for sample rate, the position counts is very low compared to the sampling rate, and the displacement calculated is totally wrong, which is only 13mm instead of actual displacement of 80mm.
As the sampling rate increases, the calculated displacement is getting more accurate and produces almost the same value as the actual displacement. This is because all the information from the original signal is sampled and no data is left out for processing and calculations.
However, there could be some errors for the calculated displacement data since the manual movement of the carriage could lead to excessive movement and vibration. These factors will produce uncertainty in the data calculated.
Output Voltage Signal Proportional to Displacement
As explained in Section 22.214.171.124, a program has been created to produce output voltage signal that is proportional to the displacement of the carriage. The reason for this is to get the voltage value that is needed to move the carriage to a certain position. Essentially this part of programming needs a calculation to scale down the value of displacement into a voltage value within a range of -10V to +10V. For this, it is important to find a constant value for Voltage/mm. This constant value can be obtained by following a few steps:
Run the LabVIEW program that has been created to find displacement.
Find the overall length of the inkjet printer track by moving the carriage from end to end.
Record the displacement travelled by the carriage.
Repeat step 1 to 3 to get an average value for the displacement.
After the average value is obtained (in this case, 308.44mm), a simple calculation is carried out:
From the calculation, a value is obtained and it can be used inside LabVIEW to produce a voltage value proportional to the displacement.
D:\My Documents\Dropbox\4th year\FYP\Final report\Results\Proportional output voltage crop.jpg
Figure : Displacement and voltage history chart from Front Panel Window
As can be seen from Figure 26, the voltage is changing as the carriage is moved back and forth. The proportional output voltage also increases as the displacement covered by the carriage increases. From here, it can be concluded that higher voltage is needed in order for the carriage to travel further. From here it also shows the importance of having the right sample rate as the input signal is instantaneously processed into displacement and proportionally produced output voltage signal to be displayed on oscilloscope without having a loss of information. Most importantly, this result is a start for more advance control as the proportional constant can be obtained to move the carriage to the position as desired.
Controlling the carriage using Simulate Signal Express VI
Another attempt to control the inkjet printer carriage is to move the carriage by using Simulate Signal Express VI to specify the voltage, frequency and also the wave type of the simulated signal as discussed in Section 126.96.36.199.
Firstly, it is important to know the settings that have been used to simulate the signal.
D:\My pictures\Image 017.jpg
Figure : Simulate Signal Setting
From Figure 27, it can be seen that the user can manipulate many variables. However, the most significant variables are signal type, frequency (Hz) and amplitude. For this particular program, the signal type has been set to square wave as this type of wave will imitate real life movement of the carriage when it is printing. A test has been done to prove the previous conclusion that higher voltage is needed for the carriage to travel further. All frequency of the square wave is set to 2.5Hz as this will produce smooth back and forth movement of the carriage and it will not over travel and affecting the results. Four different voltage input to the motor has been set; 4V, 5V, 6V and 7V. The results are shown in figures below.
D:\My Documents\Dropbox\4th year\FYP\Final report\Results\square wave 4V crop.jpg
Figure : Carriage response with 4V input
D:\My Documents\Dropbox\4th year\FYP\Final report\Results\square wave 5V crop.jpg
Figure : Carriage response with 5V input
D:\My Documents\Dropbox\4th year\FYP\Final report\Results\square wave 6V crop.jpg
Figure : Carriage response with 6V input
D:\My Documents\Dropbox\4th year\FYP\Final report\Results\square wave 7V 2 crop.jpg
Figure : Carriage response with 7V input
As seen from Figure 31, it can be seen that the carriage is just barely moving by having maximum displacement within a range of 0.4mm to 0.5mm. However, as the input voltage to the current amplifier increases, the displacement is significantly increases. Data from figures above are tabulated in Table 4 so that it is easier to analyse.
Wave Frequency, Hz
Carriage displacement, mm (as seen from Displacement indicator)
Table : Input voltage with its corresponding carriage displacement
From Table 4, it is important to note that the actual displacement is higher in real life compared to the one recorded in the figures as the response and displacement are changing too rapidly when the LabVIEW program is run, hence making the data a little bit less accurate when taking a screen shot. However, it can be safely concluded that higher input voltage to the motor will make the printer carriage travel further. Hence, for further control, it is important to find the most suitable input voltage to the motor to get the desired displacement.
Technical Difficulties and Limitations
The main objective of this project is to create a controller that can control the movement of the carriage so that it can be a good visual representation for a position control problem, particularly for students who will be studying mechatronics. However, in attempts to achieve the objectives, few technical difficulties have been encountered. This is due to the hardware limitation that has led to a serious time constraint problem.
Firstly, the technical difficulty is caused by the movement of the printer cartridge carriage which was having too much vibration. This is not good for the project because vibration could cause error in the position measurement. One of the steps taken to solve this problem is to apply grease to reduce friction. However, the problem is still there. After a week or two, the problem was solved by increasing the power supply for the current amplifier.
Another problem is mainly caused by the Data Translation Device DT9837. Initially, this device is expected to be able to produce output signal and at the same time it needs to receive input signal and determine the carriage position. However, due to driver and hardware problem, this hardware is incapable to produce output signal when it is receiving input signals at the same time. At first, it is suspected that there are some errors with the LabVIEW coding, but after almost a month of amending, rearranging and redesigning the coding, the problem persists. Mr Chris Grigson, one of the senior technical staff for the university suggested using another device, Data Acquisition Device NI USB-6211 to produce an output signal. Surprisingly, right after the device is connected to the computer and the current amplifier, I managed to run the LabVIEW code that I have developed almost a month ago. This means that a lot of time has been wasted for a problematic hardware. This is the main difficulty encountered in this project. At last, this project is running with two data acquisition devices, with each of them having a different task, but still working in the same LabVIEW VI.
From this project, it is proven that inkjet printer carriage movement can be used as a demonstration for a position control problem. The moving carriage represents a mass in vibrating motion. In order to reduce the vibration or the uncertainty motion, role of damper is important to act as a shock absorber. For inkjet printer, without proper dampening effect, the carriage will experience overshoot and will not move smoothly, and it will affect the accuracy of the position counts.
For the calculation to be accurate, it is very important to find a suitable sampling rate and also sample per channel. This is to prevent loss in information when sampling the original signals. A suitable sample rate will lead to more accurate results; hence can be used for advance programming.
Although all objectives are not fully fulfilled due to technical difficulties, this project can still be used to demonstrate position control problem by simulating the signal and producing an output voltage. From here it is obvious that without proper feedback and control, the movement of the carriage will not be smooth and it will not move as desired.
Due to hardware problem, this project needs to be further enhanced by developing a control coding for the LabVIEW in the future. For now, several attempts have been made to develop a controller, including an attempt to use PID control. However, due to time constraint, the program still has a lot of flaws in terms of settings and connections and it needs a lot of amendment.
Below is the diagram of the attempts to develop a controller. It managed to move the printer carriage but still not as desired.
D:\My Documents\Dropbox\4th year\FYP\Final report\block diagrams attempt control 2.jpg
Figure : Control Attempt
One of the most important factors for the success of this project is the ability of the hardware to support advance control coding. It is advised to check the hardware capability and also issues prior furthering into the project to avoid the same problem from occurring. It is also advised to do a lot of researches in term of LabVIEW programming and basic mechatronics involving mass-spring-damper system. And last but not least, it is very important to always find the perfect sample rate in order to get the best results.