FACULTY OF MANAGERIAL AND TECHNOLOGICAL ENGINEERING DOMAIN: MECHATRONICS AND ROBOTICS MASTER OF SCIENCE PROGRAMME: ADVANCED MECHATRONICS SYSTEMS FORM… [305369]

UNIVERSITY OF ORADEA

FACULTY OF MANAGERIAL AND TECHNOLOGICAL

ENGINEERING

DOMAIN: MECHATRONICS AND ROBOTICS

MASTER OF SCIENCE PROGRAMME: ADVANCED

MECHATRONICS SYSTEMS

FORM OF EDUCATION: Full time learning

DISSERTATION THESIS

SCIENTIFIC COORDINATOR

PROF. PHD. ENG. ȚARCĂ RADU CĂTĂLIN

GRADUATE

ENG. BIROUAȘ IONUȚ FLAVIU

ORADEA

2016

UNIVERSITY OF ORADEA

FACULTY OF MANAGERIAL AND TECHNOLOGICAL

ENGINEERING

DOMAIN: MECHATRONICS AND ROBOTICS

MASTER OF SCIENCE PROGRAMME: ADVANCED

MECHATRONICS SYSTEMS

FORM OF EDUCATION: Full time learning

Human mobility and strength augmentation using Robotic Exoskeleton

SCIENTIFIC COORDINATOR

PROF. PHD. ȚARCĂ RADU CĂTĂLIN

GRADUATE

ENG. BIROUAȘ IONUȚ FLAVIU

ORADEA

2016

Nr…………../……………

DECLARATION OF AUTHENTICITY

FOR

THE DISSERTATION THESIS

Title of the dissertation thesis ________________________________________________________________________________________________________________________________________________________________________________________________

Author

________________________________________________________________

[anonimizat], _______________session academic year__________

Hereby, the undersigned (name, CNP) _______________________________________________________________________________________________________________________________ ,

[anonimizat].

I [anonimizat], graphs, maps or

other sources used without complying with Romanian law and international

conventions on copyright.

Oradea, Signature

Date_______________ ______________

UNIVERSITY OF ORADEA

FACULTY OF MANAGERIAL AND TECHNOLOGICAL ENGINEERING

DEPARTMENT OF MECHATRONICS

THEME___________________________________

Graduation thesis of the student _______________________________

1). The theme of the graduation thesis: ___________________________________________________________________________________________________________________________________________________________________________________________

2). The deadline for paper submission: ______________________________________________________

3).Initial elements for the elaboration of the thesis: ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

4). Content of the thesis : ________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

5). Graphic materials: ________________________________________________________________________________________________________________________________

6). Place documentation for preparation of the thesis:_____________________

7). Date of theme issuing ____________________________________________

Head of department Scientific coordinator

Prof.dr.ing Țarcă Radu Cătălin Prof.dr.ing Țarcă Radu Cătălin

Student

____________________

Abstract

Our modern day technology has brought us considerable economical and social growth, making our lives easier and increasing life expectancy year by year, but for a majority of people, quality of life is still severely affected by some form of disability.

In this paper research and development will be presented regarding rehabilitation of the hand grasping motor function for people who have suffered from stroke or cerebrovascular accident.

The current rehabilitation techniques involve manual exercise of the afflicted limb by specialized medical personnel. Most of the time this traditional way of rehabilitation presents inconvenience such as daily visits to the hospital or clinic and the lack of familiar environment such as a patience own home to aid in recreating the neuronal connections used for motor functions.

In this paper a robotic exoskeleton was developed for aiding rehabilitation for patience that have lost their ability to move their own hand. The device can be used in clinics or hospitals without the need of constant personnel assistance or even used from the conform of their own home. Similar projects were studied in the first part of the paper to determine the current state of the art.

The mechanical system was conceived around a series of anthropometric measurements and with the aid of 3D CAD modeling software, an orthetic exoskeleton was designed. The actuation system and electrical system was designed to facilitate the movements of the patience hand and simulate grasping and manipulating tasks essential for neuronal remapping of the motor functions.

In the end of this paper a functional prototype was fabricated using FFF manufacturing method. Electronic circuitry was designed and customized specifically for this device in order to have the necessary processing power for data acquisition and control of the robotic hand.

Table of Contents

1. Introduction 3

2. State of the art 5

2.1 Current force transmission mechanisms 5

2.1.1 Direct matching of the joint centers 6

2.1.2 Serial linkage attached to distal segment 7

2.1.3 Redundant linkage structure 9

2.1.4 Tendon driven mechanism 10

2.1.5 Bending actuator attached to the joint 11

2.1.6 Linkage for remote center of rotation 13

2.2 Current existing powered exoskeleton projects 14

3. Studding the mechanical parameters of the biological hand. 17

3.1 Biological hand joints and bones 17

3.2 Anthropometric studies and data collecting 18

3.2.1 Angular limitations 18

3.2.2 Dimensional characteristics 23

4. Reverse engineering and designing a robotic hand exoskeleton 27

4.1 Design requirements and specifications 27

4.2 Actuator type and movement transmission 28

4.3 Electrical system 31

4.3.1 Microcontroller board design 32

4.3.2 H-Bridge design 37

4.3.3 Battery and Power distribution 40

4.3.4 Component interconnection 41

4.4 Mechanical movement and force transmission 45

4.5 Mechanical attachment to the biological hand 47

4.6 Interchangeability of the phalanx for adapting to different hand sizes 49

4.7 Manufacturing 51

Conclusion 54

REFERENCES 55

1. Introduction

Taking a brief look at the history of human technological innovation we will see that science and technology has provided us with major advancements in the industrial and economical sectors of activity. Robotics has constructed a world where hard labor, repetitive, and difficult tasks are replaced by high tech autonomous machinery, ending some job areas and opening others, enabling us to focus on intellectual activities such as design, programming, and engineering.

The focus of this paper is challenging innovation of one of the most basic human needs trough robotics and bionics, namely the physiological rehabilitation and enhancement of the human body.

It's not well appreciated but a significant part of the world's population suffers from some form of disability, be it cognitive, emotional, sensory of motor condition, and because of poor technology and conditions the result in disability and a reduced quality of life.

Bionics comes as a discipline that looks into natures design in order to create new ways to integrate biology and robotics for augmenting our own physical body. In the past decades we've seen how electro mechanics attached to the body and implanted inside the body are beginning to bridge the gap between disability and ability, between human limitation and human potential.

The powerful impact of disability has on our everyday lives is a call for advance in technology to eliminate disability. If we look at the hierarchy of needs first described by Abraham Maslow in 1943, physiological needs are at the most importance situated at the base of our society. Basic levels of physiological function should be a part of our human rights, every person should have the right to life without disability if they so well chose.

As a society we can achieve these human rights if we accept the proposition that humans are not disabled, our built environment, our technologies are limited and disabled, we the people need not accept our limitations but can transcend disability.

In the purpose of bridging the gap between human disability and bionic augmentation, this paper will present the research and development of a robot hand exoskeleton. A close relation between natures design of the human hand, the mechanical joints and actuation of the exoskeleton was at most importance during the design of the exoskeleton. Factors such as bone structure, joint and ligaments, muscle actuation and degrees of freedom were researched in order to mimic the natural movement of the biological hand, in essence reverse engineering and designing an exoskeleton.

The exoskeleton main purpose and area of application is rehabilitation for people that suffered from stroke or physical accidents that were left with motor impairment. Although the potential of the developed exoskeleton is not limited to rehabilitation, in this paper the main focus will remain rehabilitation.

Loss of dexterity and strength is a loss of motor function and is a side effect that 80% of stroke survivors have to endure. The cause of motor function loss is a result of brain injury suffered during the stroke but the muscular and nervous system are still intact.

For regaining control of the motor functions repetitive motion exercise helps to create new motor connections in the brain, in essence rewiring the brain and creating new neuronal synapses much like a new born child learning to walk.

Repetitive controlled movements such as occupational therapy of the paretic hand can aid in rehabilitation and gain back strength and dexterity. Tasks from the therapy that involve opening and closing the hand such as games, eating, dressing, picking up objects and manipulating them help build up strength, dexterity and regain coordination. These tasks are established by the occupational therapist depending on the patients level of functionality.

This kind of therapy usually takes place in hospitals or clinics and requires a trained specialist to effectively move the patients hand manually and performing the exercises one at a time.

Replacing the need to travel to the hospital for each session and the need for a trained specialist is a major step in hand mobility and dexterity rehabilitation. Its not only convenient but by doing the exercises at home it can boost the rehabilitation because it provides a sense of independence and psychological familiarity.

2. State of the art

In our quest of human augmentation we should not forget the first mile stones that paved the way to our current state of the art technology, one of the pioneers of human robotic exoskeletons was Ralph Mosher with the Hardiman 1965 project at General Electric is seen in figure 2.1. Although Hardiman did not have much success due to its bulkiness, being unstable and generally unsafe, it remains in the books of history as one of the most earliest attempts at powered exoskeletons that inspired countless projects in the decades to come.

Fig. 2.1 G.E. Hardiman I Exoskeleton – Ralph Mosher

A brief review of the current state of the art serves as a good starting point. Its important to take into consideration the challenges and limitations encountered of other similar project in the purpose of learning and improving were others designs were limited.

Designs and implementation of hand rehabilitation exoskeletons differ from one another, there are multiple criteria that differentiate

2.1 Current force transmission mechanisms

The method with which the force is transmitted to the joints varies from one design to the other, some go with one type of force transmission mechanism, some implement a mixture of one or more of these methods. The most common structure designs used are:

– direct matching of the joint centers (DMJC)

– linkage for remote center of rotation (LRCR)

– redundant linkage structure (RLS)

– tendon driven mechanism (TDM)

– bending actuator attached to the joint (BAAJ)

– serial linkage attached to distal segment (SLADS)

Each method haves some advantages and disadvantages, some provide more control over the movement of the fingers others provide compliance and flexibility to different hand shapes. Size of the force transmitting mechanism is also important, bulky and heavy is a factor that needs to be avoided while designing a hand exoskeleton.

2.1.1 Direct matching of the joint centers

One of the most straight forward methods, at first sight it may seem the most logical approach, while it may be appear simple, it proves to be one of the most complex structures.

Taking into consideration that this structure must match the exoskeletons joints center with the wearers biological hand joints, precise measurements must be done on the wearers hand so that the mechanism functions properly. A specific structure type example can be see in figure 2.2.

Fig. 2.2 Direct matching of the joint centers

The segments that comprise the exoskeleton phalanges can be in three ways: fixed, adjustable and with interchangeable modules. Adjustable exoskeleton phalanges increase the level of complexity of engineering the parts. Fixed phalanges are designed to accommodate a majority of hands, averaging the typical hand dimensions taken from a limited sample of people. Interchangeable modules can be used to make easy and fast exoskeletons that fit almost any hand, this implies that a number of prefabricated modules with different standard dimensions are available in some form of kit.

One project example of direct matching of joint centers structure was developed at is HandEXOS that can be seen in figure 2.3

Fig. 2.3 Direct matching of the joint centers example: HandEXOS

2.1.2 Serial linkage attached to distal segment

This type of exoskeleton is probably one of the most economical to manufacture due to its reduced number of parts and less measurements needed. This type of structure can be adapted to a large verity of hand sizes and does not need a large number of actuators. A structural example can be seen in figure 2.3.

Fig. 2.3 serial linkage attached to distal segment structure

Disadvantages for this structure is that by using the biological joints of the human hand as part of the linkage mechanism it can be potentially be harmful when certain forces are applied. Also control over the position of each phalanx cannot be achieved or determined via the controlling software.

One practical example of this type of structure was developed in the HEXOSYS project seen in figure 2.4.

Fig. 2.4 serial linkage attached to distal segment example – HEXOSYS

2.1.3 Redundant linkage structure

A more advanced type of force transmission than the serial linkage attached to distal segment type, this implementation offers control over each phalanx. Precise position can be determined much like in the direct matching of the joint centers, encoders and transducers ca be mounted to measure in real time the fingers position. The force transmission structure is presented in figure 2.5.

Fig. 2.5 Redundant linkage structure

It is more expensive to manufacture than the previous presented structure and implies significant more advanced engineering challenges.

The biological joint of the finger are used directly in the mechanism similar to SLADS example, this in turn can present a disadvantage when surpassing a certain load force. The structure is very suitable for recuperation but in more heavy duty applications can not be used due to its high strain on the biological joints.

A practical example implementing this type of structure developed by Wege A, and Hommel G. can be seen in figure 2.6.

Fig. 2.6 Redundant linkage structure example – Wege A, and Hommel G.

2.1.4 Tendon driven mechanism

This category of exoskeleton is commonly implemented using soft and flexible materials such as fabric and polymers. It is a very good solution for making low cost rehabilitation devices. In some cases there can be high costs when fabricating molds for plastic injection but the costs are not significant if a given number of units are made using the same mold. The concept of this type of force transmission can be seen in figure 2.7.

Fig. 2.7 Tendon driven mechanism

On the engineering part the difficulty is moderate in developing this type of structure, focus is mainly on material research regarding properties, resilience, compliance and the ability to be molded in complex shapes. Being a flexible glove made out of soft material, it can fit a large variety of hand sizes.

The concept of transmitting the force to the finger is very similar to the biological tendons in the human hand but instead of biological tendons, wires are actuated and guided in strategically placed canals

Applications are mainly limited to rehabilitation, light handling and recuperation purposes only.

One practical example of this implementation is the Exo – Glove developed by Hyunki In, Brian Byunghyun Kang, Minki Sin, and Kyu-Jin Cho seen in figure 2.8.

Fig. 2.8 Tendon driven mechanism example – Exo Glove

2.1.5 Bending actuator attached to the joint

This type of force transmission similarly to the tendon driven mechanism uses soft materials, the main difference is that instead of wires it uses air as it actuation method. Soft malleable cylinders with air compartments made from polymers are used to actuate the fingers. The structural type is presented in figure 2.9.

Fig. 2.9 Bending actuator attached to the joint

As per any pneumatic driven system, positioning is a big problem taking into account the compressibility property of air. On the other hand this type of actuation has good compliance and can adapt easily to a multitude of hand sizes.

From an engineering point of view it requires more elaborate work for developing than the tendon driven mechanism and also more costly to manufacture. For the same reason as the previews type of force transmission mechanism, this type is also used mainly in rehabilitation applications.

One practical example of this type of structure was developed by Hong Kai. Yap, Jeong Hoon. Lim, Fatima. Nasrallah, James C. H. Goh, and Raye C. H. Yeow in the paper “A Soft Exoskeleton for Hand Assistive and Rehabilitation Application using Pneumatic Actuators with Variable Stiffness”.

Fig. 2.10 Bending actuator attached to the joint practical example

2.1.6 Linkage for remote center of rotation

A more complex approach than most solutions, transmitting the motion to the fingers by using linkages to obtain a remote center of rotation. This may seem a bulky mechanism at first but it one of the best solutions when it comes to precision and force transmission. It haves similar characteristics to the DMJC mechanism. The engineering for this type of mechanism involves moderate to advanced knowledge of kinematics, the level of complexity is similar to the DMJC solution in some sense. A structural concept of the mechanism is seen in figure 2.11.

Fig. 2.11 Linkage for remote center of rotation

Applications range from rehabilitation, assertive to heavy duty manipulation. Manufacturing can prove to be more costly than other solutions but this disadvantage can be negligible taking into account the advantages. One practical implementation example are seen in figure 2.12.

Fig. 2.12 Linkage for remote center of rotation example 1 – Shields, B. L., Main, J. A., Peterson, S. W. and Strauss, A. M

So far the mechanisms presented only the LRCR and DMJC prove to be suitable not only for rehabilitation but for other more heavy duty applications such as material handling, tool manipulation and work conditions where the human hand does not offer sufficient torque.

Other designs implement a combinations of the solutions discussed in this paper, one notable hybrid design that also can be included in the heavy duty application area is the FESTO developed exoskeleton. The FESTO exoskeleton can be seen in figure 2.13.

Fig. 2.13 Pneumatic exoskeleton developed by FESTO

This hybrid design haves elements of redundant linkage structure and also direct matching of the joint centers.

2.2 Current existing powered exoskeleton projects

A short review of electrical actuate exoskeleton rehabilitation equipment is presented in table 2.1. The criteria we are interested mainly while researching the current state of the art are:

– Force transmission.

– Active degrees of freedom (DOF)

– Intention sensing method

Table 2.1 Rehabilitation exoskeletons driven by electrical actuators

Similarly to rehabilitation exoskeletons, assimilative exoskeletons provide almost the same functionality and confront the same engineering challenges. A short review of assertive exoskeletons driven by electrical actuators are presented in table 2.2.

Table 2.2. Assistive exoskeletons driven by electric actuators

Another very important factor in designing rehabilitation exoskeletons is the way it attaches mechanically to the body. In the area of design we still do not know how to properly attach devices to the body mechanically. A good modern era example are shoes, regardless of the advancements in technology, modern footwear can still give us blisters and be uncomfortable.

Since every hand differs slightly from person to person, the task of standardizing a exo skeleton has proven to be a great challenge. This aspect will be one of the main criteria during the development of this paper. The key to adapting a mechanical solution is reverse engineering the biological hand.

3. Studding the mechanical parameters of the biological hand.

Movement of the biological hand in its natural form, is fluid and does not cause discomfort, achieving this simple task done by nature using an exoskeleton proves to be very challenging.

Observing the biological hand and using natures design to model an exoskeleton was done in the development of this project. The key elements that were studied include:

– Joint, bone and movements

– Tendons and ligaments

– Anthropometrics

– Dimensional statistics

3.1 Biological hand joints and bones

The bone structure and joint movement must match with the structure of the exoskeleton. Factors such as maximum angle are critical when designing a robotic exoskeleton.

Starting from the root of the wrist, eight bone comprise the carpus, continued by the bones that comprise the digits, namely the metacarpals and phalange segments. The naming of each digit is as follows starting from the radial to the ulnar side: thumb, index finger, middle finger, ring finger, and little finger, illustrated also in figure 3.1.

Each individual finger is composed of one metacarpal and three phalanges, exception being the thumb which has two phalanges segments.

The joint linking the metacarpal bone to the proximal phalanx is known as the metacarpophalangeal (MCP) joint. The MCP joints have two degrees of freedom, being classified as ellipsoidal or condylar joints. This means that MCP joints permit flexion, extension, abduction, and adduction movements. The proximal interphalangeal (PIP) and distal interphalangeal (DIP) joints are found between the phalanges of the fingers; the thumb has only one interphalangeal (IP) joint. They are both bicondylar joints and have one degree of freedom.

Fig. 3.1. Human hand bone and joint structure

Measuring the diameter of the DIP and IP joints we observe that the transverse diameters of the IP joints are greater than the axial diameters.

The different shapes of the finger joints result in varying DOF at each joint. Knowing the basics of the human biological hand we can extract the information we need to design a robotic exoskeleton.

3.2 Anthropometric studies and data collecting

3.2.1 Angular limitations

Measuring and determining the dimensions of a human hand is important for establishing specifications for the robotic exoskeleton. In the purpose of determining these specifications, in this sub chapter we will analyze and log date such as: phalanx dimensions, joint maximum angles, offsets between fingers, and also any critical dimension that would be useful later on during the mechanical design stage of the project.

Fig. 3.2. Hand extension

Each joint is capable of moving a finite and limited angle, in the following study we will consider the starting extension position of the finger as being equal to 0 degrees. A example of an extended hand is seen in figure 3.2. In this example all phalanges have an approximately 0 degree angle relative to one another. There are several combination of flexion when it comes to the human hand, this varies depending on the dimensions of each persons hand and also the task performed. In the following example seen in figure 3.3 we have a full flexion of the hand, also refereed to as a closed fist.

Fig. 3.3 Full hand flexion

In the case of the full hand flexion we consider the joints have reached almost their maximum bending angle. All phalanges including the metacarpals have a maximum relative angle to one another.

Depending on the task the hand is doing, the angles between the phalanx and metacarpals are not always all in a flexion or extension state. One such variant can be seen in figure 3.4.

Fig. 3.4 Flexion of the MCP and PIP joints and extension of the DIP joint.

Combinations like these make up most of the tasks of daily human activity, interacting with our environment, picking up object and tools would not be possible without having some degree of control over the MCP, PIP and DIP joints. This finger position can vary, sometimes having flexion on the DIP join as well to achieve the same task of manipulation.

As mentioned earlier we consider the extension position of the finger as being 0, depending from person to person, some joint have the ability be moved under the 0 degree limit, some actually reaching as much as -45. One such example can be seen in figure 3..

Although this kind of movement can not be achieved actively by one stand alone finger, this flexibility is done with the aid of the other finger. Such finger positions are not presents or used by every individual but some cases of painters, writers and musicians have been observed using this type of finger position during the research of this paper. Implementation of this kind of movement in the design of the exoskeleton will not be done because of safety reasons and the degree of complexity but it well worth noting its existence for research purposes only.

Fig. 3.5 Flexion under the 0 degree limit

Another type of movement where the DIP and PIP joints are in the extension state and the MCP joint is I a flex state is seen in figure 3.6. Not used as much as the case where flexing the MCP and PIP joints and extension of the DIP joint or flexing all joints, it is still used in some task specific cases.

Fig. 3.6 Flexion of the MCP and extension of the PIP and DIP joints.

Using the data collected regarding the DIP, PIP and MCP joint angle play table 3.1 was generated:

Table 3.1 Angular limitations

he MCP joints can be flexed 90° and even beyond depending on the case, similar the PIP can be flexed at least 90°, usually more, and the DIP joints are flexed to a maximum of 90° but do not exceed this limit unlike the other joints. Flexibility is at the highest at the little finder and decreases from each finger going to the index. It is observed that extension beyond the zero position depends largely on the ligamentous laxity.

3.2.2 Dimensional characteristics

Besides flexibility which influences the angular limitations, dimensions of the hand differ depending on age, physique, and gender. For research purposes, the anthropometric parameters shown in figure 3.7 were considered.

Fig. 3.7 Hand measurement points

Measurements carried out using the anthropometric sketch presented above have resulted the following sets of date shown in table 3.2.

Table 3.2 – Anthropometric measurements

Measurements carried out on the fingers determined that the thickness of the fingers cannot be logged as a simple cylindrical diameter. The shape of the human finger have variable thickness, the dimensions measured from the sides of the joints or axial to the joint usually are greater than the dimensions when measuring from the top to dorsal part of the joint, the difference can be seen in figure 3.8. D1 respectively D2 are greater than d1 and d2.

Fig. 3.8 Joint measurement points

Extracted from the previews measurements we have the length dimensions for the phalanges shown in table 3.3.

Table 3.3. Joint axial and perpendicular dimensions

Extracted from the anthropometric measurements the length of the fingers can be seen in table 3.4

Table 3.4 – Phalanges length dimensions

4. Reverse engineering and designing a robotic hand exoskeleton

The technological and engineering challenge of developing a robotic exoskeleton for the human hand has been paved with numerous attempts. Every design comes with some form of innovation but as well with its own drawbacks.

In the development of this project the following criteria were taken into consideration:

– Design requirements and specifications

– Electrical system

– Actuator type and movement transmission

– Mechanical attachment to the biological hand

– Mechanical movement and force transmission

– Interchangeability of the phalanx for adapting to different hand sizes

– Manufacturing

4.1 Design requirements and specifications

The development of the robotic exoskeleton in this paper will consider the following specifications as requirements:

– The structure will be a hybrid design using direct matching of the joint centers for the DIP and PIP joints and linkage for remote center of rotation for the MCP joints.

– Actuated fingers will include: index finger, middle finger, ring finger and little finger

– Assisted movement to the finger will be independent of each other

– One actuation motor per each finger will be used.

– Finger position will be determined using information from the motors feedback encoders

– Transmission of movement from the motor to the finger will be done using bowden cables

– Motors will be mounted on an interfacing part that will attach to the forearm section of the arm.

– Phalanx segments will be interchangeable to adapt to different hand sizes and shapes.

– Control electronics will be mounted on the interfacing part that attaches to the forearm section of the hand.

– Angular freedom of each joint will follow the values described in table 4.1

Table 4.1 – Exoskeleton maximum angular freedom per joint

4.2 Actuator type and movement transmission

The actuator type used in this project were electric motors with gear box and encoder. The specifications of the motor are shown in table 4.2.

Table 4.2 Motor specifications

The motor used for actuation and its components are illustrated in figure 4.1 – Motor Components.

Fig. 4.1 Motor components

Components of the motor are described in table 4.3 – Motor Components.

Table 4.3 – Motor components

The signals from the connector are described in table 4.4 Motor Signals.

Table 4.4 – Motor Signals

The encoder used has two-channel Hall effect that senses the rotation of a magnetic disk mounted directly on the rear motor shaft. The quadrature encoder outputs a resolution of 48 counts per revolution of the motor shaft when counting both edges of both channels. To compute the counts per revolution of the gearbox output, divide the counted pulses by the gear ratio.

The Hall sensor from the encoder functions with an input voltage (Vcc) between 3.5 and 20 V and has a maximum draw of 10 mA. The A and B outputs signals are square waves from 0 V to Vcc with roughly 90° phase offset. The frequency of the A and B signals is used to determine the rotation speed, and the order of the channels rising edges is used to determine the direction of rotation. The following oscilloscope figure 4.2 shows channel A and B encoder outputs.

Fig. 4.2 channel A and B encoder outputs

4.3 Electrical system

To control the motors of the exoskeleton a few electronic components were designed.

A mechatronic system in theory includes one third electronics, so in this sub chapter I will be describing the design and implementation of the electronic boards that control the robotic exoskeleton.

The brain that governs small devices and robots is usually a microcontroller. A microcontroller resembles in some way a Personal Computer in the sense that it haves a processor, RAM and internal memory but it also haves hardware specific peripherals such as Pulse With Modulation generators, Analogue to Digital and Digital to Analogue converters that normally a PC does not have by default. Another key difference is the user interface and operating system, on a PC we have an operating system that runs the machine resources management and provides the user with a easy to use interface, on a microcontroller we do not have an operating system or user interface, instead we run pre-compiled code written in a specialized programming language such as modified versions of C and assembler.

Another electrical component essential to this project is the motor driver, also known as a H-Bridge, this component is controlled by the microcontroller and provides the power control of the motors. All electronic boards were designed using CADSoft Eagle PCB and Schematic Designer.

4.3.1 Microcontroller board design

The microcontroller board was designed from scratch using a high speed Microchip DSPIC microcontroller. The current boards available on the market have various advantages and disadvantages, criteria such as size and processing power were important for this project.

Before deciding on designing a dedicated board a few Arduino Boards were taken into consideration as potential candidates for controlling the exoskeleton.

After researching the capabilities of the boards on the market the conclusion is that Arduino boards that have a small form factor such as Arduino Nano do not have sufficient processing power, estimated of being capable of doing around 8 million instructions per second. Another more powerful Arduino Duo do have more processing power but have a large form factor.

As a result for this project a small form factor board was designed, having a maximum PCB size of 5 by 5 centimeters and running at 50 million instructions per second. The microcontroller board was based on is DSPIC33FJ16GS504 produced by Microchip. For communicating easily with the PC an onboard USB to serial converter was integrated using the integrated circuit produced by FTDI.

The design of the PCB can be seen in figure 4.4 exported from the electronics CAD software used. In figure 4.3 the finished manufactured and assembled board can be seen.

Fig. 4.3 Manufactured and assembled microcontroller board Rev. 1

Fig. 4.4 Microcontroller board PCB CAD design Rev. 2

The electrical schematic is shown in figure 4.5 – Microcontroller board schematic Rev. 2. In the schematic we have the power stabilizing that can be input from 5 to 12V, the linear power regulators provide 5V and 3V3 power to the rest of the board. An FTDI 232 chip is also included to make easy interfacing possible with standard USB2.0 hosts such as PC's, Laptops or development boards such as Raspberry Pi.

Fig. 4.5 Microcontroller board schematic Rev. 2

A list of features and capabilities the microcontroller board is shown in table 4.5.

Table 4.5 Microcontroller Board features based on DSPIC33FJ16GS504 Microcontroller

The Operating conditions are specified in table 4.6 DSPIC33FJ16GS504 Microcontroller operating conditions.

Table 4.6 DSPIC33FJ16GS504 Microcontroller operating conditions

The microcontroller core characteristics are listed in table 4.7 microcontroller core characteristics

Table 4.7 Microcontroller core characteristics

4.3.2 H-Bridge design

For driving the motors a small factor H-Bridge was designed and fabricated. The slim and small form factor of the drive boards make it easy to include in the exoskeleton The small form factor is a product of good IC performance and PCB design optimized for heat dissipation. The boards were designed around the VNH3SP30 integrated circuit produced by ST. The manufactured and assembled H-Bridge is shown in figure 4.6.

Fig. 4.6 – H-bridge manufactured and assembled board

The board schematic is described in figure 4.7 H-Bridge Board Schematic

Fig. 4.7 H-Bridge board schematic

The CAD PCB layout design is presented in figure 4.8 H-Bridge Board PCB Design. The driving part of the board can be powered at a maximum 16V with a logic level supply between 3.6V and 5V. The inputs include a PWM input signal that is used to control the output level the drive. In A and In B are used to set the direction of the output implicitly the direction of the motors. In A and In B are controlled using high low states.

Fig. 4.8 – H-bridge board PCB design

The specifications of the board are listed in following tables:

Table 4.8 – H-Bridge Pin Function description

Table 4.9 – Absolute maximum ratings

Table 4.10 – Direction and truth table

4.3.3 Battery and Power distribution

A Lithium-Ion Polymer battery was chosen for this project since they are commonly available and have a good power to weight ratio. The voltage rating of the battery must exceed or equal the maximum voltage rating of every component in the electrical system. Taking into account the components used in the system a 2 cell battery with a charged voltage of 7.4 was chosen. The battery specifications are shown in table 4.11 – battery specifications.

Table 4.11 – Battery specifications

4.3.4 Component interconnection

The interconnection of the components is shown in a simplified diagram in figure 4.10 – system block diagram. There are 4 motors, 4 motor drives, one microcontroller board and one battery.

The microcontroller is the central part of the system, it takes the input signals generated by the motor encoders and using a closed loop algorithm program controls the motors position and speed via its output pins connected to the motor drivers. The principle of the close loop control algorithm is shown in figure 4.9 – Information Flow in the closed loop control of the motor.

Fig. 4.9 Information Flow in the closed loop control of the motor

The power regulator on the microcontroller board also provides 3.6V to the encoders logic circuit and also the motor drivers logic circuit. All GND signals are connected together with the batteries negative terminal.

External information to the system can be provided via the USB interface of the microcontroller board. External information can be provided in multiple ways to the system, a few communication options to the system include:

– I2C communication via the remappable I/O pins

– SPI communication via the remappable I/O pins

– USB communication via Mini USB connector

– RS232 or serial communication via the remappable I/O pins

– RS232 or serial Over Bluetooth via the remappable I/O pins

– Parallel communication via the remappable I/O pins

– Direct memory access via DMA enabled I/O pins

– Parallel and serial LCD interface via I/O pins

These forms of communication are useful for obtaining information to the user such as finger position, speed, error states if any, current program routine running etc. The communication channels can also be used to load or modify parameters of the exoskeleton such as movement programs for rehabilitation routines. During development and debugging stage LCD's and serial communication to a PC can make the development stage more easy and manageable.

Interfacing capabilities of the system is show in figure 4.11 – command and control interfacing.

Fig. 4.10 System block diagram.

Fig. 4.11 – Command and Control interfacing.

4.4 Mechanical movement and force transmission

To ensure kinematic compatibility between the biological hand and exoskeleton's rotation axes, direct matching of the joints was used as the main design idea for the exoskeleton. Each exoskeleton finger is provided with three rotational joints.

Each exoskeleton finger was design to include pulleys and guiders for transmission wire. The transmission wire is fed trough the top and bottom part of the exoskeleton phalanges. Tensioning the wire on the upper part and releasing the tensions on the under part results in extending of the exoskeleton fingers. Similarly, tensioning the wire on the under part and releasing the tension on the upper part will result in flexion of the exoskeleton finger.

Wear caused by the wire transmission has the most impact during the flexion movement of the exoskeleton due to gripping and rehabilitation exercises that will be effected with the exoskeleton. To reduce the wear replaceable 4 pulleys were designed on the underside of the exoskeleton finger. The region under the metacarpal bones as well as the region under each phalange bone include one pulley each.

On the upper side wear is not as impactful, as a result only one pulley was used at the Metacarpal – Phalange (MCP) joint and regular slider guides were used on the Proximal – Inter – Phalange (PIP) and Distal – Inter – Phalange (DIP) joints of the exoskeleton. Transmission wire that can be used is between 1.8 and 0.8mm. Angle between the phalanges follow the biological hand angular freedom and mechanically do not allow the exoskeleton to exceed the maximum angular limitations of the biological hand.

The positions of the exoskeleton parts together with the position of the human fingers are represented in figure 4.12. Here we see also the position of the transmission wires and pulleys in different hand positions.

Fig. 4.12 – Positions of the exoskeleton parts and human finger

4.5 Mechanical attachment to the biological hand

The robotic exoskeleton attaches mechanically to the body via the orthetic shell structure together with a compliant material placed inside the shells that fits the human finger anatomy. The exoskeleton parts match the center of rotation of the human hand and provide flexibility.

The orthetic shell parts are 3D modeled using the anthropometric measurements collected previously. The 3D CAD modeling software used in the development of the mechanical parts is CATIA V5 by Dassault Systemes. The orthetic parts are divided into 3 separate categories: phalanx exoskeleton, metacarpal and forearm exoskeleton.

Fig. 4.13 Metacarpal section orthetic shell

The metacarpal region interfaces the palm region of the hand to the exoskeleton. The fingers are directly connected to this part via a circular guider that haves a remote center of rotation coincident to the biological MCP joints. The wire is transmitted through this part via rollers mounted under and over the metacarpal parts. The metacarpal region part is seen in figure 4.13 – Metacarpal section orthetic shell.

The phalanges exoskeleton include rollers in the dorsal area and cylindrical sliders for the wire transmission, the dimensions of the modules do not permit mechanically the joints to exceed the 0 – 90 degree angular limitation. This mechanical limitation is to avoid potential harm to the wearer of the exoskeleton. The limitations can be increased by placing addition spacers on the contact limiting surfaces of the phalanges. The exoskeleton parts for the finger phalanges are represented in figure 4.14 – Exoskeleton Finger Parts.

Fig. 4.14 – Exoskeleton Finger Parts

The forearm exoskeleton interfaces to the arm of the wearer and holds the control electronics such as motors, drivers, microcontroller and battery. The orthetic shell of the forearm can be seen in figure 4.15 – forearm orthetic shell.

Fig. 4.15 – Forearm Orthetic Shell

Here the rotational movement of the motors is converted to linear motion of the wire using the mechanism presented in figure 4.16 – Circular motion to linear motion.

Fig. 4.16 – Circular motion to linear motion.

The fire wraps around the action wheel and is fixed in one point on the wheel to prevent the wire from slipping on the wheel. Displacement of the wire is transmitted in a linear way through the rollers seen under the wheel.

4.6 Interchangeability of the phalanx for adapting to different hand sizes

Prototypes, tests and validation are the first stages of most project, later stages almost always involve production in larger numbers, the targeted final users are people that are recovering motor function of their limbs after stroke, in order for the final user to be able to use the device, the exoskeleton needs to be able to adapt to each person’s hand.

Adapting the exoskeleton for each person's hand is a considerable challenging tasks, but the question is does adapting require re-dimensioning the exoskeleton and customizing for each individual an orthentic shell that fits exactly their hand or can it be standardized in a range of interchangeable parts.

It turns out standardization is possible to some degree, due to a dimensional ratio that appears in nature very commonly. The Fibonacci ratio also known as The Golden Ratio can be found as dimensional ratio in plants, animals and even on a larger scales in things such as a hurricanes and even galaxies. The Fibonacci ratio and its presence are shown in figure 4.17.

Fig. 4.17 The Fibonacci ratio presence

In mathematics its described that two quantities are in the golden ratio if the ratio between the sum of those quantities and the larger one is the same as the ratio between the larger one and the smaller, this is described in figure 4.18 and relation 4.1.

Fig. 4.17 golden ratio between two elements

(4.1)

The golden ratio is often symbolized using Greek letter phi (Φ or φ).
In mathematics the golden ratio is known as an irrational mathematical constant, and is approximately 1.6180339887.

Measuring the human hands finger we can average the sizes of phalanges, we will get approximately: 2cm, 3cm, 5cm. If we take the metacarpal bone as well it averages at 8 cm. These numbers all belong to the Fibonacci sequence: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, etc.

Fig. 4.18 Correlation between the Fibonacci sequence and the human skeleton

Using the golden ratio together with a statistical research on human hand dimensions we can establish a set of prefabricated orthetic modules that can be interchanged to accommodate each person's hand.

4.7 Manufacturing

To bring the ideas and concepts of the design, manufacturing of a prototype was done using Fused Filament Fabrication (FFF) (Also known as Fused deposition modeling (FDM)). The complex nature of the human anatomy means that designing an exoskeleton that attaches harmoniously will inherit the relatively complex shapes and geometries of the biological human body. Trying to manufacture the parts prove to be expensive and hard using traditional milling manufacturing techniques, as a result the FFF manufacturing technique proves to be the most efficient and time saving prototyping solution for this project.

The FFF technologies available also known as 3D printing can be done using various materials, the parts manufactured for the first prototype were done using PLA material. A short description of the available materials and their characteristics are shown in table 4.12.

Table 4.12 – 3D Printing materials

The most common used materials available for 3D printing using FFF technology is PLA and ABS, a more detailed descriptions of the characteristics of these two materials is shown in table 4.13 – ABS and PLA characteristics.

Table 4.13 – ABS and PLA characteristics

One other factor that was taken into account when choosing PLA as a material for fabricating the prototype is the eco friendly disposal of the material, PLA being biodegradable is able to completely break down in as little as 3 months in nature given the right conditions.

A Makerbot Replicator clone 3D printer was used for manufacturing the parts. The machine and the CAM software used can be seen in figure 4.19 and 4.19.

Fig. 4.18 – Makerbot replicator 3D Clone

Fig. 4.19 – Makerbot CAM software

Conclusion

Trough technological innovation we can not only eliminate disability but we can Imagine and strive for a world in which technology is so advanced it can rid the world of disabilities. There is a need to more research and advancements in the area of robotics and bionics that aid rehabilitation. Economical growth can bring us very little if the quality of life is limited by disabilities.

Using modern rapid prototyping, 3D modeling software and small and compact microprocessors we can bring the quality of life to a new level. The possibilities are there, drive, motivation and funding is required to bring such technologies to the masses.

For this paper in particular, the contributions have reached a practical prototype stage, tests and improvements are still necessary and potential improvements will surely appear in a later stage of the project. For larger numbers of units dimensions can be made more compact and interchangeable only for some parts, at the moment the prototype is fully modular and each part is interchangeable for testing purposes.

Although this paper focuses on rehabilitation the applications for the device can be extended to other areas of use were enhanced strength is needed such as the industrial sector or even space exploration.

Indeed trough advances in robotics in this century we will set the new limits to technology for rehabilitation oriented robotics and we will slowly but surely end disability.

REFERENCES

1 – Worsnopp, T. T., Peshkin, M. A., Colgate, J. E. and Kamper, D. G., “An Actuated Finger Exoskeleton for Hand Rehabilitation Following Stroke,” Proc. of the IEEE International Conference on Rehabilitation Robotics, pp. 896-901, 2007.

2 – Fontana, M., Dettori, A., Salsedo, F. and Bergamasco, M., “Mechanical design of a novel Hand Exoskeleton for accurate force displaying,” Proc. of the IEEE International Conference on Robotics and Automation, pp. 1704-1709, 2009.

3 – Wege, A. and Hommel, G., “Development and control of a hand exoskeleton for rehabilitation of hand injuries,” Proc. of the IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 3046-3051, 2005.

4 – In, H. K., Cho, K.-J., Kim, K. R. and Lee, B. S., “Jointless structure and under-actuation mechanism for compact hand exoskeleton,” Proc. of the IEEE International Conference on Rehabilitation Robotics, pp. 1-6, 2011.

5 – Kadowaki, Y., Noritsugu, T., Takaiwa, M., Sasaki, D. and Kato, M., “Development of Soft Power-Assist Glove and Control Based on Human Intent,” Journal of Robotics and Mechatronics, Vol. 23, No. 2, pp. 281-291, 2011.

6 – Stergiopoulos, P., Fuchs, P. and Laurgeau, C., “Design of a 2-MAY 2012 /finger hand exoskeleton for VR grasping simulation,” Proc.the Eurohaptics, pp. 80-93, 2003.

7 – Otto Bock HealthCare, “WaveFlex Hand CPM Device,”

http://www.ottobock.ca/cps/rde/xchg/ob_us_en/hs.xsl/15712.html

8 – Patterson Medical, “Kinetec Maestra Portable Hand CPM,”

http://www.pattersonmedical.com/app.aspx?cmd=get_product&id=74161

9 – Mulas, M., Folgheraiter, M. and Gini, G., “An EMGcontrolled exoskeleton for hand rehabilitation,” Proc. of the 9th International Conference on Rehabilitation Robotics, pp. 371-374, 2005.

10 – Tong, K. Y., Ho, S. K., Pang, P. M. K., Hu, X. L., Tam, W. K., Fung, K. L., Wei, X. J., Chen, P. N. and Chen, M., “An intention driven hand functions task training robotic system,”

Proc. of the Annual International Conference of the IEEE Engineering in Medicine and Biology Society, pp. 3406-3409, 2010.

11 – Iqbal, J., Tsagarakis, N. G., Fiorilla, A. E. and Caldwell, D. G., “A portable rehabilitation device for the Hand,” Proc. of the Annual International Conference of the IEEE Engineering in Medicine and Biology Society, pp. 3694-3697, 2010.

12 – Schabowsky, C., Godfrey, S., Holley, R. and Lum, P., “Development and pilot testing of HEXORR: HandEXOskeleton Rehabilitation Robot,” Journal of NeuroEngineering and Rehabilitation, Vol. 7, No. 1, p. 36, 2010.

13 – Chiri, A., Giovacchini, F., Vitiello, N., Cattin, E., Roccella, S., Vecchi, F. and Carrozza, M. C., “HANDEXOS: Towards an exoskeleton device for the rehabilitation of the hand,” Proc. Of the IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 1106-1111, 2009.

14 – Chiri, A., Vitiello, N., Giovacchini, F., Roccella, S., Vecchi, F. and Carrozza, M. C., “Mechatronic Design and Characterization of the Index Finger Module of a Hand

Exoskeleton for Post-stroke Rehabilitation,” IEEE/ASME Transactions on Mechatronics, Vol. PP, No. 99, pp. 1-11, 2011.

15 – Wege, A. and Zimmermann, A., “Electromyography sensor based control for a hand exoskeleton,” Proc. of the IEEE International Conference on Robotics and Biomimetics, pp.

1470-1475, 2007.

16 – Ueki, S., Kawasaki, H., Ito, S., Nishimoto, Y., Abe, M., Aoki, T., Ishigure, Y., Ojika, T. and Mouri, T., “Development of a Hand-Assist Robot With Multi-Degrees-of-Freedom for

Rehabilitation Therapy,” IEEE/ASME Transactions on Mechatronics, Vol. 17, No. 1, pp. 136-146, 2012.

17 – Li, J., Zheng, R., Zhang, Y. and Yao, J., “iHandRehab: An interactive hand exoskeleton for active and passive rehabilitation,” Proc. of the IEEE International Conference on Rehabilitation Robotics, pp. 1-6, 2011.

18 – Sarakoglou, I., Tsagarakis, N. G. and Caldwell, D. G., “Occupational and physical therapy using a hand exoskeleton based exerciser,” Proc. of the IEEE/RSJ International Conference on Intelligent Robots and Systems, Vol. 3, pp. 2973-2978, 2004.

19 – Jones, C. L., Wang, F., Osswald, C., Kang, X., Sarkar, N. and Kamper, D. G., “Control and kinematic performance analysis of an Actuated Finger Exoskeleton for hand rehabilitation

following stroke,” Proc. of the 3rd IEEE RAS and EMBS International Conference on Biomedical Robotics and Biomechatronics, pp. 282-287, 2010.

20 – Ren, Y., Park, H.-S. and Zhang, L.-Q., “Developing a wholearm exoskeleton robot with hand opening and closing mechanism for upper limb stroke rehabilitation,” Proc. of the IEEE International Conference on Rehabilitation Robotics, pp. 761-765, 2009.

_________________________________________________

21 – Martinez, L. A., Olaloye, O. O., Talarico, M. V., Shah, S. M., Arends, R. J. and BuSha, B. F., “A power-assisted exoskeleton optimized for pinching and grasping motions,” Proc. of the IEEE Annual Northeast Bioengineering Conference, pp. 1-2, 2010.

22 – Baker, M. D., McDonough, M. K., McMullin, E. M., Swift, M. and BuSha, B. F., “Orthotic Hand-Assistive Exoskeleton,” Proc. of the IEEE 37th Annual Northeast Bioengineering Conference, pp. 1-2, 2011.

23 – Hasegawa, Y., Mikami, Y., Watanabe, K. and Sankai, Y., “Five-fingered assistive hand with mechanical compliance of human finger,” Proc. of the IEEE International Conference on Robotics and Automation, pp. 718-724, 2008.

24 – Hasegawa, Y., Tokita, J., Kamibayashi, K. and Sankai, Y., “Evaluation of fingertip force accuracy in different support conditions of exoskeleton,” Proc. of the IEEE International Conference on Robotics and Automation, pp. 680-685, 2011.

25 – Shields, B. L., Main, J. A., Peterson, S. W. and Strauss, A. M., “An anthropomorphic hand exoskeleton to prevent astronaut hand fatigue during extravehicular activities,” Proc. of the IEEE Transactions on Systems, Man and Cybernetics, Part A: Systems and Humans, Vol. 27, No. 5, pp. 668-673, 1997.

26 – Yamada, Y., Morizono, T., Sato, S., Shimohira, T., Umetani, Y., Yoshida, T. and Aoki, S., “Proposal of a SkilMate finger for EVA gloves,” Proc. of the IEEE International Conference on Robotics and Automation, Vol. 2, pp. 1406-1412, 2001.

27 – Benjuya, N. and Kenney, S. B., “Myoelectric Hand Orthosis,” Journal of Prosthetics and Orthotics, Vol. 2, No. 2, pp. 149-154, 1990.

28 – Fracture Behavior of quenched poly(lactic acid)

J. Gámez-Pérez, J. C. Velazquez-Infante, E. Franco-Urquiza, P. Pages, F. Carrasco, O.O.Santana, M. Ll. Maspoch

29 – Fibonacci Numbers in Nature & the Golden Ratio by Stan Grist

http://old.world-mysteries.com/sci_17.htm

30 – The new bionics that let us run, limb and dance by Hugh Herr

31 – Comparison of 3D printing material

http://2015.igem.org/wiki/images/2/24/CamJIC-Specs-Strength.pdf

Annex 1.1 – Source Code

#define LED1dir TRISC.f4

#define LED1 LATC.f4

#define M1_dir_pin1_type TRISC.f0

#define M1_dir_pin1 LATC.f0

#define M1_dir_pin2_type TRISC.f13

#define M1_dir_pin2 LATC.f13

#define M2_dir_pin1_type TRISB.f3

#define M2_dir_pin1 LATB.f3

#define M2_dir_pin2_type TRISB.f4

#define M2_dir_pin2 LATB.f4

unsigned int pwm_out1, pwm_out2;

int difference, proportional, integral, integral_error, output, basespeed;

unsigned char kp, kd;

float ki;

unsigned char receive;

int PWM1_value;

char PWM1_read[5];

char output_transmit[8];

open_dir()

{

M1_dir_pin1=1;

M1_dir_pin2=0;

M2_dir_pin1=0;

M2_dir_pin2=1;

}

close_dir()

{

M1_dir_pin1=0;

M1_dir_pin2=1;

M2_dir_pin1=1;

M2_dir_pin2=0;

}

stop_dir()

{

M1_dir_pin1=0;

M1_dir_pin2=0;

M2_dir_pin1=0;

M2_dir_pin2=0;

}

void one_Open_two_Close(void)

{

M1_dir_pin1=0;

M1_dir_pin2=1;

M2_dir_pin1=0;

M2_dir_pin2=1;

PWM_Set_Duty(pwm_out2,1);

PWM_Set_Duty(pwm_out2 ,2);

}

void one_Close_two_Open(void)

{

M1_dir_pin1=1;

M1_dir_pin2=0;

M2_dir_pin1=1;

M2_dir_pin2=0;

PWM_Set_Duty(pwm_out1,1);

PWM_Set_Duty(pwm_out1,2);

}

open_close_test()

{

forward_dir();

delay_ms(500);

pwm_out1=s0*4;

pwm_out2=s1*4;

PWM_Set_Duty(4000, 1);

PWM_Set_Duty(4000, 2);

stop_dir();

delay_ms(500);

backward_dir();

delay_ms(500);

stop_dir();

delay_ms(500);

}

void limit_motors_init()

{

if ( pwm_out1 > 8191) { pwm_out1 = 8191; }

if ( pwm_out2 > 8191) {pwm_out2 = 8191; }

if ( pwm_out1 < 1)    { pwm_out1 = 1; }

if ( pwm_out2 < 1)    { pwm_out2 = 1; }

}

void send_status_serial()

{

delay_ms(1000);

IntToStr(pwm_out1, pwm_out1_transmit );

UART1_Write_text("PWM1=");

UART1_Write_text(pwm_out1_transmit);

UART1_Write(10);    //new line

UART1_Write(13);    //jump to start of the line

IntToStr(pwm_out2, pwm_out2_transmit );

UART1_Write_text("PWM2=");

UART1_Write_text(pwm_out2_transmit);

UART1_Write(10);    //new line

UART1_Write(13);    //jump to start of the line

//delay_ms(1000);

}

void Led_Blink_Test()

{

LATC.f2=1;

delay_ms(100);

LATC.f2=0;

delay_ms(10);

}

void toggle_led()

{

LATC.f2=!LATC.f2;

}

void main()

{

//reset check

TRISC.f4=0;

LATC.f4=!LATC.f4;

//=================clock==========================

//00011 prescaler input/5 with 25mhz crystal

PLLPRE_0_bit=1;   //PLL Phase Detector Input Divider bits (also denoted as ‘N1’, PLL prescaler)

PLLPRE_1_bit=1;   //1111 = Input/33

PLLPRE_2_bit=0;   //

PLLPRE_3_bit=0;   //00001 = Input/3

PLLPRE_4_bit=0;   //00000 = Input/2 (defaoult)

//11110 PLL feedback Divisor set to 32. 34*5

PLLDIV_0_bit=0;    //PLL Feedback Divisor bits (also denoted as ‘M’, PLL multiplier)

PLLDIV_1_bit=1;    //111111111 = 513

PLLDIV_2_bit=1;    //.

PLLDIV_3_bit=1;    //.

PLLDIV_4_bit=1;    //000110000 = 50 (default)

PLLDIV_5_bit=0;    //.

PLLDIV_6_bit=0;    //000000010 = 4

PLLDIV_7_bit=0;    //000000001 = 3

PLLDIV_8_bit=0;    //000000000 = 2

PLLPOST_0_bit=0;   //PLL VCO Output Divider Select bits (also denoted as ‘N2’, PLL postscaler)

PLLPOST_1_bit=0;

// 11 = Output/8

// 10 = Reserved

// 01 = Output/4 (default)

// 00 = Output/2

//=================clock==========================

ADPCFG = 0x0000;       //0x0000 = configure AN pins as analogue / 0xFFFF = Configure AN pins as digital I/O

//=================UART configuration=============

UART1_Init(9600);

delay_ms(150);

//PPS_Mapping(28, _INPUT, _U1RX);

//PPS_Mapping(27, _OUTPUT, _U1TX);

U1MODE.UARTEN=1;

U1MODEbits.UEN=0b10;

RPINR18bits.U1RXR =0b11100;     //map RX pin

RP27R_0_bit=1;                  //map TX pin

RP27R_1_bit=1;                  //

RP27R_2_bit=0;                  //

RP27R_3_bit=0;                  //

RP27R_4_bit=0;                  //

RP27R_5_bit=0;                  //

//=================UART configuration=============

TRISA.f0=1;  //set input pin for AN0

TRISA.f1=1;  //set input pin for AN1

TRISA.f2=1;  //set input pin for AN2

TRISB.f0=1;  //set input pin for AN3

TRISB.f9=1;  //set input pin for AN4

TRISB.f10=1; //set input pin for AN5

TRISC.f1=1;  //set input pin for AN8

TRISC.f2=1;  //set input pin for AN9

TRISC.f10=1; //set input pin for AN10

TRISC.f9=1;  //set input pin for AN11

ADC1_Init();

///====start of pwm settings=====

Unlock_IOLOCK();

OC1CONbits.OCM = 0b000;     // disable Ouput Compare module

RP15R_0_bit=0;   //set RA15 to OC1

RP15R_1_bit=1;

RP15R_2_bit=0;

RP15R_3_bit=0;

RP15R_4_bit=1;

RP15R_5_bit=0;

OC1CONbits.OCM = 0b101;

PPS_Mapping_NoLock(11, _OUTPUT, _OC2);

OC2CONbits.OCM = 0b000;     // disable Ouput Compare module

//The user software must disable the associated Output Compare module when writing to the Output

//Compare x Control register

OC2CONbits.OCSIDL=1;  //1 = Timer3 is the clock source for Output Compare x

//0 = Timer2 is the clock source for Output Compare x

OC2CONbits.OCM = 0b101;

Lock_IOLOCK();

PWM_Init(5000, 1, 1, 2);

PWM_Init(5000, 2, 1, 2);

PWM_Start(1);

PWM_Start(2);

///====end of pwm settings=====

sensor_ofset=80;

pwm_out1=0;

pwm_out2=0;

TRISC.f0=0;

TRISC.f13=0;

TRISB.f3=0;

TRISB.f4=0;

M1_dir_pin1_type=0;

M1_dir_pin2_type=0;

M2_dir_pin1_type=0;

M2_dir_pin2_type=0;

kp=45;

ki=1;

kd=10;

basespeed=7000;

delay_ms(1800);

open_close_test();

open_One_close_two();

close_One_Open_two();

while(1)

{

integral_error = integral_error + difference;

if (integral_error > 350)      {integral_error = 350;}

if (integral_error < (-350))    {integral_error = (-350);}

integral = integral_error * Ki;

output = proportional + integral;

if(PORTC.f0==1 && PORTC.f1==1)

{

if(PORTC.f0==1)

{

open_dir;

}

if(PORTC.f1==1)

{

close_dir;

}

}

else

{

stop_dir();

}

}

}

Similar Posts