Development of Control Interface For an Industrial Print Positioner

This thesis involves the feasibility study on the opto isolation for an industrial print positioner and the possible solutions for the Industry 4.0 connectivity of it. The major problem was with the communication between the computer and print positioner system. The interfacing is achieved through the RS422 protocol. This thesis aim is to establish an interface by using a microcontroller and has the capability of controlling the system wirelessly. Different types of opto isolation are considered in the feasibility study but Photodiode opto isolation chosen due to its compatibility with the system. For Industry 4.0 connectivity, Cyber Physical Systems (CPS), Internet of Things (IoT) and Cloud Computing (CC) have looked up. Internet of Things (IoT) is the most acceptable solution for this system so multiple system can be monitored at the same time by controlling it from the central computer.  Finally, the microcontroller is integrated into the system to control it. The aim of interfacing through the microcontroller is achieved by integrating an Arduino with RS422 shield mounted onto it in the system. First of all the RS422 protocol understood by carrying out research on it and then with the help of logic analyser to see how the commands sent from the computer changes after they passed through the in-line converter. The final goal to send the commands to the system wirelessly through Arduino Wi-Fi and Ethernet shields didn’t achieve due to not able to programme the motor in Arduino language which only understands MCode. This thesis just not explains the interfacing through an Arduino but also justifies that the additional features added to the system due to it. This can be implemented to the other systems which don’t require very high tech equipment for automation. This shows that the implementation of Industry 4.0 connectivity into the system not just make it more efficient but also safe and reliable as well. CONTENTS CHAPTER 1: INTRODUCTION 1.1INTRODUCTION 1.2 AIM 1.3 OBJECTIVES CHAPTER 2: BACKGROUND 2.1 WHAT IS AN OPTO ISOLATION? 2.1.1 Closed Pair 2.1.2 Slotted Coupler\ Interrupter 2.1.3 Reflective Pair 2.2 DIFFERENT OPTO ISOLATIONS 2.2.1 Photo resistive opto isolation 2.2.2 Photo diode opto isolation 2.2.3 Photo transistor opto isolation 2.2.4 Bi-directional opto isolation 2.3 INDUSTRY 4.0 2.3.1 Cyber Physical System 2.3.2 Internet of Things (IoT) 2.3.3 Cloud Computing CHAPTER 3: METHODOLOGY 3.1 INTERFACING SETUP 3.2 INTERFACING PROTOCOL RS422 AND RS485 3.2.1 RS422 3.2.2 RS485 3.3 MICROCONTROLLER 3.3.1 Raspberry Pi 3.3.2 Arduino 3.4 MCODE 3.4.1 Instructions 3.4.2 Variables 3.4.3 Flags 3.4.4 Keywords 3.4.5 Math Functions 3.4.6 Program Structuring CHAPTER 4: RESULTS 4.1 ARDUINO ETHERNET SHIELD 2 4.2 ARDUINO WIFI SHIELD 4.3 LOGIC ANALYSER 4.4 ARDUINO RS422 SHIELD AND MOTOR CHAPTER 5: DISCUSSION 5.1 OPTO ISOLATION 5.2 INDUSTRY 4.0 5.3 NEW INTERFACING SET UP CHAPTER 6:  CONCLUSION CHAPTER 7:  FUTURE WORK APPENDIX 8.1 PROGRAM FOR ARDUINO RS422 SHIELD 8.2 PROGRAM FOR ETHERNET SHIELD 8.2.1 Program for DHCP-based IP printer 8.2.2 Program for DHCP Chat Server 8.3 PROGRAM FOR WIFI SHIELD 8.3.1 Program for Wi-Fi Shield to Scan For Networks 8.3.1 Program for Wi-Fi Shield to Connect to WPA Network REFERENCE TIME MANAGEMENT DIAGRAM PROJECT COSTINGS RISK ASSESSMENT FORM                   List of Figures Figure 1.1: The interaction possibility of a smart factory in Industry 4.0 [12] Figure 1.2: The current layout of the system Figure 1.3: The proposed layout of the system after introducing opto isolation in it Figure 1.4: The proposed layout of the system for new interfacing set up Figure 2.1: Closed pair configuration of opto isolation [7] Figure 2.2: Slotted Coupler\Interrupter configuration for opto isolation [7] Figure.2.3: Reflective pair configuration of opto isolation [7] Figure 2.4: Opto-coupler with Photo diode output [9] Figure 2.5: Opto-coupler with Photo Darlington transistor [9] Figure.2.6: The four-industrial revolution and their time period [12] Figure 2.7: Today’s and Industry 4.0 factory comparison [16] Figure 2.8: 5C architecture for implementing Cyber Physical Systems [16] Figure.2.9: Applications and procedures combined with each level of the 5C architecture [16] Figure 2.10: The flow chart of a CPS enabled factory with the equipment which is compatible to 5C CPS architecture in the production line [16]. Figure 2.11: Industry 4.0 connectivity for a case study using “Internet of Things” [11] Figure 2.12: The products services based on IoT [17] Figure 2.13: Showing different steps involved in the implementation of IoT [17] Figure 2.14: Different layers of cloud architecture with it activities and standards [18] Figure 3.1: P1100-00-400 with kit P1100-70-400-400 mounted onto it [29] Figure 3.2: Cable connections for power supply box [29] Figure3.3: Cables and connections from the supply box [29] Figure 3.4: The connections of the motor and datum leads from the box [29] Figure 3.5: The window opened after running the print positioner setup Figure 3.6: The setup window after connecting the computer and system Figure 3.7: Changing and updating the parameters value Figure 3.8: Illegal parameters turns into red Figure 3.9: Parameters which directly affects the motion of the print head [29] Figure 3.10: Print positioner setup for bidirectional printing Figure 3.11: Comparison of noise in a straight and twisted cable [21] ] Figure 3.12: Comparison between different serial communications [22] Figure 3.13: Functions of pins in RS422 and RS485 [20] Figure 3.14: Network topology of RS485 [22] Figure 3.15: Raspberry Pi [24]] Figure 3.16: Arduino Uno Figure 3.17: Arduino RS 485 RS 422 shield [26] Figure 3.18: Arduino Ethernet Shield 2 Figure 3.19: Arduino Wi-Fi shield [28] Figure 3.20: The MCode recommended program structure Figure 4.1: MD-CC401-001 communication converter [30] Figure 4.3: MD-CC401-001 communication converter Figure 4.3: MD-CC401-001 communication converter Figure 4.3: The in-line converter corresponds through these pins to M12 connector pin functions Figure 4.4: Arduino RS422 shield connected to the system Figure 4.2: P2 communications, 5-pin M12F circular connector [30] Figure 4.1: P2 communications, 5-pin M12F circular connector Figure 4.5: The system connected to the logic analyser to read RS422 protocol Table 1: Determining undetermined end wire colours corresponding to which pins of circular connector and functions Figure 4.5: Arduino RS422 shield connected to the print positioner system to communicate with it Figure 4.6: The close look up of the wires coming from M12 male connector to the Arduino RS422 shield Figure 4.7: The data read before starting the system Figure 4.8: The data read once the system turned off without performing any function Figure 4.9: The data read when the system was idle Figure 4.10: The data read once the start button pressed to complete the instruction Figure 5.1: The configuration of M12 male connector used in the start [30] Figure 5.2: The configuration of the M12 male connector given by the supplier of the motor Figure 5.3: The right configuration of the M12 male connector to control the motor [30] Table 2: Project Costs Incurred   List of Tables Table 1: Determining undetermined end wire colours corresponding to which pins of circular connector and functions Table 2: Project Costs Incurred                               DECLARATION   Author:                     Muhammad Umair Afzal Title:                         Development of Control Interface for Industrial Print Positioner Qualification:           BEng Mechanical Engineering Date of Submission: 28th April 2017 I, Muhammad Umair Afzal hereby certify that this is a true copy of my thesis, and I am the sole author of this thesis submitted for a Bachelor of Engineering in Mechanical Engineering to The University of Dundee. I can confirm that no part of this thesis has been submitted and that any ideas, techniques, methods and materials which are the work of other people have been fully acknowledged in accordance with the standard referencing procedure.                    


In this chapter the motivation of doing this project is explained. Industry 4.0 is the fourth industrial revolution in which the systems can communicate with other systems and concept of smart factory arisen from it. Opto isolation is a method in which the electrical signals are transmitted through light in between the two isolated circuit that is going to be used in the system to make it safer and reliable.


In coming 5 to 10 years more companies in Germany will adopt the Industry 4.0 in a result the production will be increased. The amount of money will be made from the manufacturing sector though gain in production due to Industry is roughly €90 billion to €150 billion. The automotive industry can expect the sales to increase by 10 to 20 percent. [1] Due to Industry 4.0 there will be drive in revenue growth of Germany as well. €30 billion addition revenue will be added because the manufacturers require latest equipment and user wants various customized products. For German manufacturers to make their system to adapt Industry 4.0 need to spend €250 billion in the coming 10 years. [1] Industry 4.0 popularity is increased recently and attracting the researchers, application developers, manufacturers and governments because it offers so much like reduction in the energy consumption, increase the economic benefits and also enable the smart production. As the society and industry is developed so from the Industry 4.0 the concepts of smart factories and other frameworks like this are also proposed. The information and communication technologies (ICTs) are implanted into the systems by using big data, internet of things, industrial cloud and wireless cloud networks to make the manufacturing factories to be competitive by making products at low prices with higher quality. [2] In the model of an oligopoly, by introducing a new product or adopting a new technology for a product to makes it better it gives an edge over the rivals. By doing so the chances of him to get a bigger share in the market increases as well. [3] With having wireless system, it gives the opportunity of having a system flexible and no obstruction in the movement means it can be easily moved or replaced from the original position and can be controlled from anywhere. The technology is getting better every day by day. Technology just not bring the comfort in every aspect of the life but also makes the life safer as well. 

Figure 1.1: The interaction possibility of a smart factory in Industry 4.0 [12]

Europe is shocked in last few years due to the disasters caused by technical breakdowns. In the consequence of that lives lost, injurie, and damage to the environment [4]. If the statistics of the accidents looked up in the industry, the accidents due to the electricity are not many but they were quite severe in their nature [5]. To minimise their effects precautionary measured should have to be taken to avoid them and in worst case scenario to keep the loss minimum as much as possible. Opto-couplers and opto-isolators are used in different applications on their own or in some cases to switch the other electronic devices like transistor etc. and triacs supplying the electrical isolation in between the lower and higher voltage signal. Opto isolation is used in the switching of microprocessor input/output, direct current and alternative current power control etc. Electrical signal can be transmitted analogue or digital way. [10] That’s the reason of bringing the concept of the opto isolation in the system to make it safer.

1.2 AIM 

Claromech wants to analyse the design of the current electronic controls in an industrial electro-mechanical actuator in order to boost the equipment reliability and lower cost, and also to introduce new features that will provide additional sales opportunities. Claromech uses an electro-mechanical actuator in conjunction with a continuous inkjet printer to provide a mechanism for printing data onto high volume manufactured goods. The actuator which is known as “print positioner” was designed 10 years ago is outdated and need modification to improve functionality and electrical reliability.

Figure 1.2: The current layout of the system

This will be achieved by integrating an Arduino with RS422 shield on it into the system. This will not just help the system to perform better but also give an edge over the other systems who are still using old interfacing protocol and more sales opportunities.


The first objective involved to find a solution to opto isolate all the external inputs of the system. Different opto isolation types are currently used in the applications and were analysed to see on what principle each one worked to find out which will be the best for the following system. Later, it’s found that the company sorted out that issue so just only required to do feasibility study on this problem. The second objective involved to do research on Industry 4.0 and find out the best possible solution which can be implemented in the system to make it a part of the smart factory. Cyber Physical Systems (CPS), Internet of Things (IoT) and Cloud Computing (CC) were looked up as well to find out how and what steps involved in implementing the Industry 4.0 connectivity into the systems or factories?

Figure 1.3: The proposed layout of the system after introducing opto isolation in it

The third objective involved the integration of a microcontroller in the system. An Arduino Uno was chosen as a microcontroller and to communicate with the motor an Arduino RS422 shield mounted on it to change the code into MCode which was written in Arduino language. The final goal was to set up the parameters of the system through the microcontroller like changing its velocity, acceleration etc. and then using internet or Wi-Fi to control the system wirelessly which was achieved through the Arduino Wi-Fi and Ethernet shields. All this research made sure that the new interfacing set up can be built successfully by using Arduino and different shields. The system designed through this has less chances of failure, easily replaceable and cheap components which can be modified according to the customer requirements.

Figure 1.4: The proposed layout of the system for new interfacing set up


In this chapter, the feasibility study done on opto isolation is explained. Different opto isolation types were looked in detail to know more about their working principle so that can be modified according to the requirement. Industry 4.0 can be implemented into the system using cyber physical systems, internet of things and cloud computing. Introduction of it in the systems increase the production and safety of the system. The microcontroller for the project, Arduino, was chosen after doing research due to the features of it like open source, cheap, simple to use etc.


Opto isolation is a method in which two circuits communicate with each other without a physical connection. The circuit is basically consisting of a LED and a diode. When the LED emits lights, the diode on the other side converts that light into electric signal. The opto isolation can have different source-sensor combination like LED-photo diode, LED-LASCR and lamp-photo transistor pairs. There are three types of configurations in which opto isolation is used. These configurations are closed pair, slotted coupler and reflective pair. [6]

2.1.1 Closed Pair

In this configuration, the opto-isolator is denoted as to as a closed pair. This configuration is just not used in electrical applications but also in solid-state relaying and level conversions as well. [6]

Figure 2.1: Closed pair configuration of opto isolation [7]

2.1.2 Slotted Coupler\ Interrupter

In the slotted coupler\interrupter method an open slot is present in between the device and the sensor which acts like a blocker and can block the signals on the requirement. This type of devices is often used in the object detection, bounce-free switching and vibration detection. [6] [7] 

Figure 2.2: Slotted Coupler\Interrupter configuration of opto isolation [7]

2.1.3 Reflective Pair

In the reflective pair configuration of opto isolation a source and sensor are the part of the mechanism as in other configurations but this time the light that the sensor received is reflected off an object. In this way, the light intensity can be controlled by setting the light to reflect at angle. [6] 

Figure.2.3: Reflective pair configuration of opto isolation [7]

The terms opto-coupler and opto isolator are used in the explanation of opto isolation because both of them perform the same function. There is a slight difference in between them which is working at different value of voltage. The opto-coupler is used in transmitting analogue or digital information by keeping the electrical isolation at the potential value of up to 5000 V and the opto-isolator is used in the application where the potential difference is above 5000 V. [8] There are few parameters which should have to be considered while using opto-coupler and opto-isolator:

  • Current Transfer Ratio (CTR): One of the main specification of opto-coupler is the current transfer ratio. This is the ratio of the current flowing into the output device divided by the current in the input device. [8]
  • Input Current: The amount of current required for input transmitter device. To limit the flow of current this value is used to find out the series resistor. [8]

Current Transfer Ratio = I input / I output

  • Bandwidth: This helps in understanding the data speed which can be used in an opto-coupler. In the opto-couplers who use phototransistor, the bandwidth value is in range of 250 kHz. The smaller the value for current transfer ratio gives faster rise and fall times. [8]


There are four types of opto isolation are available. All of them use them use the same basic principle but has their own characteristics depending upon the sensor and receiver used in it.

2.2.1 Photo resistive opto isolation

Photo resistive opto isolation consist of LED or incandescent lamp or neon lamp as source and for the receiver a semiconductor base photo resistor made of cadmium selenide or cadmium sulphide. Photo resistive can be used in AC and DC circuits as compared to the photo diode and photo transistor opto isolation. The speed of this opto isolation is very low. The current transfer ratio is <100%. 2.2.2 Photo diode opto isolation Photo diode opto isolation use LED as source and silicon diode as receiver. The opto isolation speed is the highest for this type. The current transfer ratio is 0.1-0.2%. The setup for photo diode opto isolation is shown below (Figure 2.4). When the light of an LED falls on silicon diode, photo current IL or Iout will be produced which will flow in the silicon diode. A voltage VL will be developed across that load due to the photo current IL and the load resistor RL present in the output terminal of that opto coupler. [9] VL = Iout * RL When the input voltage is changed due to which the intensity of the light is affected. The value output current is also changed as well and in a result the output voltage VL too. If the input current is increased then the output voltage will be increased as well. If there is a small change in the input current happens it creates proportion change in the output current. If the output voltage need to be amplified then it can be connected to the amplifier to get the desired result. [9] 

Figure 2.4: Opto-coupler with Photo diode output [9]

The opto isolation type which was selected for the project was photo diode opto isolation. 2.2.3 Photo transistor opto isolation The circuits which are designed by using this isolation required fluctuations of parameters in commercial devices and they can be dangerous as well. The diode is just replaced by a photo transistor in the circuit which is shown above to get the higher value of current transfer ratio. To increase or decrease the sensitivity of the transistor the base lead of it can be forward or reverse bias respectively. If in some application, it requires even bigger value of that it is replaced then with Darlington transistor. This opto-coupler can be used as digital switch or linear amplifier and it all depends on the forward bias voltage enforced on the base of a transistor. [9] 

Figure 2.5: Opto-coupler with Photo Darlington transistor [9]

2.2.4 Bi-directional opto isolation All the other opto isolation types are uni -directional. The LED’s which are used in the isolation type are near infrared spectrum instead of the visible spectrum because of their poor transfer efficiency. The speed of this type opto isolation is low to medium depending on the type of LED and sensor is used. The current transfer ratio normally is about 0.06%.

2.3 INDUSTRY 4.0

Industry 4.0 connectivity is the automation and data exchange in modern manufacturing technologies. It involves mechanisms like cyber physical system, the Internet of things and cloud-computing. From Industry 4.0 connectivity the concept of “smart factory” is aroused. Rather than human workforce commands the whole process, by this smart factory facility machines communicate with each other through and do what needs to be done. The technologies really helped mankind in the production of the industries since the start of the industrial revolution. Now, modern civilization is stepping into the 4th industrial revolution but it was started from the stream engine powered machines used in rails, factories etc. in the nineteenth century. With the invention of the electricity the mass production started in the beginning of the twentieth century. In 1970’s the industries were automated. [1] [11] [12] 

Figure.2.6: The four-industrial revolution and their time period [12]

There are numerous reasons of forcing the governments and other think tanks to implement this Industry 4.0. There is a huge impact of the industries on the environment which be global warming and environmental pollution. The industries are using non-renewable assets like petroleum etc. and workforce is reducing due to the population aging. So, the industrial processes must be performed by using small amount of energy and cost and achieve high flexible and efficient process. Flexible manufacturing system (FMS) and agile manufacturing system (AMS) are the two proposed schemes to get rid from the shortages which are the production lines are facing now. [13] Now a day companies are struggling to cope with the challenges of dealing with huge data issues to make quick decisions to improve the productivity in this competitive business age. Germany is leading the race in the renovation in the direction of 4th Generation Industrial Revolution (Industry 4.0) based on the Cyber-Physical System (CPS). The products are further improved by adding software and implanted intelligence into it. These technologies are helpful later on in the judging the performance of the product and pinpoint the service it needs and manage itself. [14]

2.3.1 Cyber Physical System

Cyber-Physical Systems (CPS) is basically connecting the systems physical and computational abilities which can contact human beings through different techniques. To make new developments in the future in technology it’s very important to develop physical systems which can join with the control, computation and communication to increase their potential. A lot of research is carried out by the computer researchers in the recent years and different programming languages, new visualisation methods, quick computing techniques and advance methods are introduced to make sure that the computer system is secure, reliable and defect resilient. In industry, most of the engineering systems are developed by the results obtained from the analysis of hardware and software operation. In an automotive industry, the control system of the vehicle depends upon the components made by other manufacturers while utilising their own software and the hardware. The manufacturers who supplies the components to the different customers put an effort to make the same type of parts which can fit in different vehicles by doing so the cost of the component of making it is reduced. As the world is making progress in the technology day by day it brings the new challenge of making the control system for the vehicle of future generation. [15]  Figure 2.7: Today’s and Industry 4.0 factory comparison [16] The considered 5-level CPS structure in other words known as 5C architecture gives the guideline in every aspect of implementing it the manufacturing operation. CPS has two main function factor: (a) the foremost connectivity which makes sure the quick data recovery from the physical system and the instruction evaluation from cyber space. (b) The cyber space which is constructed from the brilliant computational, analytics and data management. But this information is not enough to implement on a system to make a CPS. In the figure below it is shown how to implement 5C architecture. [16] 

Figure 2.8: 5C architecture for implementing Cyber Physical Systems [16] Smart Connection

The first step in making the CPS application is to get the precise results from the machines and the components of them. The data can be obtained from the sensors directly or controllers or different systems such as ERP, MES, SCM and CMM. In the first step of implementing CPS two factors must be considered. First, considering the data of different types, consistent and cord free approach to handle data acquiring and to send the data to main server and it requires special protocols like MTConnect etc. The second factor is choosing the right sensor. [16] Data-to-Information conversion

The useful information must be identified from the raw data. There are many methods are currently in use for the information conversion level from the data. The comprehensive research has been carried out to make the algorithms for guessing and the applications which involves health management. The calculation of the health value, estimated remaining life etc. The implementation of the second step of CPS usher self-awareness to the machines and this is shown in the figure below. [16] 

Figure.2.9: Applications and procedures combined with each level of the 5C architecture [16] Cyber

The cyber plays an important role in the 5C architecture and all the information come to it. All the data which is collected from the machine is send to it and a machine network is formed. All the information which is gathered in this procedure is analysed by special logics to get to know the status of the machines. The logics gives the machine capability of comparing herself. By knowing the different machines performance and the data collected in the past help in predicting the status of the machinery in future. [16] Cognition

A decisive information is gathered by implementing that much CPS. The right presentation of the acquired data is very important because on that expert users make their decision. The status of every individual machine and the comparative data is available which help in making the decision to use the same method for the next badge or certain amount of time or it needs to be optimized to get the better results. This level requires info-graphics to send all the acquired data to the users. [16] Configuration

To make the machines to take the decisions about their selves the configuration level of CPS is play a role of the feedback from the cyber space to physical space. The decisions which is made in the cognition section are implemented in this stage to make the system work according to the desired specifications. With the availability of sensors, data obtaining and analysing methods and computers, the companies are more interested in implementing advanced technologies. CPS integration into the factories will have significant economic potential. [16]

Figure 2.10: The flow chart of a CPS enabled factory with the equipment which is compatible to 5C CPS architecture in the production line [16].

2.3.2 Internet of Things (IoT)

The Internet of Things is the way of connecting physical devices with the software, electronics and sensors, to exchange data with each other without any human intervention. To achieve this ambitious goal the microelectronics miniaturization and proper communication interfaces are required as well. The load of knowledge is available for network technologies like Bluetooth or Wireless, Ethernet etc. Different kinds of interfaces are available now due to which software integration is still quite expensive. [11] 

Figure 2.11: Industry 4.0 connectivity for a case study using “Internet of Things” [11]

In the figure 2.12 it is shown that the function of a simple device like light bulb whose main role is to provide light can be enhanced with IoT mechanization. This light bulb can be transformed into the security application which turns on when any things come in front of it detected through the sensors and let the owner know by sending an alert message on his mobile phone. Another example of IoT can be a bin which is mainly used for storage. By adding the features provided by IoT it can filled itself if required by knowing it’s weight through which the stock level will be determined and if it is not at the desired value then fill it up. The tractor functionality can be upgraded by the addition of IoT technology whose main role is to toe the equipment related to the farming. The tractor itself with the help of IoT can predict when the maintenance need to be done etc. The applications of IoT things not restricted for an individual product which is connected. It can be connected to the products related to it and product system is formed. By taking the example of the tractor which can be connected to the other tractors, harvesters and other farm equipment, the location of them is monitored in addition to the indicators of the performance of these machines to improve the efficiency of this whole system. [17] 

Figure 2.12: The products services based on IoT [17]

To implement IoT technology in a product it requires combination of various type of software and the hardware components from the multilayer stack which is shown in the figure 2.13 of IoT mechanization. There are three type of the layer in that stack, first is device layer, second is connectivity layer and the third on is IoT cloud layer. At the stage of the device layer the IoT hardware in which different kind of sensors etc. are integrated on the hardware which is available. For operating and manging these physical things the installed software is modified to make it suitable for the new hardware which is created or the new software is used for this purpose. In the connectivity layer of that stack the communication is enabled in between the physical thing and cloud. On the IoT cloud layer of that stack, the software which is integrated on the system for operation and management of it is used to perform its job when the application is started. The data is stored, processed and analysed obtained from the analytic software which is installed onto the connected thing and the software for the process management helps in defining, executing and monitoring processes in the environment of it which include human beings, systems and physical things. [17] The future of the IoT is very bright and expectations from it rising day by day to meet them a big step up required. There are few challenges related to the technology side but some of them are related to the business side of it like operational and strategic question which are aroused due to the connected products. New hardware and software are required to communicate with each other. Other challenges like Internet stability, personal privacy, identifying and addressing etc. are currently experienced by the innovators of IoT. All these challenges will inspire the future generations to work on these problems and come up with solutions which will solve all these challenges. [17]

2.3.3 Cloud Computing

Figure 2.13: Showing different steps involved in the implementation of IoT [17]

Cloud computing (CC) is a kind of Internet-based computing. This share computer processing sources and data to the computers and the other devices which are connected to it like mobile phone etc. Cloud Computing is quite popular now a day and due to its bright future, every giant of IT sector developed his own platforms and architects for CC. The financial advantages provided by CC in the Networked Enterprises are very important in the technology and providing the collaboration possibilities. SMEs are adapting to the CC very quickly because this gives them an opportunity to a better role in the competitive market regardless of their size. The clusters, clouds and grids are the main computing architects which can be implemented in the networked enterprise. [18] “Cloud computing is a model for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction.” The model of cloud which is defined promotes availability. The number of essential characteristics are five, service models are three and deployment models are four according to this cloud model. [18] Essential Characteristic

On-demand self-service. A consumer can access computing facilities like server time and data storage when required without any human interaction [18]. Broad network access. The resources are available over the network and can be accessed through the various standard mechanisms like PDA, mobile phone and laptop [18]. Resource Pooling. “The provider’s computing resources are pooled to serve multiple consumers using a multi-tenant model, with different physical and virtual resources dynamically assigned and reassigned according to consumer demand” [19]. Rapid elasticity. “Capabilities can be rapidly and elastically provisioned, in some cases automatically, to quickly scale out and rapidly released to quickly scale in” [19]. Measured Service. Cloud systems automatically control, optimize monitor, control, and report resource usage (e.g., storage, processing, bandwidth, and active user accounts) providing transparency for both the provider and consumer of the utilized service [18]. Service Models

There are various computing aspects are in CC and one solution for all problems can’t be used. With service and deployment models, clouds can be explained. [18] Cloud Software as a Service (SaaS).This is known as Service or Application clouds [18]. The user only use the infrastructure of the cloud but don’t have access to manage and control it except limited access to the user-specific configuration settings [19]. Cloud Platform as a Service (PaaS). The facility given to the consumer is to setup the infrastructure of the cloud. The customer can only manage the “deployed application and possibly application hosting environment configurations”. [19] Cloud Infrastructure as a Service (IaaS). This is also known as Resource cloud. “The facility provided to the customer is to provision processing, storage, networks and other fundamental computing resources through a service interface”. [18] “The consumer does not manage or control the underlying cloud infrastructure but has control over operating systems, storage, deployed applications, and possibly limited control of select networking components” [19]. Figure 2.14 which is given below showing the service layers, in the parallel lines the activities and standards related to each layer. By doing this a new controlling scale for various service models which are connected to the service provider. The consumers marked the various layers and sub layers with the contrasting graphical patterns. [18] 

Figure 2.14: Different layers of cloud architecture with it activities and standards [18] Deployment Models

Private Cloud. The infrastructure of the cloud is only used for one organisation. It can be managed by an organisation or third party and either on premise or off premise. [19] Community cloud. “The cloud infrastructure is shared by several organizations and supports a specific community that has shared concerns (e.g., mission, security requirements, policy, and compliance considerations)” [19]. Public cloud. “The cloud infrastructure is made available to the general public or a large industry group and is owned by an organization selling cloud services” [19]. Hybrid cloud. “The cloud infrastructure is a composition of two or more clouds (private, community, or public) that remain unique entities but are bound together by standardized or proprietary technology that enables data and application portability” [19]. Special Clouds. Special clouds are extension of the normal cloud to give additional capacities to it [18]. The main problems which is CC facing now are related to the security and privacy. The data of an organisation who is using cloud computing is kept in the shared environment and that data is not as secured as the non-shared data. There are different cloud models are available in the market so when the model needs to be sold the factors like compatibility of it with other models and not getting the insight of the model are the key reasons for the consumer to put off from the model. The challenges which are cloud computing is experiencing in the data storage field are due to the aspects like storage manager, failure at single point, the data revelation to the third parties. [18] The cloud computing has key characteristics due to which it will be introduced into the main IC technologies. The biggest advantage of this technology is that the consumers of it don’t need to manage and own the massive amount of the equipment which it required for its operation. The model which is adopted by the cloud computing is pay-per-use which is very convenient for the user. The other advantages of it are the automatic reproduction of the data which is very handy in case of the accident if the data is lost, fragmentation of the data and dispersal, and automatically confining the data. [18]


In this chapter, the interfacing set up on which the system is currently working is explained. The system is using RS422 protocol. To add a microcontroller in the system which is Arduino it was necessary to understand RS422 protocol to help later in programming. To use advance protocol RS485 was analysed here as well also there was not much big difference in RS422 and RS485. The Arduino shields which were used in the project are discussed here and their functionality. MCode basic are explained as well. This is the language through which motor got the instructions to perform the actions.


The figure 11 which is given below showing the P1100-00-400 Positioner with P1100-70-400-400 mounting kit. While the figure 3.1 is showing the dimensions of the supply box and the number of connections which are coming out of it. 

Figure 3.1: P1100-00-400 with kit P1100-70-400-400 mounted onto it [29]

Figure 3.2: Cable connections for power supply box [29]

Figure3.3: Cables and connections from the supply box [29]

Figure 3.4: The connections of the motor and datum leads from the box [29]

As it is shown in the picture above that the power to the system is provided through the supply box while on its left there is another connection for controlling the motor which is basically used for interfacing between the computer and the motor. The USB wire is connected to the computer and a USB to RS422 converter is present in the middle which changes the commands from digital into binary and through that converter the motor can be attached with 10-pin wire crimp or 5-pin circular connector. In this system, it is attached with the help of P2-5-pin M12 circular connector (male). The reason of this converter is this that the MDRIVE23 motor only understands the MCode language. All the connection was connected according to the given instruction as specified in the manual of that system and made sure that they were not lose. The software was installed onto the computer to control the system which was provided by the company. Then the drivers for cable and virtual communication were installed onto the computer as well.  Once the print positioner setup run, a new window was opened and is shown in figure 3.5 and on top left it was indicating that on which port of the computer. By clicking on it the system connected automatically but if there is an issue with the USB port on the computer or with the cable then it will try to connect but gives the message of connection failed and returns to the disconnected state. If the connection is fine then the window which was opened before as shown in figure 3.5 turns into the control panel where parameters can be changed and shown in the figure 3.6. 

Figure 3.5: The window opened after running the print positioner setup

Figure 3.6: The setup window after connecting the computer and system

If the parameters need to be modified simply clicks on the value section of that and types the new value there. Once the new parameter value is added in that window that box will turns into yellow colour and save data box too indicating that before the new values are updated into the system it need to be saved as shown in the figure 3.7. Once this done then press the run cycle option and it will run the cycle according to the new values. If the parameters value is invalid the box in which the value of it is given turns into red indicating that there is an error in setting the parameters as shown in this figure 18. This could be happened if the stroke length is 100 and number of prints is 8 then the Print Stroke vale box will turn in red. To sort this problem just simply accept the error message and then change the relevant parameter and save the data and then run the cycle it will run again to the normal routine. 

Figure 3.7: Changing and updating the parameters value

Figure 3.8: Illegal parameters turns into red

The figure below is showing the parameters which directly affects the motion in a result performance of the print head.  Figure 3.9: Parameters which directly affects the motion of the print head [29] The print positioner system can print in the both directions for that the print both direction option need to be selected so instead of choosing the configuration for the number of prints for forward direction it needs to be done for the backward direction as well as show in the figure 3.10. The software has also the capability of calculating the time required for print stroke and return stroke which is displayed in that window as well because the speed can be different for direction from another so by adding them together given the total time taken for the cycle. 

              Figure 3.10: Print positioner setup for bidirectional printing

The E-STOP option which can be seen from the picture above can be used to stop the cycle instantly. Once this selected then the system will not accept the save data option anymore so the system need to be powered on/off again or the software needs to restart by using the diagnostic tools.


The system is currently using the RS422 protocol for interfacing. As company wants to add a microcontroller in it to get rid from this USB to RS422 converter and in doing so the need of the USB will be finished which cost about £150. The first thing needs to understand was the RS422 protocol.

3.2.1 RS422

RS422 and 485 are types of serial communication. The idea is very simple for serial communication. The speed of the serial communication is slower as compared to the parallel communication which sends the whole byte in once while earlier the serial transmits data one bit at once. The serial communication is mostly used in the applications where ASCII data is need to be transmitted. Ground (GND), Transmit (TR) and Receive (RX) are the transmission lines which used in the completion of this communication. Baud rate, parity, stop bits and data bits are the main serial characteristic. In the computers of Apple Macintosh, the type of serial connection used was RS422. The various transmission uses two wires each for transmitting and receiving signals that results in the better noise resistance and lengthier distances. [20] For RS422 keywords are serial, balanced and differential. Serial as mentioned above is just way of sending data bit by bit while balanced and differential characteristic of it which differs it from RS232 used in the application where low speed is required and shorter distances needed to be covered. For RS422 two wires are required for each signal and for better resistance against the noise its better be twisted. In every twist the currents due to noise induced by the external sources are reversed. So instead of amplifying them each other as in the case of straight line, the noise currents which are reversed due to the twisted wires cancel each other impact and is shown in the figure 3.11. RS 422 doesn’t require a modem for the connection, it provided a straight connection to connect with the intelligent devices. RS422 signal can handle ten receivers if they are available in the parallel. This given an opportunity to control the device from one centre and the commands sent from it can directly goes to the ten devices which is known as slave. The slave devices don’t have the ability to send the information back above shared interface line. RS422 only consider the multi-drop network topology. [21] 

Figure 3.11: Comparison of noise in a straight and twisted cable [21] ]

3.2.2 RS485

RS485 is an update of the RS422 as in this the devices number increase from 10 to 32. It describes the characteristic related to the electrical part of it to make sure that the enough voltage is supplied when the maximum load is applied. Due to its multi-drop capacity, a network can be created of devices by using a one serial port of it. The resistance to the noise and multi-drop capacity makes the RS485 the number one choice for the applications in industries in where loads of devices who are distributing the data connected to a PC or different controller for collecting the data, HMI, or different operations. [20] In the modern time, everyone looks for an interface which can perform more than one of the followings [22]:

  1. “Connect DTE’s directly without the need of modems”
  2. “Connect several DTE’s in a network structure”
  3. “Ability to communicate over longer distances”
  4. “Ability to communicate at faster communication rates “

RS485 is one of the versatile standard of the communication in the series of the standards by Electronic Industries Alliance (EIA) because it fulfils all the four points which are stated above. That’s the reason due to which RS485 communication interface is used in every data attainment and controller applications where the multiple nodes have to communicate with one another. [22] In RS485 there is not common zero for the signal reference. Even the big amount of difference between the transmitter and receiver in the sense of volts doesn’t have any issue with that. The signals of RS485 are floating and every signal is transmitted above a Sig+ line and Sig- line. The receiver of RS485 make a comparison between the two signals rather than doing it for the absolute voltage level on one signal line. To achieve the desired results, it’s better to twist the Sig+ and Sig- lines as it is shown above for RS422 lines in figure 3.11. The noise in the picture is due to the magnetic fields present in the environment. Due to the magnetic field the noise current and magnetic field lines are present in the data line of RS485. When the cable is straight the noise current which is available at that moment is flowing in the same direction and producing the looping current like a normal transformer. Once the wires are twisted, the direction of noise current at one section is different as compared to the other part of the cable. That’s the reason of less noise current in a twisted cable than a straight cable. The twisting of wire provides RS485 communication immunity which is a good way of cancelling noise. If in some case higher level of immunity is need to be achieved can be done by using both twisting and shielding methods. Shielding is method which is used to keep unnecessary magnetic fields from signal lines. The differential signals and twisting of the cables give RS485 communication edge over the other serial interfaces by sending the data over the longer distance. RS485 can communicate up to distance of 1200 m and bit rate of 5Mbp/s. The difference between RS232, RS422 and RS485 is shown in the figure 3.12. [22]

Figure 3.12: Comparison between different serial communications [22]

3.2.3 Network Topology and Functionality of RS485

Figure 3.13: Functions of pins in RS422 and RS485 [20]

The network topology is the main reason due to which RS485 is chosen for the data attainment and controller applications. RS485 is one and only interface who can internetwork between several transmitters and receivers of the same network. While using the receiver of the default RS485 with the input resistance value of 12kΩ it can connect to the 32 devices of the network. Now with the high input resistance value this number can go up to 256. The repeaters of RS485 are available as well with the help of them the number of nodes can be increased to thousands, covering several kilometers. This interface doesn’t require very smart network hardware, the implementation of the software is easy as well. That’s the reason due to which it’s very popular in which computers, microcontrollers, PLCs, smart sensors and methodical applications are involved. In the figure 24, RS485 network topology is shown. In RS485 network of a multipoint N number of nodes are linked. To achieve higher speeds and larger lines, it is necessary to have the termination resistance on both sides to get rid from the reflections. The 100 Ω resistors are used on both sides. RS485 interface should not have to be designed as star instead of that as a line with multiple drops. In star configuration, the length of the cable is small, proper termination cannot be achieved and the quality of the signal is significantly affected. [22] 

Figure 3.14: Network topology of RS485 [22]

In default state, all the transmitters of the RS485 bus are in tristate having high impedance. In general, at higher level protocols, any one node is declared as a master to send the commands to RS485 bus. While the rest of the nodes receive, the data sent by the master. The response from the nodes depend on the data sent by the master. In the situation like this bandwidth can be extended up to 100%. The RS485 network can be implemented in other ways as well where each node can start its own data session. It is not necessary for the senders to turn on or off RS485 driver. Once the data sent from the master in microseconds the drivers of RS485 automatically switch to the high impedance tristate. There is no need of to put delays on RS485 bus in between of data packets. The RS485 interface is used in another interface standard in which Profibus and Modbus are included as electrical layer. Consequently, RS485 is remain in use for several years in future as well. [22]


The microcontrollers which were considered for the following project were Arduino and Raspberry Pi. Both microcontrollers have their own advantages and disadvantages but here are only discussed which are related to the project.

3.3.1 Raspberry Pi

Raspberry Pi is basically a full functional computer, a deice name system-on-chip (SoC), it runs on Linux specially designed operating system, known as Rasbian [23]. Like a computer it has processor, memory and through HDMI it has a graphics driver too. To keep this on it requires power of 5V constanly stay on and when it needs to be turned off should have to be done by a software as a normal computer. The process of supplying power is a little complex because it doesn’t require two AA batteries for constant supply of voltage but also needs some additional hardware too for this purpose. To connect it to the internet is very easy because it has buily-in Ethernet port and any network can be accessed with small amount of setup. To connect it to the internet wirelessly, USB Wi-Fi dongle needs into it and driver needs to be installed. To connect a Raspberry Pi to the sensors it requires softeare to interface which is not really necessary if it’s going to be used for very basic function like giving water to the plants. Raspberri Pi can be programmed in various programming languages. [24] There are quite few disadavantages of the Raspberry Pi and few of them mentioned here related to the project. The hardware cannot be accessed in real time. For example, if the CPU is busy in performing some function and then the interfacing be delayed with the hardware. Raspberry Pi doesn’t have a built in Analogue to Digital converter (ADC) which is very important feature missing in it to fit with the project. The hardware design of it is not an open source. Raspberry Pi is not the best choice becauuse in the project  a lot of hardware intercation required and needs to read the data from the sensors to control the device. 

Figure 3.15: Raspberry Pi [24]]

3.3.2 Arduino

Arduino is a microcontroller and it is not as powerful as Raspberry Pi and is considered as a component on the computer system. It has a brilliant hardware for the electronic projects. [23] Arduino doesn’t run the full operating system instead of that just execute the written code as the firmware of it interprets. In the operating system, the simple tools can’t be accessed while executing the basic code is simpler and operating system overhead is not required either. The main role of the Arduino is interfacing with the devices and sensors and it’s an excellent choice in where it must simply response the readings from the sensors and manual input. It doesn’t sound a lot but it gives authority to the user to control the devices in better way. Top power up the Arduino it only needs the USB wire from the computer or can be powered up with the battery as well. Even the power is dropped from the certain level where it should have to be not give software errors or user end up with the corrupt operating system. Once the power is unplugged it stops working. [24] There are loads of advantages of Arduino which is available in different types of boards but the one which was used in the project was Arduino Uno. It is very easy to use it even without having proper hardware simple code like blinking a LED can be run on the board by just using the code given in the examples. To add a functionality to it is very easy as well by just implanting a shield it can perform different function depending upon the shield used. This can be used in real time applications. The hardware and software of it is open source so if the user even doesn’t have expertise in programming can just simply get the code online and finish his work. Online forums are available as well where people share their code for various projects. To connect Arduino to a Windows PC, Mac or Linux it only needs a USB cable and can easily transmit the data. [23] [24]. For the project, Arduino had to interact with the hardware which is a speciality of it so that’s why it was the best option of the microcontroller to choose. The Arduino Uno [25] is shown here: 

Figure 3.16: Arduino Uno

Arduino RS422 and 485 shield

This shield allows the user to connect it’s Arduino to the RS485 and RS422 networks and an example of that is Profibus. This shield has Sipex SP1486E driver with the unit load of 1/8th to make it capable of connecting 256 transceivers on one single line. The chip on the driver features maximum speed of 20 Mbps and other useful features. By using different configuration on the board this shield can be used through UART or digital Input/output with Software Serial library. [26] 

Figure 3.17: Arduino RS 485 RS 422 shield [26]

Arduino Ethernet Shield 2

This shield allows the Arduino to connect to the internet. Simply mount this shield over the Arduino board and insert the network cable with RJ45 connector into it and it’s ready to be controlled over the internet. The Arduino Ethernet shield 2 [27] is shown below: 

Figure 3.18: Arduino Ethernet Shield 2

Arduino Wi-Fi shield

The digital pin 7 between the Wi-Fi shield and Arduino is used for handshaking and in any case that shouldn’t have to be used. There are different colour LED’s on that shield which lights up according to the information that the board is receiving. The LED which is marked as LINK is green in colour and indicates that the shield is connected to the network, the one which is marked as ERROR is red in colour and indicates that there is an error in the communication and the one which is marked as DATA is blue in colour and indicates that the data is being transmitted or received. [28] 

Figure 3.19: Arduino Wi-Fi shield [28]


The motor MDrive 23 used in the print positioner system only understands the commands written in MCode. So, for later on programming the motor in Arduino language it was necessary to understood it and that will help it in doing so. Immediate and program are two operational modes for the products compatible to MCode. In the immediate mode, the commands are directly issued and executed by the controller which are given in the terminal window by the user. While in program mode the user programs are used as input in the motion controller. [31]Five primary components of the MCode programming language are [31]:

  1. Instructions
  2. Variables
  3. Flags
  4. Keywords
  5. Math functions

3.4.1 Instructions

The result of an instruction is a motion. The instructions are of four types. Motion, I/O, Program and System. The motion instruction is the one that makes the motor to move. I/O instruction is used in changing the parameters or the state of an input or output. The program instruction used to manipulate the program. The system can only be used in the immediate mode for performing a system operation like program execution etc. [31]

3.4.2 Variables

The variables are used by user to define or for manipulation of the data. The variables are of two types. One is factory and second are user defined variables. Read/Writable and Read only are two types of factory defined variables. The Read/Writable variables can be changed by user while the Read only variables can’t be altered by a user.  The user defined variables are restricted to two characters only. The first letter has to be capital and second might be alphanumeric. The variable can’t be named on the MCode instruction. Global and local variables are two types of user defined variables. Global variables are declared outside the main program and the benefit of doing that it doesn’t require any memory. The local variables are defined in the program and it is stored in the RAM and can only affect to the events which are inside the program. [31]

3.4.3 Flags

Flags indicate the status for an event or condition. 0 and 1 are the only two possible states for a flag. The flags are only factory defined and can’t be deleted. Like variables, flags have Read/ Writable and Read only flags. The Read/Writable flag is used to set a condition or mode of operation for a device. This flag type can be altered by user. While in Read, only flag can’t be altered by user. [31]

3.4.4 Keywords

“Keywords are used in conjunction with the PR and IP instructions to indicate or control variables and flags”. By using PR UV command will print all the user defined variables on the screen. From NVM, IP would restore all the factory variables. [31]

3.4.5 Math Functions

Different math functions are used in order to perform numerous arithmetic functions on the numerical data which is stored in the variables or registers. The math functions which are supported are following: +, -, *, /, <, >, AND, OR, NOT, XOR. [31]

3.4.6 Program Structuring

The program structuring of MCode is very important and helpful in many ways. It makes sure the work which will be carried out due to it is quite efficient and also helps in trouble shooting the program. 

Figure 3.20: The MCode recommended program structure


In this chapter, the approaches which were used to obtain the results in this project are discussed. Arduino Ethernet shield 2 was successfully connected to the internet and the communication was done wirelessly between the shield and mobile phone to show that the shield can receive instructions from anywhere using IP address provided by the shield used. Arduino Wi-Fi shield connected to the local network to make it capable of receiving the instructions through Wi-Fi, once the program uploaded on it. In the end the Arduino RS422 shield connected to the system to read the data which was send by using the original interfacing set up. The communication between the system and Arduino RS422 shield was working properly.


To have a wireless connection between the system and the computer, Arduino Ethernet shield 2 was used. First of all, the shield mounted on the Arduino UNO board. By running the software obtained from the Arduino website, IP address of the local network determined. The IP address is provided by the internet provider and every time the user connected to the network the new IP address is given by it. The IP address obtained in the start was “”. Once this was used in the code to connect the shield to the internet it didn’t work. The reason behind that the laptop was using Wi-Fi and the shield was directly connected to the internet through the Ethernet port and both of them were at different networks. Then laptop was connected to the same network through the wire. The IP address obtained second time was “”. After connecting the shield to the internet, DHCP chat server software was downloaded from Arduino website and in the required place the IP address of the shield and laptop added to it. The code was uploaded on the hardware. Then the putty program was download from the window. After making certain changes into the downloaded software, a new window was opened. Everything written into it was appearing in the serial monitor window. To make it more versatile and beneficial, Telnet name application was downloaded from the app store on mobile phone. The IP address given in the Arduino serial window wrote in the setting of that application. Every single word written in putty or serial window or Telnet can be seen in other two windows in the real time. This is very helpful tool for the system. The Arduino will just connect to the system with the internet connection and the print positioner will receive the commands from the mobile phone.


To connect the Arduino to the internet wirelessly the Arduino Wi-Fi was used. This shield was just mounted on to the Arduino Uno board and connected to the computer through the USB cable. To find out it’s properly working or no, the codes written in the library of Arduino software was used. One of them was to find the local connection available in that region. In the second one, the available network name and password was written in the code provided by Arduino and it was successfully connected to the local wireless connection. Arduino Wi-Fi shield need firmware update. They might be manufactured a long time ago due to which they need modifications to perform according to the modern-day requirements. For the firmware update the shield was separated from the Arduino Uno and connected to the computer through mini USB cable. The drivers for that cable was installed from the internet. Then from Atmel the Flip software was downloaded to do the programming on the device using the Device Firmware Update mode. Then from Arduino website the code for the particular which was integrated on the shield was obtained. Through command prompt window (cmd) C: Program Files\Atmel\Flip3.7\bin and then the code in front of it typed to reach to the files of the Arduino which were installed in some folder while installing the software package. After running all this procedure, the blue light on the shield was lighten up which indicated that the data was received. After doing this the shield was disconnected from the computer and then plugged in again. Same procedure repeated again to get to different file this time with different code. Once the procedure done the blue light turned on again to indicate the information was successfully received.


The Saleae logic analyser was used to see the communication between the computer and the system. To read the data, the wires from the logic analyser need to be connected into the system somewhere. The best place for it was the in-line converter where the digital signals changed into the ASCII to be compatible with the motor and shown in the figure 4.1. To find out which pins of the in-line converter correspond to the 5-pin M12 circular connector, the digital voltmeter was used. The setting changed to the connectivity. The black wire of the digital voltmeter was put on one of the 10 pins of the in-line converter and the red one on the 5-pin M12 circular connector. If the sound heard by doing so that was noticed and declared as pin 1-5 of that male connector depending upon where the beep was heard, if not then on the next pin of the converter and continued to do so until all the 5 pins of the male connector which correspond to the converter not found (Figure 4.3). The wire configuration of the 5-pin M12 circular is shown below in the figure 4.2. First of all the software for that was downloaded from the supplier of that device and then the logic analyser was connected to the in-line converter (Figure 4.4). The setup of the logic analyser shown in the figure 4.5. It saw from the graphs which were obtained from the logic analyser that even there was no communication going on in between the system and the computer, they were still constantly in touch with each other. That was later on saw through the serial monitor window of the Arduino which showed that the communication was similar to the one seen before. 

Figure 4.1: MD-CC401-001 communication converter [30] Figure 4.3: MD-CC401-001 communication converter Figure 4.3: MD-CC401-001 communication converter

Figure 4.2: P2 communications, 5-pin M12F circular connector [30] Figure 4.1: P2 communications, 5-pin M12F circular connector
Figure 4.3: The in-line converter corresponds through these pins to M12 connector pin functions
Figure 4.4: Arduino RS422 shield connected to the system

Figure 4.5: The system connected to the logic analyser to read RS422 protocol


The motor which is used in the print positioner system is only understand MCode for instructions that’s why the Arduino RS422 shield was used. To connect the Arduino to the motor, it required 5-pin M12 circular connector. In the project case one end need to be undetermined so it can be connected to the Arduino RS422 shield so that was ordered as well. To connect it to the Arduino RS422 shield, the undetermined end of it was used and it had 5 wires in it of five different colours. The pins functions were known which were present on the male connector side through the MDI file [30] configuration (Figure 4.2).To determine that which pin correspond to which colour was found by the digital voltmeter again. In the table below it is shown which colour corresponds to which pin and what function it performed in the interfacing. Table 1: Determining undetermined end wire colours corresponding to which pins of circular connector and functions

Wire Colour Pin on the male connector Function of the pin
White 1 TX-
Brown 2 TX+
Black 3 GND
Blue 4 RX+
Green + Yellow 5 RX-

Once this was determined, Arduino RS 422 shield was mounted on to the Arduino Uno board and the wires from the undetermined end connected to the Arduino RS422 shield. The black wire went to the ground pin on the shield while as for the input and output it’s marked as A and B for each of that function. So, for transmitting the data the wire TR+ went to the A and TR- to the B and same for the receiving the data, positive one in A and negative one in the B. It doesn’t matter which end is picked as receiving or transmitting end. The male connector end went to the motor and follow the pattern which is shown above in Figure 4.2.  Figure 4.5: Arduino RS422 shield connected to the print positioner system to communicate with it

Figure 4.6: The close look up of the wires coming from M12 male connector to the Arduino RS422 shield

First of all the system was run with the normal configuration. Once the code was saved in the system memory, the USB cable from the computer to the motor was removed and the male connector from the Arduino RS422 shield connected to the motor. The code which was written in the Arduino language was uploaded on the board and through the serial monitor the data was read which was changing according to the system functions. 

Figure 4.7: The data read before starting the system

Figure 4.8: The data read once the system turned off without performing any function

In the figure below it is shown that even the system was not doing nothing but in serial monitor it read the data in the same style as it was read in the logic analyser graph indicating a continuous communication with the system and the computer. 

Figure 4.9: The data read when the system was idle

Figure 4.10: The data read once the start button pressed to complete the instruction


In this chapter, the results are discussed in detail and the success that had in doing so and the shortcomings face while doing the project. First of all, the feasibility study which was carried on the opto isolation will be discussed. Industry 4.0 possible solution for the systems are then discussed. Finally, the full design of the new interface setup will be discussed and the limitations which were faced while implementing it.


In the start of the project, the task was to opto isolate all the external inputs. Different kind of devices were looked up regarding to solve this issue.  After having the meeting in November with the company it came to know that the solution for that problem was found. The ground wire from the circuit board of power supply box to the print positioner system was connected to that box. So, issues like short circuit was reduced quite significantly. The research which was carried on opto isolation was just then limited to the theory related to it. The opto isolation type photo resistive, photo diode, photo transistor and bi-directional were looked up. After discussing with supervisor of the project it was decided that by taking the specifications of the system into the consideration photo diode will be suitable for it. The chance of implementing that knowledge by testing a device not received so there was no numerical data obtained regarding to the solution of this problem.

5.2 INDUSTRY 4.0

For Industry 4.0 connectivity of the system, cyber physical systems (CPS), internet of things (IoT) and cloud computing (CC) were looked up. Each and every method has its own procedures to implement it. In all of them its require somewhere software and hardware interaction. CPS is basically a smart factory which required a lot of latest equipment to make the system decision on its own which is not necessary in this case. Due to the latest technology involved in it like sensors and software, this is quite expensive method of implementing Industry 4.0. In CC there are quite few challenges especially in respect to the assurance of the data safety. There are lot of factors which need to be considered while implementing it. The most favourable and adoptable way of adopting Industry 4.0 for the print positioner system is IoT. This only requires the software, sensor and the internet connection to adopt it. That everything is currently available in the system. Arduino as a microcontroller for hardware, also the software can be downloaded free and the internet connection to connect them together is not expensive either. The introduction of Industry 4.0 in the system gives a new dimension in every aspect of it from its functionality to sale capabilities. The product will be appealing more to the customers. With having more sale of the products gives an opportunity to the company to spend more on the product to make it better on constant basis to meet up with the rival products to stay in the business. The system don’t have a constant check and balance of how it is performing on daily basis. By introducing IoT will keep the records of its performance and that will help in understanding the product and to make it better. IoT will add safety to the system. The system are going be controlled by the Arduino so that can be coded this way that whenever an unexpected situation arisen it shows error message on the screen and send text on the mobile phone of the user.


The new interfacing set-up which shown in the figure 4.5. The system was successfully reading the communication which was computer and the system having with each other. The parameters which asked by the company to change through the microcontroller to perform it better was not able to control through it. The programming to do this is above the level of what been taught. The motor is only understanding MCode so writing the Arduino code which was basically a combination of both languages was a tough task. In the MCode language, the parameters are just changed by just calling it a function and giving it a value like setting velocity is V=2000 etc. In the case of Arduino it was not that simple. In the start the M12 male connector connected to the motor and the other end to the shield. The serial monitor window in the Arduino software shoed that it didn’t read anything and in addition to that the system was confused. It tried to move forward and stopped and then went backward and kept doing the same thing until the system not turned off. The M12 male connector configuration in the MDI file provided by the company has two different kind of configurations for it. That created huge amount of the confusion and wasted a lot of time. The configuration which was used in the start to start up the communication through the shield to the motor is shown in the figure 5.1. 

Figure 5.1: The configuration of M12 male connector used in the start [30]

To prevent any damage to the system and for the personal safety the other configuration was not used. The company was contacted in bid to know the right configuration for it and also explained to them that in which system will it going to be used and what were we trying to achieve from it. They gave totally new configuration which was not given anywhere in the whole MDI file (Figure 5.2). That one tried on the system but that didn’t work either. Also provided a link of their website which not helped at all.  Figure 5.2: The configuration of the M12 male connector given by the supplier of the motor An extensive amount of research carried out to find out the right configuration of the M12 male connector to find which pins of it correspond to which wire so it can be properly connected to the shield. Without knowing the right configuration of it there was no progress going to be made. Finally, the right configuration for controlling the motor found (Figure5.3). 

Figure 5.3: The right configuration of the M12 male connector to control the motor [30]

The components which were ordered for this project was some of them received from other countries in which USA and China. That taken a lot of time to get hands on them. The Arduino R2422 shield was ordered in the first week of December and not received until the second week of January. The MDrive 23 motor was ordered in the last week of January and received in the middle of the March. The programming of the project couldn’t get started until that not received to prevent any damage to the system by testing the codes which not sure how going to respond by uploading on the Arduino.


The first objective of the current project to opto isolate the external input of the system. But later, the demand of the company was not to do much work on the opto isolation because they just wanted to do a feasibility study on this topic. That was successfully achieved as well. The research carried out on the opto isolation and all the types of it covered in that. The suitable opto isolation types chosen which can be implemented in future if required. The second objective of the project was to find the possible solution for the Industry 4.0 connectivity for the system that was completed successfully. All the background information related to Industry 4.0 was analysed and the techniques adopted in the implementation of it. For the system, Internet of Things (IoT) are going to be perfect for Industry 4.0. To adopt the IoT is the most cost effective and easiest way of implementing Industry 4.0 in the system. The third objective was to introduce a microcontroller into the system to make it capable of performing more functions like controlling it through webpage etc. Arduino and Raspberry Pi was considered to integrate into the system but Arduino preferred over the Raspberry due to it quick interaction with the hardware. The Arduino was connected with the system directly through RS422 shield mounted on it replacing the original interface. The system was reading the data that system and computer share with each other while it is performing a function or while waiting for an instruction. The Arduino Wi-Fi shield and Ethernet shield functionality was understood and the communication was done with them without having any physical connection between a computer and shields but unfortunately the programming to change the parameter of the system was not completely working due to which they were not introduced into the new interfacing set up to control it wirelessly.


The programming for the project was not finished. With having more time that can be finished. The programming for the system can be written in Arduino language to change the parameters of the system. Once the program to change the parameters of the system is done with the help of Ethernet shield the system can be controlled from anywhere in the world. Once the programme uploaded onto that shield that can be disconnected from the computer and connected to the system. The commands can be sent to it directly by just knowing its IP address. The same concept can be used for the Arduino Wi-Fi shield which only require access to the local network and can be monitored wirelessly too. Arduino board currently sitting next to the system which can be dangerous in the future to the system or the person who is operating due to the short circuit or may be stuck into the print head while it’s functioning. So, a small section can be added into the system where it can be placed and don’t interact with other things while the system is working. A screen can be added with the Arduino to show the status of it like displaying the Wi-Fi or Internet connection to which it is connected. The system can be capable of changing the parameters from that screen by adding an option to let the user to select the parameter and changed it according to the desired value. The Arduino can be programmed in this way that the error in any part of the system can be shown on the computer and Arduino screen which will be connected to it and gives the instruction to get rid from it in the same time. The button which is used to run the system in the start to make sure everything is fine can be controlled through a remote rather than having a push button. Safer and can be accessed from far off depending upon the quality of the connection between the remote and its hardware inside the supply box. Or completely taken off that from the system by simply programming this way that before starting to receive instructions from the user it do a test run if everything is fine then display on the screen that system is ready to go otherwise gives the error and details of it.





8.2.1 Program for DHCP-based IP printer


8.2.2 Program for DHCP Chat Server



8.3.1 Program for Wi-Fi Shield to Scan For Networks


8.3.1 Program for Wi-Fi Shield to Connect to WPA Network



[1] M. L. P. G. M. W. J. J. P. Michael Rüßmann, “Industry 4.0: The Future of Productivity and Growth in Manufacturing Industries,” 2015.
[2] X. L. L. W. a. V. V.-F. L. Wang, “A review of industrial wireless networks in the context of Industry 4.0,” pp. 1-19, 2015.
[3] H. C. Hoppe, “Second-mover advantages in the strategic adoption of new technology under uncertainty,” vol. 18, no. 2, pp. 315-338, February 2000.
[4] T. V. L. H.-R. C. K. Sverre Roed-Larsena, “Accident investigation practices in Europe—main responses from a recent study of accidents in industry and transport,” Journal of Hazardous Materials, vol. 111, no. 1-3, pp. 7-12, 26 July 2004.
[5] E. B. Paraskevi and G. I. Maria, “Electric Accidents in the Production, Transmission,and Distribution of Electric Energy: A Review of the Literature,” pp. 285-307, 2001.
[7] R. Marston. [Online]. Available: [Accessed 20 October 2016].
[8] I. Poole. [Online]. Available: [Accessed 17 April 2017].
[9] “Optocouplers & Optoisolators applicatipons,” [Online]. Available: [Accessed 17 April 2017].
[10] “Optocoupler Tutorial,” [Online]. Available: [Accessed 17 April 2017].
[11] J. Imtiaz and J. Jasperneite, “Scalability of OPC-UA down to the chip level enables “Internet of Things”,” pp. 500-505, 2013.
[12] 1. J. Posada, C. Toro, I. Barandiaran, D. Oyarzun, D. Stricker, R. d. Amicis, E. B. Pinto, P. Eisert, J. Döllner and I. Vallarino, “Visual Computing as a Key Enabling Technology for Industrie 4.0 and Industrial Internet,” 2015.
[13] J. W. D. Z. D. L. C. Z. Shiyong Wang, “Towards smart factory for industry 4.0: a self-organized multi-agent system with big data based feedback and coordination,” Computer Networks, pp. 158-168, 2016.
[14] H.-A. K. Y. Jay Lee, “Service Innovation and Smart Analytics for Industry 4.0 and Big Data Environment,” Procedia CIRP, pp. 3-8, 2014.
[15] H. G. Radhakisan Baheti, “Cyber-physical Systems”.
[16] B. B. H.-A. K. Jay Lee, “A Cyber-Physical Systems architecture for Industry 4.0-based manufacturing systems,” Manufacturing Letters, vol. 3, pp. 18-23, January 2015.
[17] F. Wortmann and •. K. Flu¨chter, “Internet of Things Technology and Value Added,” 2015.
[18] U. R. István Mezgár, “The challenge of networked enterprises for cloud computing interoperability,” Computers in Industry, pp. 657-674, 2014.
[19] P. Mell and T. Grance, “The NIST Definition of Cloud Computing,” National Institute of Standards and Technology, Information Technology Laboratory, 2009.
[20] I. National, “RS-232, RS-422, RS-485 Serial Communication General Concepts,” 29 June 2016. [Online]. Available: [Accessed 15 April 2017].
[21] “RS422 serial information,” [Online]. Available: [Accessed 25 November 2016].
[22] “RS485 serial information,” [Online]. Available: [Accessed 25 November 2016].
[23] Jayant, “Arduino vs Raspberry Pi: Differences between the two,” [Online]. Available: [Accessed 13 April 2017].
[24] B. Bourqe, “Arduino vs. Raspberry Pi: Mortal enemies, or best friends?,” 8 March 2015. [Online]. Available: [Accessed 13 April 2017].
[25] “Arduino UNO,” [Online]. Available: [Accessed 1 December 2016].
[26] “RS485 RS422 Shield for Arduino,” [Online]. Available: [Accessed 3 December 2016].
[27] “Arduino Ethernet Shield 2,” [Online]. Available: [Accessed 5 December 2016].
[28] “Arduino WiFi Shield,” [Online]. Available: [Accessed 10 December 2016].
[29] J. Tulley, “P1100 Print Positioner Operation and Maintainence Manual,” Claromech, Perth.
[30] “MDrive Motion Control MDrivePlus and Linear Actuator Products.,” IMS INTELLIGENT MOTION SYSTEM, INC..
[31] “MCode Programming and Software Reference MDrivePlus, MForce and AccuStep Motion Control Products,” IMS INTELLIGENT MOTION SYSTEMS, INC., 2006.



The costs of the components which were bought for this project are shown in the Table below. Table 2: Project Costs Incurred

Arduino Uno R3 x3 £54.5 (£18.16 each)
Arduino Wi-Fi Shield x2 £139.8 (£69.9 each)
Arduino Ethernet Shield £18.82
Resistor 330 ohm £3.94
Jumper Wire £3.78
Linear Technology LTC485CN8#PBF, Line Transceiver, RS-422, RS-485, 5 V, 8-Pin PDIP   £2.02
RS485 Shield V2 £15.3
SparkFun RJ45 Magjack Breakout £5.4
Breakout Board for RJ45 £1.2
RJ45 8-Pin Connector £0.7
WIZnet WIZ108SR RS422/485-to-Ethernet Module £33.48
Arduino RS422 shield £16.4 ($ 19.85)
Saleae Logic 8 £238 ($ 283)
MDrive 23 £700

Leave a Reply