shopping cart dynamic assistance...

84
Shopping Cart Dynamic Assistance System Master’s Thesis in Systems, Control and Mechatronics JAKOB FJELLSTR ¨ OM & ADAM MAANINKA Department of Automatic Control, Automation & Mechatronics Mechatronic Systems & Control Design Chalmers University of Technology Gothenburg, Sweden 2014 EX023/2014

Upload: others

Post on 25-Jan-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

  • Shopping Cart Dynamic AssistanceSystemMaster’s Thesis in Systems, Control and Mechatronics

    JAKOB FJELLSTRÖM & ADAM MAANINKA

    Department of Automatic Control, Automation & MechatronicsMechatronic Systems & Control DesignChalmers University of TechnologyGothenburg, Sweden 2014EX023/2014

  • Abstract

    A shopping trolley with a dynamic assistance system is developed to help the elderly.The system gives help when the shopping trolley is heavy loaded and hard to pull andalso helps when climbing stairs. The product doesn’t give enough help in stairs due tolow maximum motor torque or high trolley weight. A future development of the trolleymight be to use two motors instead of one which is used in this prototype.

    A load cell is implemented in the bar leading up to the handle in order to measure theforce applied by the user. The measured force is then translated into a suitable helpingtorque provided by an electric motor. The stair climbing feature is achieved by using bigwheels with knobby tires (rough texture) to grip the edges, no other mechanical solutionis needed in this case.

    Three different types of controllers are investigated in this report, proportional ve-locity control, integral velocity control and torque control. The conclusion is that theproportional velocity and torque controllers work well when climbing stairs and steephills with the trolley. The integral velocity controller however, does not work well instairs but is great when it comes to flat surfaces and hills with some inclination. Theoverall performance of the trolley is good and it fulfils its purpose.

  • Acknowledgements

    We would like to thank Jonas Fredriksson who was our supervisor at Chalmers Universityof Technology, for giving us support and feedback. We would also like to thank AndreasPettersson, Daniel Chädström and Johan Åström for being our supervisors at ArosElectronics and for their help and support during the master thesis.

    We would like to thank Balázs Kulcsar for his thoughts during the development ofthe controllers, Birger Johansson, Roland and Tommy for the help during the mechanicaldesign and construction, Per Lundberg, Martin Ahlqvist, Anders Bonde and ThorbjörnSimonsson for the help during the electrical construction and also David Hallberg, JesperFors, Oscar Leon, Sebastian Holmqvist and Conny Dagerot for the help during thesoftware implementation.

    Last but not least we would like to thank Magnus Wide and the rest of the Arosadministration for allowing us to do our master thesis project at their company, and forgiving us support during the development. We would also like to thank everyone elsethat has helped us at Aros and Chalmers with different tasks during the project.

    Jakob Fjellström & Adam Maaninka, Göteborg June 11, 2014

  • Glossary

    Below is a short description of the most frequently used abbreviations.

    Name Description

    XMC Main controller board

    DMD Motor controller board

    SGB Strain Gauge Board - Processes signal from load cell

    OPC Operator Presence Control/Dead Man’s Switch

    SPI Serial Peripheral Interface - Communication protocol

    LED Light-Emitting Diode

    CAN Controller Area Network - Communication protocol

    PDO Process Data Exchange - Message type in CAN

    NMT Network Management - Message type in CAN

    I2C Inter-Integrated Circuit - Communication protocol

    CAD Computer-Aided Design

    CM Center of Mass

    LHS Left Hand Side of an equation

    RHS Right Hand Side of an equation

    DC Direct Current

    AC Alternating Current

    PID Proportional, Integral and Derivative controller

    LCD Liquid Crystal Display

    LiPo Lithium Polymer battery type

    LP Low-Pass filter

    RC Circuit with an resistance and capacitance (Low-Pass filter)

    PCB Printed Circuit Board

  • Contents

    1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.4 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.5 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.6 Previous Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.6.1 Star wheel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.6.2 Legs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.6.3 Caterpillar tracks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.6.4 Spokes/Big knobby tires . . . . . . . . . . . . . . . . . . . . . . . . 4

    1.7 Outline of the report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    2 System design 52.1 Requirements and wishes . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 Final solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    3 Modelling 83.1 User Control System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.2 Trolley simplifications and sketch . . . . . . . . . . . . . . . . . . . . . . . 93.3 Mathematical model of the Trolley . . . . . . . . . . . . . . . . . . . . . . 12

    3.3.1 Inertial matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.3.2 Rotational matrix and position definition . . . . . . . . . . . . . . 133.3.3 Lagrangian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    4 Control Design 174.1 Velocity control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    4.1.1 Proportional velocity controller . . . . . . . . . . . . . . . . . . . . 184.1.2 Integral velocity controller . . . . . . . . . . . . . . . . . . . . . . . 18

    i

  • CONTENTS

    4.2 Torque controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    5 Simulation 205.1 No controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205.2 Proportional velocity controller . . . . . . . . . . . . . . . . . . . . . . . . 205.3 Integral velocity controller . . . . . . . . . . . . . . . . . . . . . . . . . . . 225.4 Torque controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    6 Electronic construction 266.1 System description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266.2 Measuring force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    6.2.1 Placement of strain gauge . . . . . . . . . . . . . . . . . . . . . . . 286.2.2 Signal processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306.2.3 Implementation and results . . . . . . . . . . . . . . . . . . . . . . 32

    6.3 User interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336.3.1 Dead man’s switch . . . . . . . . . . . . . . . . . . . . . . . . . . . 336.3.2 Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346.3.3 Power switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    7 Mechanical construction 367.1 Motor design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    7.1.1 Torque calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . 367.1.2 Force measurements . . . . . . . . . . . . . . . . . . . . . . . . . . 387.1.3 Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

    7.2 Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397.2.1 Load cell assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . 397.2.2 Component box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    8 Software Implementation 448.1 Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448.2 Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    8.2.1 CAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458.2.2 SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

    9 Results 479.1 Friction in gearbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479.2 Controller results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

    9.2.1 Normal walking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489.2.2 Short steep slope . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509.2.3 Short stairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    ii

  • CONTENTS

    10 Verification 5310.1 Required help from motor . . . . . . . . . . . . . . . . . . . . . . . . . . . 5310.2 Controller behaviour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    10.2.1 Proportional velocity controller . . . . . . . . . . . . . . . . . . . . 5510.2.2 Integral velocity controller . . . . . . . . . . . . . . . . . . . . . . . 5710.2.3 Proportional torque controller . . . . . . . . . . . . . . . . . . . . . 57

    10.3 Requirements and wishes . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    11 Discussion 58

    12 Conclusion 60

    Bibliography 61

    A Function tree 62

    B Partial solutions 64

    C Total solutions 66

    D Simulink models 68

    E PCB 73

    iii

  • 1 Introduction

    This is a master thesis project within the fields of Signals and Systems. Theproject specifically describes the challenges of implementing a mechatronic so-lution and control design on a shopping cart for the elderly.

    1.1 Background

    Elderly and disabled people might have a hard time when shopping due to the heavylifting of shopping bags. A simple solution for this is to use a so called shopping trolley(Dramatenvagn) which is a type of shopping cart on two wheels pulled behind the user.The purpose of the shopping trolley is to facilitate the transportation by dragging thefood rather than carrying it. This will of course remove the heavy lifting problem,however you still have to pull the shopping trolley up and down steep hills and stairs.For an elderly user this might be a huge problem.

    1.2 Purpose

    The problem where the elderly have to pull heavy trolleys up steep hills and stairs willbe solved through an engineering point of view. The solution will ease the experience ofshopping for the elderly.

    1.3 Objective

    The objective of the project is to develop a product based on the shopping trolley whichsolves the above stated problems. The product should assist the user pulling the shoppingtrolley based on user inputs. This solution has to be able to handle rough terrain suchas steep hills, stairs and curbstones. Also, when pulling the trolley on flat surfaces itshould feel comfortable.

    1.4 Scope

    This thesis work will cover the development of dynamic assistance systems for a shoppingtrolley. The work will include the whole development chain starting with the require-

    1

  • 1.5. METHOD CHAPTER 1. INTRODUCTION

    ment specification, system design, modelling and simulation of the system and finallyconstruction and analysis of a prototype.

    The development work will be restricted in the following areas: marketing examina-tion, interviews and demand checks on the product itself.

    1.5 Method

    The development process will be divided into several parts.

    • Defining the primary functions that will be implemented in the new and improvedshopping trolley. Examples of the functions are; electric drive on flat surfaces andstairs, load measurement and regeneration of the energy source.

    • Use theoretical calculations to specify drive cycles of the shopping trolley.

    • Model and simulate the system in Simulink to evaluate the overall performance.

    • Dimension the actuators, energy sources and sensors based on simulations andcalculations.

    • Visualize the product through some form of CAD program.

    • Construct a prototype.

    • Design, implement, verify and validate a control system.

    Optimized motor control, autonomous drive and other neat functions will be imple-mented if time allows.

    1.6 Previous Work

    Within the field of stair climbing there are a lot of different solutions which have tobe taken into account. The stair climbing feature is used in many different products,from simple hand trolleys to advanced autonomous robots. This project however liesin between these areas. The product will be smart and powered by motors but is stilldriven by a user. Some of the previous work that is an inspiration to this work can beviewed in Figure 1.1. Observe that the final solution chosen for stair climbing and therest of the system, is shown in Section 2.3.

    Most of the references to previous work and other material presented in this re-port have been retrieved through the internet. Some references have been taken fromcompendiums from Chalmers University of Technology.

    2

  • 1.6. PREVIOUS WORK CHAPTER 1. INTRODUCTION

    Figure 1.1: Different solutions for the stair climbing problem that has been examinedin previous work. Starting from the left we have: Star wheel, Legs, Caterpillar tracks,Spokes/Big knobby tires.

    1.6.1 Star wheel

    One solution is often used on hand trolleys, and that is the tri-star wheel formation. Ithas three wheels that rotates about the center axis in a triangular shape (Fleming, 1969).When driving on flat surfaces the hand trolleys usually keeps two wheels on the ground.Another application for this solution is for small robots. According to (Moghadam andAhmadi, 2007) the star wheel formation handles stairs quite well and fast in comparisonto other solutions.

    Another similar approach is to build a wheel with the same shape as the tri-starwheel but with the difference that everything is made in one piece. That is, the wheelson the edges of the triangle can not rotate individually, as studied by (Herbert et al.,2008). This solution also performs well in stair climbing. However, they point out thatwhen moving forwards on flat ground an complex motion control algorithm is needed inorder to get an adequate motion.

    1.6.2 Legs

    Another solution is using legs to climb the stairs. This has been tested by (Moore andBuehler, 2001), where they put three legs on each side of a rectangular robot. Accordingto them, the robot had some problems when trying to climb. One problem was thatit was likely to fall backwards. To avoid this the robot needed to move at low speed.Another problem was that sometimes the rear legs failed and slipped.

    1.6.3 Caterpillar tracks

    The caterpillar tracks are usually used on robots where good accessibility in difficultterrain is required. According to (Matthies et al., 1999) this solution performs well inan urban environment, and climbing stairs is no problem. However, one downside withthe caterpillar tracks is that they have to be quite long and therefore use a lot of space.

    3

  • 1.7. OUTLINE OF THE REPORT CHAPTER 1. INTRODUCTION

    1.6.4 Spokes/Big knobby tires

    A lot of vehicles, for example motorcycles and electric wheelchairs, use the solution ofbig knobby tires to handle rough terrain such as stairs. Those vehicles often carry a lotof weight and need bigger motors. A similar solution is to use spokes to grip the stairs.(Jacovich, 2005) and (Wu, 2013) uses spokes attached to springs in order to keep thesmoothness of wheels with the grip of spokes. The springs are compressed when facingground.

    1.7 Outline of the report

    The report starts by covering the system design where the requirements and wishes forthe project are presented. The next chapters capture the modelling, control design andsimulation of the product to evaluate the system before the construction phase. Theconstruction is divided into electrical and mechanical construction as well as softwareimplementation. Finally the result is measured and analysed to evaluate if the finalproduct fulfils the initial requirements.

    4

  • 2 System design

    The system design describes the solution development process and the final chosen so-lution. The process starts with determining the demands and wishes for the trolley towithstand and finishes of with a sketch of the final solution.

    2.1 Requirements and wishes

    A requirement specification is made to be sure that the final product accomplishes thebuyer’s demands. The requirements and wishes are specified in Table 2.1 and 2.2 re-spectively. Both these tables are then used when comparing the different solutions. Allsolutions which do not meet the requirements are removed. To be able to use the wishesfor comparation, the importance of the wishes are weighted. A solution which solves ahigh weighted wish is more attractive than a solution which solves a low weighted wish.The wishes with most importance is that the product is ergonomic and easy to use sincethe targeted users of the product are the elderly. It is also important that the solutionis easy to implement due to the limited time of the thesis work.

    Table 2.1: Requirements for the trolley

    Requirement Description Test Value

    R1 Assisting drive on flat surfaces -

    R2 Assisting drive in slopes -

    R3 Drive up stairs -

    R3.1 Straight staircase -

    R3.2 Spiral staircase -

    R4 Handle side walks -

    R5 The solution may not occupy more than a certain space 4 dm3

    R6 Handle a certain weight 40 kg

    R7 Drive for a certain time 60 min

    R8 Use of an electric motor -

    R9 Not complex usage -

    R10 Be able to turn easily -

    5

  • 2.2. SOLUTIONS CHAPTER 2. SYSTEM DESIGN

    Table 2.2: Wishes for the trolley

    Wish DescriptionImportance

    (1-10 where 10 is highest)Weight

    W1 Be able to weigh the shopping content 3 0,048

    W2 Easy recharging of battery 6,5 0,104

    W3 Maximize torque at sensorless low speed 4 0,064

    W4 Minimize torque ripple 4 0,064

    W5 Display information to the user 7 0,112

    W6 Autonomous drive 2 0,032

    W7 Low total cost 5 0,080

    W8 Ergonomic design 9 0,144

    W9 Pretty design 7 0,112

    W10 Easy to use 10 0,160

    W11 Easy to implement 8 0,128

    SUM: 62,5 1,000

    2.2 Solutions

    When creating a total solution for a product it is wise to first make a function tree to getthe partial functions of the product. In this case the main function is to give assistancewhen using the trolley. The main function is divided into partial functions which in turncan be further divided. The function tree with its partial functions is shown in AppendixA. For each function at the end of a branch, a list of possible solutions is made. Thepartial solutions are shown in Appendix B. The partial solutions are then combined intototal solutions, see Appendix C. The total solutions which do not fulfil the requirementsare removed. The remaining solutions are then compared and weighted to how well theyfulfils the wishes. The top four total solutions in alphabetical order are:

    • Solution A Uses one motor along with big wheels with rough texture to climbstairs. Angle measurements are used for control. A dead man’s switch is used toensure that help is wanted.

    • Solution C Uses two motors along with big wheels with rough texture to climbstairs. Strain gauges and angle measurements are together used for control. Asmart algorithm with existing sensors is used to ensure that help is wanted.

    • Solution J Uses one motor along with wheels with spring spokes to climb stairssimilar to (Wu, 2013). Strain gauges and angle measurements are together usedfor control. A smart algorithm with existing sensors is used to ensure that help iswanted.

    • Solution P Uses two motors along with big wheels with rough texture to climbstairs. Spring spokes are added if the big wheels aren’t enough. Strain gauge

    6

  • 2.3. FINAL SOLUTION CHAPTER 2. SYSTEM DESIGN

    measurements are used for control. A dead man’s switch is used to ensure thathelp is wanted.

    2.3 Final solution

    The final total solution chosen is solution P. Two motors are used to be able to turneasier. Big wheels with rough texture are used for climbing stairs along with additionalspring spokes for better gripping of edges to ensure the stair climbing feature. Straingauges are used to measure the force applied from the user to give adequate help. Adead man’s switch is added to the handle to make sure that the motor doesn’t drivewhen there is no user holding the handle. Figure 2.1 shows a CAD sketch of the finalsolution.

    Figure 2.1: CAD sketch of the final solution.

    7

  • 3 Modelling

    This chapter describes the modelling procedure of the project. First some simplificationsare done to make the calculations easier. Then the Lagrange equation is used to retrievea mathematical model of the shopping trolley (plant).

    3.1 User Control System

    An overall block diagram of the user holding the trolley and the trolley itself can beviewed in Figure 3.1.

    Figure 3.1: Block diagram of the user control system. vref,user is the wanted velocityof the user pulling the trolley. v is the trolley velocity, euser is the difference between thewanted velocity and the actual velocity, and uuser is the force applied by the user to thetrolley.

    Assuming that there are no other control inputs to the plant except for the force theuser is pulling the trolley with uuser, the plant is simply describing a model of the trolley.The user control system block is describing the user’s reactions. That is, when doing thistype of simplification it is assumed that the force applied by the user is depending onthe difference between the current velocity of the trolley and the velocity that is wantedby the user. Simply put, if the user is walking in a certain velocity and wants to increasethe velocity, he or she will pull harder.

    There is another way of looking at the user control system. If you look at the user’sarm which is pulling the trolley, a thought is that it is possible to describe it using aspring and damper system. That is, at a close proximity to the trolley the arm is notpulling anything, however when a small step in any direction is made a force is generated.A larger step in the same direction would then imply an even larger force on the trolley.This can be compared to that the arm is stretching when the user is moving away from

    8

  • 3.2. TROLLEY SIMPLIFICATIONS AND SKETCH CHAPTER 3. MODELLING

    the trolley. However there is also a damper effect in place. Obviously the arm is notwaving back and forth without stopping when walking with the trolley, and since therehas to be some form of damping. A similar line of thought and the way to model the ahuman arm is also investigated in (Wang et al., 2010). This means that instead of theforce (uuser) depending on the difference in velocity between the user and the trolley, itnow depends on the displacement. A new block diagram can be viewed in Figure 3.2describing this way of viewing the system.

    Figure 3.2: Block diagram of the user control system. posuser is the position of the userpulling the trolley. pos is the trolley position, euser is the difference between the position ofthe user and trolley, and uuser is the force applied by the user on the trolley.

    Essentially this way of modelling the user and plant (through a spring and dampersystem) is going to be used later on in this report.

    3.2 Trolley simplifications and sketch

    To make the modelling of the plant (trolley) easier, see Figure 3.2, the following simpli-fications are made:

    • The different parts of the trolley are simplified to blocks and point masses to easierhandle the inertia.

    • No slip is assumed between wheels and ground.

    • No air resistance

    • The z-position of the body frame in reference to the inertial frame is always zero.This means the trolley is at ground level constantly.

    A sketch is made using the above information. Figure 3.3 and 3.4 shows the trolleywith an above and side view respectively. The most important angles and positions aremarked in the figures. X, Y and Z mark the inertial frame while xb, yb and zb markthe body fixed frame. The pitch of the trolley is described with ψ which is the angle ofthe zb axis relative to the Z axis. The angle of the wheels θr and θl are the rotationsabout the yb axis. The yaw φ is the rotation of the body about the Z axis which is

    9

  • 3.2. TROLLEY SIMPLIFICATIONS AND SKETCH CHAPTER 3. MODELLING

    later described in terms of the wheel angles. All the initial constants and variables aredescribed in Table 3.1.

    X

    Y

    xb

    yb

    Yb

    Xb

    φ

    Z

    Figure 3.3: Sketch from above. X, Y and Z marks the inertial frame while xb, yb and zbmarks the body fixed frame. The yaw φ is the rotation of the body about the Z axis.

    xb

    zb

    X

    Z

    mm

    ml

    mc

    ψ

    θl,r

    Y

    Figure 3.4: Sketch from side. The pitch of the trolley is described with ψ which is theangle of the zb axis relative to the Z axis. The angle of the wheels θr and θl are the rotationabout the yb axis.

    10

  • 3.2. TROLLEY SIMPLIFICATIONS AND SKETCH CHAPTER 3. MODELLING

    Table 3.1: Constants and variables

    Name Type Description

    PbI = [xbI , ybI , zbI ] [m] Position of O of body frame in respect to inertial frame

    Motor & Gear

    mm [kg] Mass of motor and gear

    Dm [m] Depth of motor

    Wm [m] Width of motor

    Hm [m] Height of motor

    PmB = [xmB, ymB, zmB] [m] Position of CM of motor in respect to body frame

    ir, il [A] Motor current (right, left)

    Vr, Vl [V] Motor voltage (right, left)

    Im [kgm2] Inertia of motor

    Kt [-] Motor torque const.

    Kb [-] Motor back EMF cosnt.

    Rm [Ω] Motor resistance

    Load

    ml [kg] Mass of load

    Dl [m] Depth of load

    Wl [m] Width of load

    Hl [m] Height of load

    PlB = [xlB, ylB, zlB] [m] Position of CM of load in respect to body frame

    Chassis

    mc [kg] Mass of chassi

    PcB = [xcB, ycB, zcB] [m] Position of CM of chassi in respect to body frame

    Wheel

    mw [kg] Mass of wheel

    rw [m] Radius of wheel

    tw [m] Thickness of wheel

    yrw,B [m] y-position of CM of right wheel in respect to body frame

    ylw,B [m] y-position of CM of left wheel in respect to body frame

    Angles

    ψ [rad] Pitch of body frame in respect to inertial frame

    φ [rad] Yaw of body frame in respect to inertial frame

    θr [rad] Angle of right wheel

    θl [rad] Angle of load wheel

    Physical parameters

    g = 9.82 [m/s2] Gravity

    fw [-] Friction coeff. between wheel and ground

    fm [-] Friction coeff. between motor and chassi

    11

  • 3.3. MATHEMATICAL MODEL OF THE TROLLEY CHAPTER 3. MODELLING

    3.3 Mathematical model of the Trolley

    The mathematical modelling is divided into sections for easier reading. The sectionsdescribe the different parts of the modelling procedure. Variables and constants aredescribed in Table 3.1. The differential equations achieved in this section results in theplant from Figure 3.1.

    3.3.1 Inertial matrix

    The first thing to calculate is the inertial matrix about the origin of the body fixed frame

    IB =

    Ixx −Ixy −Ixz−Ixy Iyy −Iyz−Ixz −Iyz Izz

    . (3.1)The inertia about the CM (centre of mass) of each object of the body is calculated

    according to standard formulas of inertia as

    Im =

    112mm(W

    2m +H

    2m)

    112mm(D

    2m +H

    2m)

    112mm(W

    2m +D

    2m)

    (3.2)

    Ic =

    000

    (3.3)

    Il =

    112ml(W

    2l +H

    2l )

    112ml(D

    2l +H

    2l )

    112ml(W

    2l +D

    2l )

    (3.4)

    Iw =

    112mw(3r

    2w + t

    2w)

    12mw(r

    2w)

    112mw(3r

    2w + t

    2w)

    (3.5)where Im, Ic, Il and Iw are the inertial vectors for the motor, chassi, load and wheelsrespectively. Bold characters denote a vector. The chassi is seen as a point mass andtherefore has no inertia about its center of mass (CM). To create the elements of theinertial matrix Steiners theorems

    Ix′x′ = Ixx +m(d2y + d

    2z) (3.6)

    Ix′y′ = Ixy +mdxdy (3.7)

    12

  • 3.3. MATHEMATICAL MODEL OF THE TROLLEY CHAPTER 3. MODELLING

    are needed. The diagonal elements of the inertial matrix are calculated from (3.6) withthe x, y, z values above as

    Ixx = [1, 0, 0] · Im +mm(y2mB + z2mB) + [1, 0, 0] · Il +ml(y2lB + z2lB)+[1, 0, 0] · Ic +mc(y2cB + z2cB) + 2 ∗ ([1, 0, 0] · Iw +mwy2rwB)

    (3.8)

    Iyy = [0, 1, 0] · Im +mm(x2mB + z2mB) + [0, 1, 0] · Il +ml(x2lB + z2lB)+[0, 1, 0] · Ic +mc(x2cB + z2cB)

    (3.9)

    Izz = [0, 0, 1] · Im +mm(x2mB + y2mB) + [0, 0, 1] · Il +ml(x2lB + y2lB)+[0, 0, 1] · Ic +mc(x2cB + y2cB) + 2 ∗ ([0, 0, 1] · Iw +mwy2rwB).

    (3.10)

    Assuming the masses are symmetrical about yb there will only be one product ofinertia which is

    Ixz = mcxcBzcB +mlxlBzlB +mmxmBzmB (3.11)

    according to (3.7). Since Ixy = Iyz = 0, all the components of the inertial matrix isfound.

    3.3.2 Rotational matrix and position definition

    The rotational matrix is needed to be able to map the coordinates of the body fixed frameto the inertial frame (Boström, 2013). In this case it is assumed that the trolley has bothwheels against the ground at all times, which means that there is no rotation about thexb axis. The standard rotational matrices about the yb and Z axis are multiplied to getthe total rotational matrix from body to inertial frame

    RBI =

    cosφ cosψ − sinφ cosφ sinψsinφ cosψ cosφ sinφ sinψ− sinψ 0 cosψ

    . (3.12)where ψ and φ are the angles rotated about the yb and Z axis respectively. The rotationalmatrix is used to define the position of the different masses in the inertial frame. Theposition of the origin of the body frame in the inertial frame is PbI = [xbI , ybI , 0] whichmakes the position of for example the motor

    PmI = RBI ·PmB + PbI (3.13)

    with corresponding inertial positions for the other components. The denoted I or Bdescribes if the variable or constant is in the inertial or body frame respectively. In asimilar way

    II = RBIIB. (3.14)

    13

  • 3.3. MATHEMATICAL MODEL OF THE TROLLEY CHAPTER 3. MODELLING

    3.3.3 Lagrangian

    The goal with the mathematical model is to obtain the differential equations of the trol-ley. One method for finding the differential equations is using the Lagrangian equations

    d

    dt

    ∂L

    ∂q̇i− ∂L∂qi

    = Qi i = 1,...,M (3.15)

    where L is called the Lagrangian (Boström, 2013), qi is the generalized coordinates andQi is the generalized forces. The Lagrangian is built from the potential and kineticenergy of the system. The potential energy is

    U = [0, 0, 1]MtotgPCMI (3.16)

    whereMtot = mc +mm +ml (3.17)

    PCMI = RBI1

    Mtot(mcPcB +mmPmB +mlPlB) + PbI (3.18)

    and the vector [0,0,1] extracts the height (Z) of the position vector PCMI. The kineticenergy is divided into the translational energy,

    Tt =1

    2mwṖ

    TrwIṖrwI +

    1

    2mwṖ

    TlwIṖlwI +

    1

    2mtotṖ

    TCMIṖCMI (3.19)

    and the rotational energy

    Tr =12 θ̇

    2r [0,1,0]Iw +

    12 θ̇

    2l [0,1,0]Iw +

    12 [0, ψ̇, 0]

    T IB[0, ψ̇, 0]+12 [0, 0, φ̇]

    T II [0, 0, φ̇] +12n

    2Im(θ̇r − ψ̇)2 + 12n2Im(θ̇l − ψ̇)2

    (3.20)

    which together with the potential energy (3.16) creates the Lagrangian

    L = Tt + Tr − U. (3.21)

    There are also some equations of motion, see (Yamamoto, 2009), which can be usedin order to eliminate the yaw angle φ and replacing it with a function of the wheel anglesθr and θl. The left hand side (LHS) of (3.15) is then calculated with the generalizedcoordinates (φ, θr and θl) to obtain the differential equations.

    ddt

    (dLdψ̇

    )− dLdψ

    ddt

    (dLdθ̇r

    )− dLdθr

    ddt

    (dLdθ̇l

    )− dLdθl

    (3.22)The right hand side of the Lagrange equations is given by the generalized forces

    (external forces) in the directions of the generalized coordinates. In this case there areat least four different forces. However, as a starting point only three of these forces aremodelled.

    14

  • 3.3. MATHEMATICAL MODEL OF THE TROLLEY CHAPTER 3. MODELLING

    Since there is three generalized coordinates which all are angles, their correspondinggeneral forces are a sum of torques. This means the external forces need to be expressedin torques. The torque from the DC motors is described

    Tmr,l = nKtir,l (3.23)

    where n is the motor gear ratio, Kt is the motor torque constant and ir,l is the right andleft motor current, see (Yamamoto, 2009). Using the standard DC motor equations andassuming that the DC motor inductance and friction inside the motor is negligible, themotor current

    ir,l =vr,l +Kb(ψ̇ − θ̇r,l)

    Rm(3.24)

    is calculated, where vr,l is the motor voltage, Kb is the back EMF constant of the motorand Rm is the motor resistance. The friction torque between the body and the motor is

    Tfmr,l = fm(ψ̇ − θ̇r,l) (3.25)

    where fm is the friction coefficient between body and motor. The friction torque betweenthe wheel and ground is

    Tfwr,l = fwθ̇r,l (3.26)

    where fw is the friction coefficient between wheel and ground. From the above calculatedtorques, the three generalized forces FψFθr

    Fθl

    = −Tmr − Tml − Tfmr − TfmlTmr + Tfmr − Tfwr

    Tml + Tfml − Tfwl

    (3.27)(torques in this case) is found.

    In order to get the differential equations on a form which is runnable in a simulationsoftware (such as Simulink) it is favourable to have the equation on a standard formlike ẍ = f(ẋ, x). Combining the right hand side (generalized forces) and left hand side(derivations of the Lagrangian) the differential equations fψ(ψ̈,ψ̇,ψ,θ̈r,θ̇r,θr,θ̈l,θ̇l,θl)fθr(ψ̈,ψ̇,ψ,θ̈r,θ̇r,θr,θ̈l,θ̇l,θl)

    fθl(ψ̈,ψ̇,ψ,θ̈r,θ̇r,θr,θ̈l,θ̇l,θl)

    = FψFθrFθl

    (3.28)is achieved, which is not on the above stated standard form. That is, each equation con-tains the second derivative of each generalized coordinate. In order to get the equationsin the standard form a factorization is required. Factorizing (3.28)

    A(ψ̇,ψ,θ̇r,θr,θ̇l,θl)

    ψ̈θ̈rθ̈l

    = FψFθrFθl

    (3.29)15

  • 3.3. MATHEMATICAL MODEL OF THE TROLLEY CHAPTER 3. MODELLING

    gives a new 3-by-3 matrix A, which is a function of lower order derivatives of the gener-alized coordinates. Multiplying both sided with the inverse of the A matrix ψ̈θ̈r

    θ̈l

    = A−1(ψ̇,ψ,θ̇r,θr,θ̇l,θl) FψFθrFθl

    (3.30)gives the final differential equations which are usable in a simulation environment.

    Figure 3.5: Block diagram of the user plant with input and outputs. pos is the output ofthe plant (position) and uuser is the input (force applied by the user on the trolley).

    The plant block in Figure 3.5 represents the nonlinear model in (3.30), where FψFθrFθl

    = f(uuser) (3.31)and

    pos = f(ψ,θr,θl) (3.32)

    That is, the user force applied (uuser) is transformed into the three generalized torquesthrough some simple geometry calculations. This transformation is needed because theuser is applying the force along the handlebar and not directly on the wheels like themotor does. Also the position of the trolley in the inertial frame can be found throughsome simple calculations (summations) of the wheel angles over time.

    16

  • 4 Control Design

    In the system design chapter (Chapter 2) the way to control the trolley was established.The controller is supposed to use either the angle measurements from a gyroscope andaccelerometer, the pulling force measurements from strange gauges or a combination ofboth. However, for simplifications and due to time budget, only controllers based onforce measurements is investigated.

    4.1 Velocity control

    A controller based on velocity is made using the force measurements from the straingauges uuser as the reference from the user. However it does not make sense to comparethe outputted velocity v from the plant directly to the input force from the user. Soin order to compare the reference force from the user with the output velocity from theplant, some form of mapping (controlling) is required, see Figure 4.1.

    Figure 4.1: Block diagram of the entire system. posuser is the position of the user pullingthe trolley. v is the trolley velocity, euser is the difference between the position of the userand that of the trolley, and uuser is the force applied by the user on the trolley. vref isthe estimated wanted velocity of the user which is the mapped signal of uuser through thecontroller. The motor controller block is just representing a linear controller.

    As noted in Figure 4.1 the Controller block is actually not closed loop within thesystem process, it is open loop. The loop is closed though through the user (human)interaction. Also in the controller block it is possible to shape the dynamics of thesystem. For instance a first order filter might be implemented here to give the user asmoother experience when pulling the trolley in addition to any proportional, integral or

    17

  • 4.2. TORQUE CONTROLLER CHAPTER 4. CONTROL DESIGN

    derivative effects wanted. The signal ”d”, which is actually the same as uuser, is affectingthe plant directly in addition to being the input to the controller. That is, the d-signal isthe force applied by the user on the trolley. The d-signal can be viewed as a disturbanceor feed forward signal and is thus given the name ”d”.

    The Motor Controller block which is added in the figure is only used to track thereference velocity vref . This block corresponds to the built in controller inside the ”real”motor, and it is of a PID type.

    4.1.1 Proportional velocity controller

    The first controller that is implemented has only a proportional gain. That is, thereference velocity that is given to the motor controller is proportional to the force appliedby the user. This type of control makes it necessary to always have a user force greaterthan zero, since if the force is zero then the reference velocity also become zero in whichcase the trolley stops. In the case when a user starts pulling the trolley, starting fromzero velocity, a large force is exerted on the trolley in the initial acceleration. This isthen transformed into a reference velocity higher than the current velocity of the trolleyand so the motor starts producing extra torque to increase the velocity. However whenthe desired velocity is reached the force the user was using to accelerate the trolley withis reduced since no more acceleration is wanted. This makes the reference velocity of thetrolley lower as well, and the trolley reduces its velocity to an equilibrium point wherethe user is constantly pulling with a certain force. In other words there is some steadystate error. And by that logic the steady state error should increase with increasingreference velocity from the user.

    4.1.2 Integral velocity controller

    Another type of velocity controller examined is an integral type controller. Lets lookat Figure 4.1 again. Since vref is a velocity and uuser is a force, it is natural to thinkthat the user force (uuser) is proportional to the wanted acceleration of the trolley. Thenthe reference vref increases or decreases proportionally against uuser. Simply put vref isthe weighted sum of uuser, which means integral action. The belief is that this type ofcontroller keeps on integrating the control signal until the user won’t have to pull anyof the load and therefore removes any steady state error. This feat is the thing thatdifferentiate the integral controller from the other examined controllers.

    4.2 Torque controller

    Torque control is just what it sounds like. That is, controlling the torque of the motorbased on force measurements. Simply put, the more force the user applies to the trolleythe more help he/she will get. However, since this control method requires the user toalways apply some force to get help, it has a built in a steady state error. The steadystate error for the torque controller increases when a higher torque is wanted, since it is

    18

  • 4.2. TORQUE CONTROLLER CHAPTER 4. CONTROL DESIGN

    proportional to the measured force which in some sense is the reference/error that thecontroller wants to follow/correct.

    Figure 4.2: Block diagram of the entire system. posuser is the position of the user pullingthe trolley. euser is the difference between the position of the user and that of the trolley,and uuser is the force applied by the user on the trolley. u is the control signal (torque inthis case).

    As can be noted in Figure 4.2, it looks a little different from the block diagram forthe two velocity controllers in Figure 4.1. The difference is now that instead of followingthe velocity reference from the controller block, the motor controller block (not visiblein Figure 4.2) now just applies the torque that the controller block outputs directly tothe plant.

    19

  • 5 Simulation

    Based on the model described in Chapter 3 simulations are made in Matlab/Simulink,see Appendix D. The model of the trolley and motor is somewhat correct, howeversince the models and simulations are made before the actual prototype is built, theydo not fully represent the final product. However the major characteristics are thereand the simulations is foremost used for evaluating the control strategies of the differentcontrollers described in Chapter 4 before implementing them in the real plant.

    5.1 No controller

    As a start only simulation using the model of the plant together with the model of theuser is made. A step response is simulated where the user velocity starts at 0 m/s andends at 1.4 m/s. Added to the velocity of the user is a sine wave with frequency 1.8Hz and amplitude 0.1 m/s in order to simulate the steps taken by the user pulling thetrolley. The velocity signal is then run through a first order filter with a time constantof 0.1 s and then integrated to get the position of the user. The difference in positionbetween the user and the trolley is then the input to the user control system which ismodelled by a spring/damper system, as described in Section 3.1. Out from the usercontrol system block is the force which is applied to the plant and also measured. Inthis case the motor is turned off and only the user force is acting on the plant.

    As can be seen in Figure 5.1 the velocity of the user is oscillating as intended whichaffects the pulling force. The velocity of the trolley is also oscillating however at a loweramplitude due to the damping effect in the user control system. That is, the dampingcomes from the arm of the user pulling the trolley. The amount of force required to pullthe trolley at 1.4 m/s is about 30 N, which seems reasonable.

    5.2 Proportional velocity controller

    The proportional velocity controller described in Section 4.1.1 is evaluated. The resultcan be viewed in Figure 5.2.

    20

  • 5.2. PROPORTIONAL VELOCITY CONTROLLER CHAPTER 5. SIMULATION

    0 1 2 3 4 5 6 7 8 9 10−0.5

    0

    0.5

    1

    1.5

    2Velocity of the user and trolley

    Vel

    ocity

    [m/s

    ]

    Time [s]

    UserTrolley

    0 1 2 3 4 5 6 7 8 9 100

    50

    100

    150Force applied

    Time [s]

    For

    ce [N

    ]

    UserMotor

    Figure 5.1: Simulation results when the controller and motor is turned off. The only thingpulling the trolley is now the force directly applied by the user.

    0 1 2 3 4 5 6 7 8 9 10−0.5

    0

    0.5

    1

    1.5Velocity of the user and trolley

    Vel

    ocity

    [m/s

    ]

    Time [s]

    UserTrolley

    0 1 2 3 4 5 6 7 8 9 10−50

    0

    50

    100

    150

    200

    250Force applied

    Time [s]

    For

    ce [N

    ]

    UserMotor

    Figure 5.2: Simulation results when the controller is set on velocity control using a PD-controller. Both the user force and the torque generated by the motor affects the system.

    When comparing the resulting graph in Figure 5.2 with the results when no controlleris active, Figure 5.1, it is deducted that the force applied by the user is now lower. It

    21

  • 5.3. INTEGRAL VELOCITY CONTROLLER CHAPTER 5. SIMULATION

    is measured to be about 20 N from earlier 30 N in steady state, which is about a 30 %reduction. The user is also getting help in the initial acceleration part where the forcerequired is almost halved. However, it is also visible in the figure that the control signal(motor force) is oscillating a lot. This type of behaviour might not be desired.

    Another simulation with the same controller parameters is made, this time a firstorder filter is implemented in the controller in order to make the control signal oscillateless. The result can be viewed in Figure 5.3.

    0 1 2 3 4 5 6 7 8 9 10−0.5

    0

    0.5

    1

    1.5

    2Velocity of the user and trolley

    Vel

    ocity

    [m/s

    ]

    Time [s]

    UserTrolley

    0 1 2 3 4 5 6 7 8 9 10−50

    0

    50

    100

    150Force applied

    Time [s]

    For

    ce [N

    ]

    UserMotor

    Figure 5.3: Simulation results when the controller is set on velocity control using a PD-controller. Both the user force and the torque generated by the motor affects the system. Afirst order filter is added in the controller block to get a more stable control signal.

    As can be noted in Figure 5.3 the control signal is oscillating less, however at theexpense of not giving as much help in the early acceleration part. As expected the usercontrol signal never reaches zero, which means the user constantly needs to add force inorder to get any help from the motor.

    5.3 Integral velocity controller

    The second controller that is evaluated is also a velocity controller. This controllerhowever has no proportional or derivative part, but only an integral part. The resultscan be viewed in Figure 5.4.

    22

  • 5.4. TORQUE CONTROLLER CHAPTER 5. SIMULATION

    0 1 2 3 4 5 6 7 8 9 10−0.5

    0

    0.5

    1

    1.5

    2Velocity of the user and trolley

    Vel

    ocity

    [m/s

    ]

    Time [s]

    UserTrolley

    0 1 2 3 4 5 6 7 8 9 10−50

    0

    50

    100

    150Force applied

    Time [s]

    For

    ce [N

    ]

    UserMotor

    Figure 5.4: Simulation results when the controller was set on velocity control using aI-controller. Both the user force and the torque generated by the motor affects the system.

    Here the controller is smooth from the beginning and no first order filter is neededas for the earlier controller discussed in Section 5.2. It is noticed however that the useris not getting a lot of help in the initial acceleration phase, but as time progresses theuser force is tending towards 0 N. This means that after a while the user doesn’t needto pull at all, the trolley will hold its velocity anyway.

    When doing these simulations, it is also noted that if measurement noise is addedto the force measurement (in the form of an offset), the integral action of the velocitycontroller makes the trolley increase its velocity and closes in on the user pulling it. Thiscan be viewed in Figure 5.5.

    This behaviour results in a negative force from the user (that is, the user pushes thetrolley back continuously). This is something that is also noticed when testing the finalprototype. When the force measurement sensor is not calibrated properly, which meansit has an offset, the integral action keeps on increasing the velocity of the trolley as laterdiscussed in Section 9.2.1 about the integral velocity controller.

    5.4 Torque controller

    The last type of controller that is evaluated is the torque controller. The results can beviewed in Figure 5.6

    23

  • 5.4. TORQUE CONTROLLER CHAPTER 5. SIMULATION

    0 2 4 6 8 10 12 14 16 18 20−0.5

    0

    0.5

    1

    1.5

    2Velocity of the user and trolley

    Vel

    ocity

    [m/s

    ]

    Time [s]

    UserTrolley

    0 2 4 6 8 10 12 14 16 18 20−50

    0

    50

    100

    150Force applied

    Time [s]

    For

    ce [N

    ]

    UserMotor

    Figure 5.5: Simulation results when the controller is set on velocity control using a I-controller. Both the user force and the torque generated by the motor affects the system.Here an offset was added to the measurement of the user pulling force.

    0 1 2 3 4 5 6 7 8 9 10−0.5

    0

    0.5

    1

    1.5Velocity of the user and trolley

    Vel

    ocity

    [m/s

    ]

    Time [s]

    UserTrolley

    0 1 2 3 4 5 6 7 8 9 100

    50

    100

    150

    200Force applied

    Time [s]

    For

    ce [N

    ]

    UserMotor

    Figure 5.6: Simulation results when the controller is set on Torque mode using a P-controller. Both the user force and the torque generated by the motor affects the system.

    The resulting graph shows that the motor torque is proportional to the user force.This makes sense and is expected. However this control method, like the proportional

    24

  • 5.4. TORQUE CONTROLLER CHAPTER 5. SIMULATION

    velocity controller, requires that the user always applies a force to the trolley unlike theintegral velocity controller as discussed in the previous section.

    25

  • 6 Electronic construction

    During the project a lot of electronic construction is made. In this chapter the differentparts and their connection is explained. The electronic system is described followed bythe force measurement implementation. At the end the user interface is described.

    6.1 System description

    Figure 6.1: A description of the electrical system.

    26

  • 6.1. SYSTEM DESCRIPTION CHAPTER 6. ELECTRONIC CONSTRUCTION

    Figure 6.1 displays an overall system description. The red board in the middleis the XMC board which is the centre piece of the system. It is in this board thecontrollers are implemented, that is the controller explained in Chapter 4. The XMCboard communicates with the rest of the system using different communication protocols.The sensor (load cell that measures the force from the user) has the simplest form ofcommunication, that is the XMC just reads an analogue value from the SGB (StrainGauge Board) and supplies it and the load cell with power.

    The Arduino pretty much just passes through the information about the controllerparameters and states of the system from the XMC to the display. It also contains amenu in which it is possible for the user to select which information to be viewed onthe display, as well as letting the user change the controller parameters through buttonslocated on the display. The communication is here done by using SPI between the XMCand Arduino, and I2C between the Arduino and the LCD display.

    The XMC passes the control signal through a CAN bus to the DMD which is the mo-tor controller board. The DMD has a simple PID controller implemented for controllingthe motor based on the reference given by the XMC.

    Everything is powered through the power supply constellation which consists of two12 V, 50 C and 6000 mAh LiPo batteries connected in series with a main power switchin between. The motor is directly connected to the 24 V power supply while the otherboards are supplied with a 15 V signal. This is due to the maximum allowed voltage onthe boards. This means that the 24 V signal needs to be converted down to 15 V. The15 V signal also has a power switch, which is actually a switch connected to a relay, thatturns the power to the boards on/off separated from the power to the motor.

    Figure 6.2: In the left bottom corner is the red XMC board, the bottom right is the greenSGB board. Inside the metallic box to the right is the motor control board.

    27

  • 6.2. MEASURING FORCE CHAPTER 6. ELECTRONIC CONSTRUCTION

    Figure 6.2 shows the electronic system constructed. In the left bottom corner ofFigure 6.2 is a red board called XMC, which contains the controller implementations.The small green board in the lower right is the SGB board which filters and amplifiesthe signal from the load cell. Inside the motor chassis in the upper right corner is themotor control board (the DMD board). It contains the control algorithm for velocitytracking used by the motor. Above the red board lies two batteries and a metallic boxhidden below the red and black cables. They form (together with the switches thataren’t visible in the picture) the power supply constellation. The fourth board is anArduino (not shown in the picture) which operates as user interface. The Arduino isfurther described in Section 6.3.2

    6.2 Measuring force

    In Chapter 2, system design, it is decided that the trolley is going be controlled by forcemeasurements from strain gauges. Strain gauges are very sensitive resistors which areapplied to the surface of the object to which the force will be applied. In this case theyare applied to the rod below the handle. When a force is applied the rod will slightlydeform and cause the resistor to deform as well. The deformed resistor will have a higherresistance than before. The difference in resistance is measured and later converted to aforce in the software.

    A more reliable solution is to use a load cell which is a metal component with straingauges already applied to it. That way the insecurities of attaching the strain gaugesare removed. Also one can be certain that the metal itself has the abilities suitable forthe specific purpose. One drawback of the load cell is that the trolley has to be rebuilt.The rod has to be split in two and the load cell attached in between the two parts.

    6.2.1 Placement of strain gauge

    The placement of the strain gauges are important. Different positions give differentperformances. For this project the strain gauges is placed according to Figure 6.3. Theobjective is to measure the force component in the direction of the rod. When the forceF is applied, strain gauges R2 and R4 will deform equally and R1 and R3 will deformvirtually nothing.

    The strain gauges are connected to a Wheatstone bridge according to Figure 6.4 tobe able to measure the difference in strain. The measured difference is

    Vout =R1R3 −R4R2

    (R3 +R2)(R1 +R4)Vin. (6.1)

    which can be used to make sure the strain gauges are placed correctly. To accomplishthe previously mentioned objective, Vout needs to measure a force in the direction of therod but be resistant to pure torques. When a force in the direction of the rod is appliedR2 = R4 = R + ∆R and R1 = R3 = R. Since the deformation of the aluminium rod issmall the deformation of the resistors resolve in a resistance difference ∆R of only ±100

    28

  • 6.2. MEASURING FORCE CHAPTER 6. ELECTRONIC CONSTRUCTION

    F

    F

    F

    F

    R1

    R2

    R3

    R4

    Figure 6.3: Placement of strain gauges

    mΩ. The strain gauge nominal resistance R is 350 Ω and the input voltage Vin is 5 V.Used in (6.1)

    Vout =R2 − (R+ ∆R)2

    (R2 + ∆R)(R2 + ∆R)Vin =

    −2R∆R −∆2R(R2 + ∆R)2

    Vin ≈ −0.71 mV (6.2)

    which means Vout 6= 0. However, when the rod is bent R2 = R+ ∆R, R4 = R−∆R andR1 = R3 = R which gives

    Vout =R2 − (R−∆R)(R+ ∆R)

    (2R+ ∆R)(2R−∆R)Vin =

    ∆2R4R2 −∆2R

    Vin ≈ 0.1 µV. (6.3)

    This result means that torques affecting the rod will be approximately zero in comparisonwith a force in the direction of the rod which is the wanted behaviour.

    Vout

    R1

    R4

    R2

    R3

    Vin

    Figure 6.4: Strain gauge placement in Wheatstone bridge

    If using a load cell the strain gauges inside the metal component is already connectedin a Wheatstone bridge which means that the load cell will only measure force in aspecified direction. The inputs to the load cell are Vin and ground and the outputs arethe two nodes creating Vout.

    29

  • 6.2. MEASURING FORCE CHAPTER 6. ELECTRONIC CONSTRUCTION

    6.2.2 Signal processing

    The output signal from the Wheatstone bridge is in the range of ±1 mV. The analogueinputs of the XMC board is in the range of 0 − 6 V with an A/D converter with 4096steps which results in a step size of 6000/4096 = 1.4 mV. It is obvious that the outputsignal Vout needs to be processed to get a suitable range.

    5 V

    Node 1

    Node 2

    GND

    R1

    C1

    R1

    C1

    R1

    C1

    R1

    C1

    Rpot A

    Vout

    Vref

    −+

    R2

    R2 Reg12− 24 V

    GND

    5 V

    Figure 6.5: Circuit of signal processing board. The left side is connected to the Wheatstonebridge. The right side is connected to the XMC board.

    Figure 6.5 shows the circuit of a developed signal processing board. The purpose ofthe board is to filter, amplify and offset the output signal from the Wheatstone bridgeso that the signal offset is 2,5 V with a range of ±500 mV. Four switches are also addedto the circuit (not shown in the figure). Two of them are used to turn the filters on andoff, one is used for choosing the input voltage to the Wheatstone bridge (5 or 12 − 24V) and the last one is used to turn balancing of the Wheatstone bridge on and off. Thebalancing of the Wheatstone bridge (not shown in the figure) is used to set the differencebetween Node 1 and 2 to zero when no force is applied. This is useful for example if thegluing of the strain gauges isn’t perfect.

    Low Pass Filtering

    The low pass filters are built from two RC-circuits in series. The filter circuits aredesigned to suppress frequencies above 10 Hz. With R1 = 100 kΩ and C1 = 100 nF, theLP filter is simulated using LTSpice, the resulting bode plot is shown in Figure 6.6 andthe transient response in Figure 6.7.

    The bode plot confirms the values of the resistance and the capacitance. At 10 Hzthe amplification is -5.9321 dB which means the cut off frequency is slightly lower. Athigher frequencies the suppression is about 40 dB per decade which matches that of asecond order Butterworth filter. From the transient response it is also noticed that thetime constant is about 30 ms and the rise time about 58 ms. Altogether it is assumedthat force changes from the user will be slower than 10 Hz. Higher frequencies is thoughtof as noise and will be suppressed.

    30

  • 6.2. MEASURING FORCE CHAPTER 6. ELECTRONIC CONSTRUCTION

    Figure 6.6: Bode plot of low pass filter

    Figure 6.7: Step response of low pass filter

    Amplification

    As previously mentioned the output signal from the Wheatstone bridge is a couple ofmV while the analogue input of the XMC board has the range of 0-6 V. In Figure 6.5 thedifference between Node 1 and Node 2 (after being filtered) is amplified with a instru-mental amplifier. The resistor connected to the amplifier specifies the amplification. By

    31

  • 6.2. MEASURING FORCE CHAPTER 6. ELECTRONIC CONSTRUCTION

    using a potentiometer of 200 Ω the amplification will be variable with a range of about300− 10000 times according to the data sheet for the component INA128. The highestresistor value determines the lowest possible amplification.

    Offset

    The offset is needed so that the output value doesn’t vary about zero. In the case thatthe the signal varies about zero only positive signals would be measurable, since thevoltage range of the A/D converter is 0 to 6 V. To match the analogue input to theXMC board the wanted offset is 2,5 V. This can be managed by feeding the referenceport of the instrumental amplifier Vref with 2,5 V while the supply voltages V+ and V−is 5 V and ground respectively. The 6 V signal is regulated from the 12 − 24 V inputvoltage to the circuit. From the 5 V signal, Vref is created using a voltage divider inseries with a voltage buffer.

    6.2.3 Implementation and results

    The force measurements is realized in a couple of ways. The first implementation isstrain gauges used with the placement and Wheatstone bridge configuration as men-tioned above. To measure the strain a prototype signal processing board (SGB) is builtaccording to Figure 6.5 using stripboard. The SGB is shown in Figure 6.9 (the leftpicture). This configuration is used to measure the force needed to pull the trolley witha 20 kg load in different slopes. From these measurements the maximum needed motortorque can be estimated. The noise from the strain gauges with the prototype SGB isshown in Figure 6.8, top graph. The noise has an amplitude of ±10 N and has an offsetdepending on temperature and plastic deformation in the rod. This means the signal istoo noisy to be used as reference to the controller since the signal to noise ratio is toolow. If using this configuration the noise may be interpreted as a signal which couldcause the trolley to move without a user input signal.

    To get rid of the signal offset a load cell is tested. While connected to the prototypeSGB the noise is measured (Figure 6.8, middle graph). The result is much more stablewith an amplitude of ±0.5 N. There is no plastic deformation (or at least small enoughto not be visible on the measurements) and since the strain gauges are integrated in ametal construction they are more resistant to temperature changes. At this point thenoise is mostly from the prototype SGB.

    Using Eagle an improved circuit and PCB layout is developed, shown in Figure E.1and E.2 in Appendix E. From those, a printed circuit board is manufactured, Figure 6.9(the right picture), to remove the unnecessary noise of the prototype signal processingboard. The manufactured SGB gave the noise shown in Figure 6.8, lower graph. Theresulting noise is at most ±0.05 N which is more than enough. A signal of only 0.5 N iseasy to distinguish. Hence, this is used as the final configuration.

    32

  • 6.3. USER INTERFACE CHAPTER 6. ELECTRONIC CONSTRUCTION

    0 50 100 150 200 250 300−40

    −20

    0Noise level using strain gauge and prototype SGB

    0 10 20 30 40 50 60 70 80 90−1

    0

    1Noise level using load cell and prototype SGB

    For

    ce [N

    ]

    0 20 40 60 80 100 120−0.1

    0

    0.1Noise level using load cell and manufactured SGB

    Time [s]

    Figure 6.8: Noise measurement of the different force measurement configurations.

    Figure 6.9: Prototypes of developed signal processing board. At the left is the first proto-type board and to the right is the newer PCB.

    6.3 User interface

    Important parts of the trolley are the safety when driving the trolley and some way ofgetting information to the user. These functions are described in this section.

    6.3.1 Dead man’s switch

    What happens if the user suddenly drops the handle, or tries to lift the trolley straightup without holding the handle? Should the motor keep on turning in these situationsor should it stop? These are the main questions that needs to be answered in the safetyaspect of the trolley. That is, how to ensure that the trolley won’t run over the user

    33

  • 6.3. USER INTERFACE CHAPTER 6. ELECTRONIC CONSTRUCTION

    if he/she looses control of it. The result of the solution elimination from Chapter 2 isto use a so called dead man’s switch or another name for it Operator Presence Control(OPC). The OPC can be viewed in Figure 6.10.

    Figure 6.10: The dead man’s switch which is needed to be activated in order for the motorto run.

    The good thing about the OPC is that it is easy to implement in hardware and insoftware perspective. The OPC is constructed by two pieces of plastic put together withscrews. In between the two pieces three switches is placed. When the user squeezes theOPC the switches activate and the two cables leading to the Arduino is short circuited,which allows easy detection. Simply put, if the user squeezes the handle the motor runs,if the handle is dropped or let go the motor stops.

    6.3.2 Arduino

    In order to display information to the user a display shield together with an Arduino isused which can be viewed in Figure 6.11.

    The Arduino communicates with the XMC board via SPI. An advantage with usingthe Arduino is that it comes with plug and play ready solutions for most applications.However, when using SPI with an Arduino the plug and play solutions only supports theArduino as a master. In this case the Arduino is set as a slave for which a custom SPIcode is implemented. Another problem when using the SPI with the Arduino is that theArduino uses 5 V while the XMC uses 3.3 V which requires a level shifter.

    6.3.3 Power switches

    As described in earlier sections there are two power switches and four LEDs as can beviewed in Figure 6.12. The right most switch (black with a pink light) is used for cuttingoff the power to every component in the system. The right most switch (metallic) is usedfor only rebooting the control system. The LEDs come in pairs of two. The right mostpair displays the level of the battery, that is if it needs recharging. The right most LEDs

    34

  • 6.3. USER INTERFACE CHAPTER 6. ELECTRONIC CONSTRUCTION

    Figure 6.11: The Arduino together with a display shield. The user can set the controlparameters online by using the Arduino which communicates through SPI to the XMCboard.

    Figure 6.12: The led lights displays the current battery level and control mode. The switchon the right switches on/off the XMC and SGB boards. The switch to the left switches allpower on/off.

    tells the user if the trolley is in running mode and reacts to forces in the rod leading upto the handle or if it is stopped/error mode and doesn’t supply any torque.

    35

  • 7 Mechanical construction

    This chapter explains the different parts of the mechanical construction of the prototypeas well as the procedure of finding the motor properties.

    7.1 Motor design

    The design of the motor and potential gearbox is important to the project to get anappropriate amount of help when for example going up a steep hill. In this sectioncalculations and measurements are compared and evaluated to conclude what motorproperties are needed.

    7.1.1 Torque calculations

    This section contains calculations to estimate the motor torque required to drive thetrolley in different slopes. Since the mathematical model developed in Chapter 3 doesnot include inclination of the slope, these calculations uses a simpler model with someadded equations. The total torque T is

    T = Tw + Tb (7.1)

    where Tw is the sum of the torques needed to rotate the wheels and motor and Tb is thetorque needed to drive the body up the slope. The two different torques are calculatedas

    Tw =(Im + Iw)ẍ+ fmẋ

    rw(7.2)

    andTb = (fwẋ+mtotẍ+mtotg sinα)rw, (7.3)

    where the variables and constants are described in Table 7.1.The total torque is calculated according to a predefined velocity and acceleration

    behaviour to get a good estimate. The velocity curve is created to get a time constantof approximately 0.5 seconds. The velocity and acceleration is shown in Figure 7.1 tothe left.

    In the right graph of Figure 7.1 the total torque is shown. The torque is calculatedat several different degrees of inclination with the velocity and acceleration behaviour aspreviously described. The torque behaviour follows that of the acceleration but reaches

    36

  • 7.1. MOTOR DESIGN CHAPTER 7. MECHANICAL CONSTRUCTION

    Table 7.1: Constants and variables used while calculating torque required.

    Name Type Description

    Im [kgm2] Inertia of motor

    Iw [kg2] Inertia of wheels

    fm [-] Friction in motor

    fw [-] Friction between wheel and ground

    rw [m] Wheel radius

    mtot [kg] Total mass of trolley

    α [◦] Degrees of road inclination

    ẋ [m/s] Velocity of trolley

    ẍ [m/s2] Acceleration of trolley

    0 1 2 3 4 5 60

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    1.4

    1.6

    1.8

    Time [s]

    Velocity and acceleration of the trolley

    Velocity [m/s]

    Acceleration [m/s2]

    0 1 2 3 4 5 60

    10

    20

    30

    40

    50

    60

    70

    80Torque with different inclinations

    Time [s]

    Tor

    que

    [Nm

    ]

    0 °20 °40 °60 °80 °

    Figure 7.1: The left figure shows the velocity and acceleration used to calculate the torquerequired in different slopes. The right figure shows the torque required with the velocity andacceleration in the left figure. The torque is calculated for different inclinations and a totalmass of 35 kg.

    a steady state value depending on the degree of inclination. The values of inclinationshown unlikely appears when walking outside, however each step in a staircase behavesas a short slope with a maximum of 90◦ inclination which is why the high inclinationtorque values are shown in the graph.

    Each torque curve has a high peak in the beginning due to the acceleration. Assumea motor with maximum torque lower than the peak appearing when the inclination is80◦. The only thing affected by cutting the peak is the acceleration at that inclination.At any lower inclination the trolley would behave as expected. Hence the peaks is of littleimportance when looking at the motor torque required. The maximum motor torque

    37

  • 7.1. MOTOR DESIGN CHAPTER 7. MECHANICAL CONSTRUCTION

    0 10 20 30 40 50 60 70 80 900

    10

    20

    30

    40

    50

    60

    70Steady state torque depending on inclination

    Inclination [degrees]

    Tor

    que

    [Nm

    ]

    Figure 7.2: Steady state calculations of the total torque as a function of the inclination ofthe road. In the calculations the total mass of the trolley is assumed to be 35 kg.

    required is instead determined by the highest steady state torque. Figure 7.2 shows thesteady state torque as a function of the inclination. The maximum torque required isapproximately 69.2 Nm at the inclination of 90◦. In that case the motor would carry thetotal mass of the trolley up the stairs since 69.2/rw = 69.2/0.2 = 346 N is approximatelythe same as mtotg = 343 N and the difference can be explained by the friction. Regardingslopes outside, they do probably not exceed an inclination of 20◦ which means 25 Nm isenough to drive the trolley if stair climbing isn’t a part of the objective. Also noticeableis that the objective is to give help, not to drive the whole mass of the trolley.

    7.1.2 Force measurements

    A drive cycle analysis is made using the strain gauge sensors together with the first pro-totype SGB card as mentioned in Section 6.2.3. The result can be viewed in Figure 7.3.From the results it is deducted that with a load of about 20 kg, a force of approximately

    10 20 30 40 50 60 70 80 90

    −50

    0

    50

    100

    150

    200

    250

    Going up stairs

    Time [s]

    For

    ce [N

    ]

    Figure 7.3: Measurements of the force required to pull the trolley up a set of stairs. Theresults from this test was used in the drive cycle analysis. The total mass of the trolley was20 kg. Each spike in the graph is one step of the staircase.

    250 N is required in order to climb stairs, which is the worst case for the trolley. InSection 2.3 it is stated that the final solution should use big wheels with rough textureto climb stairs. ”Big wheels” is here defined as wheels with at least 40 cm diameter,which means a radius higher than one step in a staircase. Together with the knowledge

    38

  • 7.2. ASSEMBLY CHAPTER 7. MECHANICAL CONSTRUCTION

    that the force needed is about 250 N from the results in Figure 7.3 the resulting torqueis

    T = 250 · 0.2 = 50 Nm (7.4)

    given from multiplying the needed force with the radius. This means that in order todrive the entire trolley up the stairs, approximately 50 Nm is needed. If compared withthe motor torque calculations in Section 7.1.1, where the inclination was set to 90◦, thisresult is lower than expected. This is explained by the trolley weight being different.The torque calculations in Section 7.1.1 is done with a total weight of 35 kg while in thiscase the total weight is only 20 kg. If the motor torque calculations from Section 7.1.1would have been remade, the result would correspond to the results given in this sectionat about 50 Nm.

    Now, what about the needed velocity? Normal walking velocity is measured to beapproximately 1.4 m/s which is about 1.1 Hz with the current wheel radius at 20 cm.From this it is assumed that if even if you would walk really fast you wouldn’t reachabove 2 Hz at normal walking velocity. This becomes the second constraint on themotor/motors, they need at least 120 rpm.

    7.1.3 Motor

    Since there is only one motor available which somewhat fits the drive line specificationabove, only one motor is used. The motor chosen is a 12/24 V permanent magnetsynchronous motor with a maximum torque at 1.1 Nm and maximum velocity 3600 rpmat 12 V or 7200 rpm at 24 V. It has a gearbox attached to it in order to better fulfil theapplication, with a ratio of 30 : 1. This means that the outgoing axle from the gearboxcan give about 33 Nm along with 120 rpm at 12 V or 240 rpm at 24 V. One motor isnot enough to drive the entire trolley itself up the stairs as concluded in earlier sections,however it still gives some help.

    7.2 Assembly

    The mechanical construction is based on an existing shopping trolley. The purposeis to integrate the load cell into the handle and to design a box which is to hold thecomponents such as motor, battery and circuit boards. The box is placed underneaththe existing trolley and replaces the original wheels and wheel axle.

    7.2.1 Load cell assembly

    As mentioned the load cell needs to be integrated in the handle of the trolley so thatthe force is measured in the right direction. To do this the rod leading up to the handleof the trolley is disassembled and two new parts is built. The two parts attaches therod again with the load cell in between. In Figure 7.4 the two parts and the load cell isassembled. The load cell is the S-shaped part in the middle of the assembly. The twounused holes in the upper part is connected to the handle while the two holes in the

    39

  • 7.2. ASSEMBLY CHAPTER 7. MECHANICAL CONSTRUCTION

    lower part is connected to the lower part of the rod. The finished assembly of the loadcell can be viewed in Figure 7.5.

    Figure 7.4: Assembly of the load cell. The backside of the trolley is connected to the upperand lower unused holes.

    Figure 7.5: Finished assembly of the load cell.

    7.2.2 Component box

    Figure 7.6 shows the plastic box which holds most of the electrical and mechanicalcomponents. The electrical components are the XMC board, the SGB, the motor driveboard and a battery. The mechanical components are described below. The designmakes it possible to choose between using one or two motors. The finished componentbox can be viewed in Figure 7.7.

    40

  • 7.2. ASSEMBLY CHAPTER 7. MECHANICAL CONSTRUCTION

    Figure 7.6: Assembly of the component box. The box will be placed under the existingtrolley.

    Figure 7.7: Finished assembly of the component box. The box is placed under the existingtrolley.

    Plastic box

    The plastic box is made of acrylic glass which gives the opportunity to see the componentswhile keeping them contained which is preferable on a prototype like this. The box haspre-drilled holes for mounting of the motor and the bearings. The box also has a lidwhich simplifies assembly and disassembly.

    41

  • 7.2. ASSEMBLY CHAPTER 7. MECHANICAL CONSTRUCTION

    Drive axle

    Figure 7.8: Design of axel.

    Even thou two of the specified motors would be needed to give a reasonable amount ofhelp, only one motor was used in the design due to a shortage of the specific motor. Thisintroduces another problem, how does the trolley turn when both wheels are fixed tothe same axle? An answer to this is to connect the wheels to the axle with freewheels.Freewheels works as normal bearings when turning in one direction (axle and wheel canrotate independently to each other). However, when turning in the other direction theaxle and wheel fixates and they turn together. This makes it possible to drive the wheelsforward using the motor, however the user can always pull faster than the motor withouthaving to pull the motor and gearbox as well. This enables the possibility to also turnwhile walking with the trolley (one wheel can move faster than the other). The motorbasically determines the minimum velocity of the trolley but the user can still walkfaster. This solution gives demands on the axle. The drive axle is designed consideringa number of different demands:

    • The motor uses a 6 mm parallel key and a 19 mm axle diameter. Possibility of twomotors is wanted.

    • Two bearings should attach the axle to the box with room for retaining rings.

    • Each wheel is attached to the axle with a freewheel and a bearing with room forretaining rings. The freewheel uses a 5 mm parallel key and a 17 mm axle diameter

    • Outside each wheel there needs to be a possibility to attach a mechanical part usedfor stair climbing.

    The final axle design is shown in Figure 7.8.

    42

  • 7.2. ASSEMBLY CHAPTER 7. MECHANICAL CONSTRUCTION

    Gearbox attachment

    For the motor and gearbox to be attached to the plastic box a metal distance is needed.The distance has 6 threaded holes. The gearbox is mounted to three of them and theplastic box is mounted to the other three. The thickness is 15 mm so that the motordoes not touch the plastic box.

    Bearing attachment

    The purpose of the bearing attachment is to lock the bearings to the box so that theaxle is kept in place. The bearing fits perfectly into a cup which is assembled on thesides of the box.

    43

  • 8 Software Implementation

    The software implementation includes the controller structure as well as the communi-cation implementations.

    8.1 Controllers

    The controller software is implemented in the XMC board as mentioned in Section 6.1.The purpose of the software is to read the user force input and give a control signal to themotor depending on what controller is active (proportional velocity, integral velocity ortorque controller). The controller software structure is shown in Figure 8.1. As expected,the program starts with a calibration and initiation sequence which calculates the forceoffset and sets the DMD board in running mode. After the initiation sequence, threeprocesses starts which are running with different time periods.

    The first process handles the communication with the Arduino. Every other timethe loop is running, the program will send a variable or receive a variable update. TheArduino is the user interface and therefore needs all the variables which may be changedby the user, i.e. controller mode, controller parameters and filter time constant. Alsobattery level is indicated. The Arduino then return codes to the XMC, where eachcode represents incrementing or decrementing the current variable. One of the code bitsrepresents if the OPC is activated or not so that the XMC always knows if to drive themotor or not.

    Process number two is the controller. As often as the user specifies, the process loopsamples the user force, calculates control signal depending on the active controller andthen sets the motor reference. The motor reference is either a velocity or torque valuewhich is sent to the DMD board. The DMD board uses a built in controller to maintainthe given reference.

    The third process handles controller mode changes from the user or sets error mode ifthe DMD board demands it. The mode changes internally first and then sends an updateto the DMD board. At the end of the process all controller variables are updated.

    8.2 Communication

    Some communication is needed between the different boards used. The different proto-cols used is briefly explained below.

    44

  • 8.2. COMMUNICATION CHAPTER 8. SOFTWARE IMPLEMENTATION

    Figure 8.1: Flow chart of the controller and communication software implementation.

    8.2.1 CAN

    For communication between the main controller board (XMC) and the motor controlboard (DMD) the CANopen communication protocol is used. This protocol is alreadyimplemented in the two boards and is the main reason to why this communicationmethod is chosen. There are also CAN ports available on both boards which also affectsthe decision.

    Establishing the CANopen connection is fairly easy. The XMC board is set to bemaster and the DMD board to slave. When the XMC tells the motor board to go into aspecific operation mode the NMT protocol is used. However, the PDO protocol is usedwhen sending messages about control reference, error codes, voltage levels and so on.

    45

  • 8.2. COMMUNICATION CHAPTER 8. SOFTWARE IMPLEMENTATION

    8.2.2 SPI

    For communication between the XMC and the Arduino, Serial Peripheral Interface (SPI)is used. The reason to why SPI is chosen in this case is that the Arduino does not havea CAN port and the I2C port is already taken by the LCD shield that is mounted ontop of the Arduino. In principal the SPI communication works as follows. The master(XMC in this case) sends a command to the slave (Arduino) and after the Arduino hasreceived the command, the master either sends a variable value or expects the slave toanswer with a certain value. Some problems are noted when trying to establish the SPIconnection between the XMC and Arduino board, and those are:

    • The XMC is speaking SPI at 3.3V, while the Arduino is set to 5V.

    • A level shifter implemented to solve the problem in the above bullet point makesthe signal distorted which leads to bit losses.

    • The cable needed to reach all the way from the XMC to the Arduino is longer thanwanted, this could introduce noise in the signal.

    • The Arduino board doesn’t have built in SPI libraries when in slave mode.

    A bi-directional level shifter from Sparkfun is used instead of the original level shifter.This solved the first two bullet points. SPI protocol code is written for the Arduino inorder to make it a slave which solves the last bullet point. However, for the third bulletpoint there isn’t much to do in hardware. There are noise introduced which sometimesresulted in problems. For instance, when the Arduino is supposed to answer the XMCwith a certain value, it sometimes won’t send back the correct information. But insteadit sends back the same command it have just received from the XMC. This is easilysolved in the software by resending the same message again every time the answer is thesame as the command.

    46

  • 9 Results

    This chapter contains the results from measurements of the trolley in different environ-ments such as stairs and slopes.

    9.1 Friction in gearbox

    Below this section measurements is done to evaluate the controllers implemented to thetrolley. To make the measurements more accurate the loss of torque due to frictions inthe gearbox has to be known. The help which the user experiences does not match themeasured helping force since the friction of the gearbox will absorb some of the energy.Figure 9.1 shows the torque needed to rotate the drive axle in a certain constant velocity

    2 4 6 8 10 12 14−8

    −6

    −4

    −2

    0

    2

    4

    6

    8Torque loss in gearbox

    Time [s]

    Drive axle velocity [km/h]Motor torque [Nm]

    Figure 9.1: Measurements of the torque provided by the motor when the only load is thegearbox friction and the drive axle inertia. When going forwards in the first half of thegraph the wheel inertia is also included.

    when the load of the trolley it self is removed. This means only the torque needed toovercome the friction of the gearbox is applied. The torque required is approximately 4Nm which gives a loss in force of 4/rw = 4/0.2 = 20 N from the measured to the experi-enced motor force where rw is the wheel radius. This has to be taken into considerationwhen looking at the following figures.

    47

  • 9.2. CONTROLLER RESULTS CHAPTER 9. RESULTS

    9.2 Controller results

    This section is divided into different tests where the velocity controllers and the torquecontroller are compared in performance. All tests are performed with a load of 15 kgresulting in a total weight of 35 kg. In the figures below, the applied user force (uuserfrom Chapter 3.1 and 4) is presented along with the provided motor torque (measuredin the DMD board) scaled to motor force using the wheel radius. When looking at theuser force signal it has to be taken into account that some force is required on to holdthe trolley in a certain pitch angle. When standing still the required force is measuredto 15 N. This means the user force directly adding velocity to the trolley is the rest.The noise like behaviour in the user force signals below is actually force variations whichoccur in each step the user takes.

    9.2.1 Normal walking

    The user and motor force applied while walking on flat ground are shown in Figure 9.2.The stopped mode (top graph) shows the user force required to pull the trolley withno help from the motor. For this test the user force needed is approximately 30 N instopped mode.

    Proportional velocity controller

    In the proportional velocity controller (second graph from the top) the user has to applyalmost the same amount of force as in the stopped mode. The torque provided by themotor is determined to maintain a certain velocity which in this case is low due to thelow force needed to move the trolley forwards. Since the trolley uses freewheels, thewheels may rotate faster than the drive axle, which means the motor may not provideany help at all. Only the torque needed to overcome the gearbox friction (calculatedabove) is added. However, the user force needed in the acceleration phase is lower thanin stopped mode which gives a nice feeling when walking with the trolley.

    Integral velocity controller

    The integral velocity controller (third graph from the top) makes the user force smootherand lowers the average force applied to just over 20 N. However the time for the motorto reach the correct velocity is quite long which means the user won’t get any help whileaccelerating the trolley. When walking normally with no slope, the acceleration phaseis where most help is needed.

    Another drawback with the integral velocity controller is that it is very importantthat the trolley is started in walking position, i.e. when the user is holding the trolleywith a certain yaw angle. If this isn’t done the force needed to keep the trolley in thatyaw angle is seen as an error signal which the integral action compensates for. Hencethe steady state force is when the trolley pushes on the hand so that the total force onthe load cell is zero.

    48

  • 9.2. CONTROLLER RESULTS CHAPTER 9. RESULTS

    0 10 20 30 40 50 60 70 80 90 100 110−20

    0

    20

    40

    60Stopped controller (no help)

    Time [s]

    For

    ce [N

    ]

    User force

    0 10 20 30 40 50 60 70 80 90 100 110−20

    0

    20

    40

    60Proportional velocity controller

    Time [s]

    For

    ce [N

    ]

    User forceMotor force

    0 10 20 30 40 50 60 70 80 90 100 110−20

    0

    20

    40

    60Integral velocity controller

    Time [s]

    For

    ce [N

    ]

    User forceMotor force

    0 10 20 30 40 50 60 70 80 90 100 110−20

    0

    20