101
IN DEGREE PROJECT TECHNOLOGY, FIRST CYCLE, 15 CREDITS , STOCKHOLM SWEDEN 2018 Electric Longboard A dual-purpose personal vehicle LEO SÖDERGREN KTH ROYAL INSTITUTE OF TECHNOLOGY SCHOOL OF INDUSTRIAL ENGINEERING AND MANAGEMENT

Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

  • Upload
    others

  • View
    2

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

INDEGREE PROJECT TECHNOLOGY,FIRST CYCLE, 15 CREDITS

,STOCKHOLM SWEDEN 2018

Electric LongboardA dual-purpose personal vehicle

LEO SÖDERGREN

KTH ROYAL INSTITUTE OF TECHNOLOGYSCHOOL OF INDUSTRIAL ENGINEERING AND MANAGEMENT

Page 2: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Electric Longboard

LEO SODERGREN

Bachelor’s Thesis at ITMSupervisor: Nihad SubasicExaminer: Nihad Subasic

TRITA-ITM-EX 2018:72

Page 3: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding
Page 4: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

AbstractKeywords: mechatronics, personal transportation, electricvehicle, last mile transport, adaptive power management.

The aim of this thesis is to explore the possibility of adual-purpose electric vehicle. The vehicle should be ableto be used for both commuting and racing. It also aims todescribe different power limiting methods and their effecton performance. Lastly it hopes to see if the Swedish laws,as written today are reasonable. An electric longboard hasbeen constructed for this purpose and several tests havebeen performed.

A list of goals were set up for the board prototype. Theseincluded power output, running time, and that the boardshould have an audible warning device.

The findings demonstrated that all tested power limitingmethods worked and that the “Simple power limiting” methodprovided quickest movement over a fixed distance. Most ofthe goals were met by the prototype and the board’s twomodes worked as planned. While the law is reasonable itcan be improved to cover the diversity of electric vehicles.Further work may include better measurements and imple-mentation of a dual microcontroller system.

Page 5: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

ReferatElektrisk Longboard

Nyckelord: Mekatronik, personlig transport, elfordon, ”sistastrackan” transportmedel, adaptiv energidrift.

Syftet med detta arbete ar att testa mojligheten med etttva-lages personligt fordon. Fordonenet ska kunna anvandasfor bade pendling och tavling. Arbetet har aven testat olikaenergilimeteringsmetoder samt undersokt hur dessa meto-der paverkar prestandan. Arbetet har aven forsokt besvarafragan om det svenska lagarna, som det ar skrivna idag, arlampliga. En elektrisk longboard har konstruerats och fleratest utforts.

Ett antal malsattningar har definerats for prototypen. Des-sa inkluderar: effekt, kortid och att bradan bor ha en ring-klocka.

Resultaten visar att alla metoder fungerade och att “Simplepower limiting” var den som gav snabbast rorelse over denbestamda strackan. Det flesta av malen naddes av prototy-pen och bradans tva lagen fungerade som tankt. Dagens la-gar ar rimliga men kan forbattras for att tacka mangfaldenav elektriska fordon. Framtida arbete kan inkludera battrematningar och implementation av ett system med tva mikro-kontroller.

Page 6: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Acknowledgements

I would like to thank Rosalinn Aponte Persson for being my helping hand and testsubject.

I would also like to thank Nihad Subasic and Staffan Qvarnstrom for their help.

Lastly I would like to thank Axel Fyreskar, Olivia Ekman, Stefan Ionescu,Elizabeth Watson, and Tom Sodergren for their feedback and ideas.

Page 7: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Contents

Acknowledgements

List of Abbreviations

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Theory 32.1 The longboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Permanent magnet synchronous motor and speed controllers . . . . . 52.3 Longboard drive systems . . . . . . . . . . . . . . . . . . . . . . . . . 72.4 Battery technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.5 PPM and PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 Demonstrator 123.1 The system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2 Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.2.1 Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.2.2 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.2.3 LED matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.2.4 MCU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.3 Driveline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.3.1 Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.3.2 Batteries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.3.3 Parking brake . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.3.4 Power distribution . . . . . . . . . . . . . . . . . . . . . . . . 193.3.5 ESC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.4 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.4.1 Hand controller and receiver . . . . . . . . . . . . . . . . . . 21

3.5 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.5.1 The Deck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Page 8: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.5.2 Trucks and wheels . . . . . . . . . . . . . . . . . . . . . . . . 253.5.3 Lids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253.5.4 Lenses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.6 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4 Experiments 314.1 Acceleration and retardation test . . . . . . . . . . . . . . . . . . . . 314.2 Range test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.3 Light pattern measurements . . . . . . . . . . . . . . . . . . . . . . . 314.4 Light strength test . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.5 Parking brake test . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5 Findings 335.1 Acceleration and retardation . . . . . . . . . . . . . . . . . . . . . . 335.2 Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355.3 Light pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365.4 Light strength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385.5 Parking brake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6 Discussion and conclusion 396.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396.2 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7 Further work 42

Bibliography 43

Appendices 46

A Arduino code to control the board 47A.1 The main code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47A.2 Config code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

B Acceleration tests graphs 60B.1 Average mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60B.2 Running average cutoff . . . . . . . . . . . . . . . . . . . . . . . . . . 61B.3 Running average . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62B.4 Simple power limiting . . . . . . . . . . . . . . . . . . . . . . . . . . 63B.5 Race mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

C Matlab code to convert accelerometer data 65

D Matlab code to analyze light measurements 67

E Layout and schematic for the LED board 69

Page 9: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

F Layout and schematic for the power distribution board 70

G Layout and schematic for the voltage divider board 73

H Layout and schematic for the buzzer board 75

I Images of the completed board 76

J Images of the completed hand controller 82

K 3D model of the hand controller 84

L 3D model of the board 85

Page 10: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

List of Figures

2.1 A deck in red with the griptape in blue. Designed in Autodesk Fusion360 rendered in Blender. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 Exploded view of a truck. The hanger is marked blue, the connectingelements in red and the hanger in yellow. Made with Autodesk Fusion360. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3 Exploded view of a wheel assembly. The wheel is blue, bearings red andthe spacer yellow. Made with Autodesk Fusion 360. . . . . . . . . . . . 4

2.4 Back EMF for one phase in BLDC and BLAC motors. Drawn in AdobeIllustrator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.5 Simplified motor schematic. Drawn in Adobe Illustrator. . . . . . . . . . 72.6 Geared drive system [1]. Motor in grey, pulleys highlighted in orange

and belt highlighted in blue. Highlights drawn in Illustrator. . . . . . . 82.7 Expected cycle life corresponding to level of discharge [2]. . . . . . . . . 102.8 PPM and PWM signals over time correlating to an analog value. Drawn

in Adobe Illustrator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.1 System diagram. The orange lines are data and black, power. Drawn inAdobe Illustrator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.2 Light module PCB. Made with Adobe Illustrator and Autodesk Eagle. . 153.3 Render of Maytechs 90 mm hub motor. Made with Autodesk Fusion 360. 163.4 Cutaway drawing of the parking brake assembly. Servo arm in green, the

metal wire in blue and wire guide in red. Made with Autodesk Fusion360 and Adobe Photoshop. . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.5 Diagram of the board’s two voltage systems. Drawn in Adobe Illustrator. 203.6 Exploded view of the hand controller. The 3D-printed shell is in blue,

the 18650-battery in pink, the controller circuit board in grey and black,the buzzer circuit board in green and the buzzer is the black hexagon.Made with Autodesk Fusion 360. . . . . . . . . . . . . . . . . . . . . . . 22

3.7 Placement of the three compartments. Battery compartments in blueand the main compartment in orange. Drawn in Adobe Illustrator . . . 23

3.8 Exploded view of the deck’s structure. Made with blender and AdobeIllustrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3.9 Render of the main lid. The push-button is seen as black and red on thetop of the lid. Made in Autodesk fusion 360. . . . . . . . . . . . . . . . 25

Page 11: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.10 Render of the front lens. Note the 6 divots for the LED. Designed inAutodesk Fusion 360 rendered in blender. . . . . . . . . . . . . . . . . . 26

3.11 Flowchart for the ”Running average cutoff” function. Made with draw.ioand Adobe Illustrator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.12 Flowchart for the ”Running average cutoff” function. Made with draw.ioand Adobe Illustrator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.13 Flowchart for the ”Average” function. Made with draw.io and AdobeIllustrator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

3.14 Flowchart for the push-button interrupt function that changes betweenlight states. Made with draw.io and Adobe Illustrator. . . . . . . . . . . 29

3.15 Program main flowchart. Made with draw.io and Adobe Illustrator . . . 30

4.1 Test pattern for the lights. Drawn in Adobe Illustrator. . . . . . . . . . 32

5.1 Measured light pattern for the board’s headlight, generated in Matlab. . 365.2 Measured light pattern for the board’s taillight, generated in Matlab. . . 365.3 Measured light pattern for Lezyne Hecto Drive 300XL, generated in Mat-

lab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375.4 Measured light pattern for Lezyne Strip Drive, generated in Matlab. . . 37

E.1 LED module circuit board layout. Made in Autodesk Eagle . . . . . . . 69E.2 LED module circuit board layout. Made in Autodesk Eagle . . . . . . . 69

F.1 Power distribution circuit board top. Made in Autodesk Eagle . . . . . 70F.2 Power distribution circuit board bottom. Made in Autodesk Eagle . . . 71F.3 Power distribution battery connection circuit schematic. Made in Au-

todesk Eagle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71F.4 Power distribution voltage regulation circuit schematic. Made in Au-

todesk Eagle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72F.5 Power distribution VESC connection circuit schematic. Made in Au-

todesk Eagle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

G.1 Voltage divider circuit board layout. Made in Autodesk Eagle . . . . . . 73G.2 Voltage divider circuit schematic. Made in Autodesk Eagle . . . . . . . 74

H.1 Buzzer circuit board layout. Made in Autodesk Eagle . . . . . . . . . . 75H.2 Buzzer circuit schematic. Made in Autodesk Eagle . . . . . . . . . . . . 75

I.1 The completed board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76I.2 The underside of the completed board . . . . . . . . . . . . . . . . . . . 77I.3 Lid over battery compartment . . . . . . . . . . . . . . . . . . . . . . . 77I.4 The main compartment lid with the push-button. . . . . . . . . . . . . . 78I.5 The front of the board with the headlight. . . . . . . . . . . . . . . . . . 78I.6 The parking brake as seen from underneath the board. Note that the

wire guide is missing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

Page 12: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

I.7 The LED matrix displaying a battery cell error for cell 8. . . . . . . . . 79I.8 The LED matrix displaying an in-signal error. . . . . . . . . . . . . . . . 80I.9 The LED matrix displaying a checkered flag. . . . . . . . . . . . . . . . 80I.10 The board with its head and taillights lit. . . . . . . . . . . . . . . . . . 81

J.1 Side view of the hand controller. . . . . . . . . . . . . . . . . . . . . . . 82J.2 Front view of the hand controller. Note the push-button to activate the

AW-dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82J.3 Top view of the hand controller. . . . . . . . . . . . . . . . . . . . . . . 83J.4 The hand controller in a hand. . . . . . . . . . . . . . . . . . . . . . . . 83

Page 13: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

List of Tables

2.1 Comparison between battery technologies [3, 4, 5] . . . . . . . . . . . . 92.2 Recommended cutoff voltage for different technologies[6]. . . . . . . . . 9

3.1 Used LEDs characteristics [7, 8] . . . . . . . . . . . . . . . . . . . . . . . 143.2 Possible battery configurations [9]. . . . . . . . . . . . . . . . . . . . . . 18

5.1 Acceleration data from the different power modes. . . . . . . . . . . . . 345.2 Noted data from the range test. . . . . . . . . . . . . . . . . . . . . . . . 355.3 Measured angles and failures for the parking brake tests. . . . . . . . . . 38

Page 14: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

List of Abbreviations

AC – Alternating currentBLDC - Brushless direct currentBLAC - Brushless alternating currentDC – Direct currentEMF – Electromotive forceFOC - Field orientation controlIC - Integrated circuitLED – Light emitting diodeMDF – Medium density fibreboardPCB – Printed circuit boardPID – Proportional-integral-derivativeRC – Radio controlRGB - Red Green Blue

Page 15: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding
Page 16: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Chapter 1

Introduction

1.1 Background

A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding. It can have many benefits over more traditional modes oftransport: it is generally quicker and requires less effort than walking or running, itis portable so it can be brought inside, removing the need for roadside parking andlocks. The major drawback with longboards are their lack of brakes and that theyrequire a high grade of mobility from the user.

Electric “last mile” vehicles are growing in popularity in today’s urban environ-ment. “Last mile” refers to the smallest and often overlooked part of everydayurban commute; the last stretch from the bus or train to the door of the destina-tion. Several major cities are looking into the possibility of car-free city centers[10]. In March 2018 the Swedish government made it possible for municipalitiesto adapt new environmental zones to regulate which vehicles would be allowed totravel within these new zones [11]. The strictest zone, “class 3”, would forbid alltypes of petrol and diesel vehicles, which accounts for about 95% of new vehicles inSweden, 2015 [12].

In the summer of 2001 the Swedish government chose to redefine several streetvehicles [13]. The new definitions expanded on the category ”bicycles” to includeelectric vehicles. The new definition was followed by a regulation change from TheSwedish Transport Agency [14]. The regulation (TSFS 2009:31) states several re-quirements on electric vehicles such as maximum allowed speed, brake requirements,and illumination requirements.

An electric longboard combines the biggest advantages of both longboards andelectric vehicles. While electric longboards exist on the market, none follow theSwedish laws. They also have primitive ways of providing board status back theuser[1] [15].

1

Page 17: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 1. INTRODUCTION

1.2 PurposeThe purpose of this thesis is to explore the possibility of a dual purpose electricvehicle. The vehicle should be able to be used for both commuting and racing. Itwill examine different methods of power management to follow the above noted lawsand regulations. Other aspects of this thesis will be the construction of a safe, userfriendly vehicle prototype, while still providing adequate performance. The thesishopes to examine the following questions:

• How do different power limiting methods affect performance?

• What methods of power limiting are possible?

• Are todays laws and regulations reasonable?

• How can a street-legal board be constructed?

1.3 ScopeSince the thesis is done within a limited time frame, a substantial part of the thesiswas based on prior work.

• The motors, wireless transmitter/receiver, batteries, and battery charger havebeen purchased and used without modification.

• The speed controllers were purchased but have been configured.

• The hand controller was purchased but modified to follow the above notedregulations.

• The battery management system has not been implemented in the board.

• The deck has been constructed for this purpose, but the design and construc-tion was not fully documented.

• The lens system has been designed and constructed parallel to the work onthe board, but is not documented.

1.4 MethodA carbon fiber composite deck was constructed for the purpose of this thesis. Thedeck allows for the different components to be fitted while being protected from theenvironment. An Arduino microcontroller was used to monitor the board and con-vert the signal from the hand controller to the motor drivers. A power managementsystem was designed to safely offer power to the board’s different electrical systems.An LED matrix was used to provide feedback to the user. The completed boardwas used to test different power limiting methods and validate the concept.

2

Page 18: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Chapter 2

Theory

2.1 The longboard

A standard longboard’s components are:The deck-The deck is the actual board which the rest of the components are mounted to.This is the surface which the user interfaces with, to control the board. To improvetraction between the user’s shoes and the board, a layer of griptape, a type of sand-paper, is commonly glued to the board [16]. See Figure 2.1.

Figure 2.1. A deck in red with the griptape in blue. Designed in Autodesk Fusion360 rendered in Blender.

The trucks-The trucks are the connection between the wheels and the board. They are madeof two major parts with connecting elements between. See Figure 2.2. The majorparts are: The hanger that holds the axle and the baseplate, which is mounted to

3

Page 19: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 2. THEORY

the board. Together the parts convert the leaning of the board to a twisting of theaxles [17].

Figure 2.2. Exploded view of a truck. The hanger is marked blue, the connectingelements in red and the hanger in yellow. Made with Autodesk Fusion 360.

The wheels-The wheels are the connection between the vehicle and the road. Ball bearings arepressure fited into the hub of the wheel and a spacer can be used to lower the axialload on the bearings thus improving bearing life[18]. See Figure 2.3. Having biggerwheels make the board less susceptible to uneven terrain. The higher wheels canhowever add weight and raise the height of the board, making it more difficult forthe user to reach the ground.

Figure 2.3. Exploded view of a wheel assembly. The wheel is blue, bearings redand the spacer yellow. Made with Autodesk Fusion 360.

4

Page 20: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

2.2. PERMANENT MAGNET SYNCHRONOUS MOTOR AND SPEEDCONTROLLERS

2.2 Permanent magnet synchronous motor and speedcontrollers

There are two major kinds of brushless permanent magnet synchronous motors(PMSM), brushless DC motors (BLDC motor) and brushless AC motors (BLAC).Unlike brushed motors these brushless motors need an electric controller, commonlyknown as an “electric speed controller” (ESC), to generate the alternating currentsneeded for each phase[19].

A synchronous motor is when the rotation of the magnetic field matches the ro-tation of the rotor. The motor can be run with or without feedback. Withoutfeedback, the ESC has no way of knowing if the motor is spinning or how fast themotor is spinning. This makes motors without feedback very susceptible to stallingduring changing loads. Stalling occurs when the rotation of the magnetic field fallsout of sync with the rotation of the rotor, thus resulting in a loss of torque. Withfeedback, the ESC can continuously monitor the rotor’s position and thereby controlthe rotation of the magnetic field accordingly. Some methods of providing feedbackare: Back EMF and Hall effect sensor [20].

Back EMF measures the voltage generated by the relative rotation between themagnetic field and the motor’s windings. This requires the motor to run as a gen-erator for a short time and will not work when the motor is stationary since norelative motion is present. Back EMF requires a more complex ESC to be able tomonitor each phase’s voltage but can be used on any motor [21, 19]. This methodmay be called “sensorless” since no external sensors are needed.

The hall effect sensor method uses sensors placed around the motor’s peripheryto accurately define the rotor’s position. The hall effect sensors measure the mag-netic field of the rotor’s magnets. This method needs at least one extra sensorwith its own power to be able to tell the motor’s rotational frequency and there-fore speed. By placing several sensors with different spacing around the stator, arelatively precise position can be read. This solution gives high precision feedbackwhich gives good low speed torque [22].

The major difference between the BLDC and BLAC motors are the back EMFgenerated when the motor is spun by an external force. The back EMF generatedby the BLDC is trapezoidal, whereas the back EMF of the BLAC is sinusoidal.While a BLDC motor can be driven with a sinusoidal ESC the BLAC motor willhave higher mechanical losses if run with a BLDC driver. Figure 2.4 shows the backEMF for both types of motors. The driver needed for BLDC are generally simplerand may be more efficient than the that of BLAC drivers [23]. While in theory theideal BLDC and BLAC could have a constant torque the actual motors have somevariation. In general the BLAC have a lower amount of torque variation leading to

5

Page 21: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 2. THEORY

less noise while in operation [19, 24].

Figure 2.4. Back EMF for one phase in BLDC and BLAC motors. Drawn in AdobeIllustrator.

Since the motors can have more than one pole per winding, the motors may runat a different frequency, fmec, than that of the electric frequency, fel. The totalamount of motor poles, p, will determine the ratio between the two frequencies [20].

fmec = fel · 2p

(2.1)

Further the rotational speed of the motor, ωmec will be a result of the electrical“rotational speed”, ωel.

ωmec = ωel · 2p

(2.2)

A generalized equation for the mechanical output power, Pmec, of a BLAC motor isdepending on the current, I, and mechanical efficiency cosϕ [20]. A schematic canbe seen in Figure 2.5.

Pmec = 3 · Eph · I cosϕ (2.3)Here Eph is the back EMF generated by a phase for a certain rotational speed. Thisdepends on the motor’s voltage constant ΨR [20].

Eph = ΨR · ωmec (2.4)

To measure the voltage constant the motor’s generated voltage must first be mea-sured. Without having the motor connected to anything but a multimeter betweentwo phases, the generated voltage will be that of the back EMF since little to nocurrent will go through the motor windings.For three phase sinusoidal machines the voltage between two phases Ub can de-scribed by the following formula. Further the formula for the voltage constant, ΨR,can be defined by the back EMF between two phases, Eb.

Ub =√

3Uph (2.5)

6

Page 22: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

2.3. LONGBOARD DRIVE SYSTEMS

Figure 2.5. Simplified motor schematic. Drawn in Adobe Illustrator.

ΨR = Eb√3 · ω

(2.6)

The variable cosϕ is a result of the inductive voltage, ωel · LI, the restive voltageRI as well as the back EMF[20].

cosϕ = cos(

arctan( ωel · LIRI + Eph

))(2.7)

To calculate the resistance of each phase, R, the total resistance between two phases,Rtot, can be measured and divided.

R = Rtot

2 (2.8)

Similarly, the inductance can be measured between two phases, Ltot, to calculatethat of each phase L.

L = Ltot

2 (2.9)

2.3 Longboard drive systems

There are two major kinds of drive systems for electric longboards, in-wheel motors(hub motors) and external motors with pulley gearing.Geared drives such as those of Boosted Inc have the motors mounted parallel to thewheels with a smaller geared pulley on the motor and a bigger pulley on the wheel,see figure 2.6.

7

Page 23: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 2. THEORY

Figure 2.6. Geared drive system [1]. Motor in grey, pulleys highlighted in orangeand belt highlighted in blue. Highlights drawn in Illustrator.

Hub motors are constructed with the motor built into the wheel. This significantlysimplifies the mechanical construction of the board. The hub motor design is alsoless susceptible to dirt and water since the motor is within the wheels. InboardTechnology utilizes this in their board M1 [15]. The gearing of the geared drivecan give a higher torque than the hub motors, thus giving better performance whilebraking and accelerating. While having higher torque, the gearing is reported tofeel ”like riding an angry wild animal” [25] and may result in a lower top speed.

2.4 Battery technology

For electric vehicles, battery technologies with high specific energy and energy den-sity is preferable. Keeping the weight and size of the batteries down can lead tohigher efficiencies due to lower frictional losses.

A battery is built up of one or more cells. Each cell has an EMF which variesdepending on battery chemistry, charge, and other factors. For common lead acidbatteries (Pb), the nominal voltage is 2.1V [3]. By combining six cells in series thewhole battery will have a nominal voltage of 12.6V, this configuration is the stan-dard for car-starter batteries. While common, lead acid batteries do not possessoptimal characteristics with relatively low specific energy and energy density. Moremodern battery technologies such as lithium-ion (Li-ion) and lithium-ion polymer(Li-Po) offer higher energy density, higher specific energy, and also higher specificpower. Table 2.1 compares the technologies.

8

Page 24: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

2.4. BATTERY TECHNOLOGY

C-rate is the safe rate of discharge depending on the battery’s maximum capacity[26]. It is described with this simple formula:

Discharge rate[A] = maximum capacity · C rating (2.10)

By placing batteries in series, the safe discharge rate is unchanged but the total

Table 2.1. Comparison between battery technologies [3, 4, 5]

Technology Nominal voltage[V]

Specific energy[Wh/kg]

Energy density[Wh/L]

Specific power[W/kg]

Pb 2.1 35-40 80-90 250Li-ion 3.6 150-180 200-350 315-800Li-Po 3.7 155 220 260

voltage will be increased. While placing the batteries in parallel will increase thesafe discharge rate and the total power capacity.

Terminal voltage is the voltage of the battery when measured across the poles witha load applied. This voltage is strongly dependent on the load and on the battery’sinternal resistance. A battery’s internal resistance is the major contributor to bat-tery losses.

A battery’s cutoff voltage is the voltage when the battery is considered “empty”[26]. Even though a battery might be at its cutoff voltage the battery may stillhave a significant charge. This when the load is high on a battery with high inter-nal resistance. The high current and high internal resistance will lower the battery’sterminal voltage leading to a lower measurable voltage [20]. Table 2.2 shows differ-ent cutoff voltages for different technologies.

Table 2.2. Recommended cutoff voltage for different technologies[6].

Recommendedcut off voltage

Li-ion/Li-Po[V/cell]

Lead acid[V/cell]

Normal load 3.0-3.3 1.75Heavy load 2.7 1.4

The state of charge (SOC) is an expression of the battery’s current level of dis-charge: It is the remaining percentage of the maximum capacity. The opposite toSOC is depth of discharge (DOD), and indicates the percentage the battery hasbeen discharged to. [20, 26].

9

Page 25: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 2. THEORY

While common lead acid batteries are relatively safe, some lithium-based batterytechnologies have tendencies to combust when improperly handled [27, 4]. In recentyears stories about batteries catching fire have surfaced [28, 29]. The US FederalAviation Administration has compiled a list of over 80 known accidents involvinglithium-technology batteries [30].To minimize the risks associated with Li-ion technology batteries a few points shouldbe considered:

• The batteries are not supposed to be charged above 4.2V [31].

• The battery’s temperature should never exceed 90°C [31].

• The batteries should never be discharged at a rate higher than they are ratedfor [32].

Lastly, cycle life is the number of times a battery can be charged and discharged.The problem with the cycle life is that it is very dependent on level of discharge.A battery that is only discharged to 10% DOD may handle over a thousand cycleswhile a battery discharged to 90% DOD might only handle a hundred [20]. Figure2.7 shows the relationship between DOD and cycle life for a lead acid battery, similarresults can be expected for the modern battery technologies [33].

Figure 2.7. Expected cycle life corresponding to level of discharge [2].

10

Page 26: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

2.5. PPM AND PWM

2.5 PPM and PWMPulse position modulation (PPM) and Pulse width modulation (PWM) are bothmethods of signaling analog data through a digital interface [20, 34]. Both methodsare based on a set frequency but use different methods of signaling the data. PWMuses a differing signal length to define the analog value while PPM uses the positionof the pulses to signal the analog value. Figure 2.8 shows the different signals.

For common RC servos the frequency is 50Hz corresponding to period time of

Figure 2.8. PPM and PWM signals over time correlating to an analog value. Drawnin Adobe Illustrator.

20ms. A 2ms pulse represents a 100% value while 1.5ms pulse represents a neutralvalue (50%) and 1ms pulse a low value (0%) [35]. The two types of signals can begenerated by an MCU either by “bit banging” or with signal generating hardware.Bit banging refers to the act of signal generation with software, this method is easyto implement but can be more computationally intensive and might be less stable.

11

Page 27: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Chapter 3

Demonstrator

The project has a list of goals which it has tried to reach. These goals are basedon safety (following the above noted laws and regulations). The aim was also tocreate a prototype electric board with advanced user feedback functions and to makethe ride as practical and comfortable as possible. These goals were (goals with anasterisk are required by law):

• *Maximum speed (street mode): 20kmh, 5.56m/s.

• *Maximum continuous motor power (street mode): 250W.

• *The board must be able to brake at 3m/s2. The braking system should befunctionally safe during normal operating conditions.

• *The board should have a parking brake that can keep the board stationaryon a 15° incline, even without electrical power. This brake should not be adanger to the user if accidentally engaged.

• *The board should have white lights forward and red lights backwards thatcan be clearly seen from 300m. The lights cannot be blinding or must be ableto be dimmed quickly.

• *The board should have an audible warning device (AW-dev).

• The board should be able to monitor the batteries to allow safe usage.

• The board should be able to run at full power (street mode) for at least halfan hour.

• The board’s components should be protected from the environment.

3.1 The systemThe board has several components that all need to work together for the board tofunction properly. Figure 3.1 shows how these components work together.

12

Page 28: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.1. THE SYSTEM

Figure 3.1. System diagram. The orange lines are data and black, power. Drawnin Adobe Illustrator.

The components are grouped into four subsystems:

Logic – Lighting, sensors, LED matrix, and MCU. The logic monitors and pro-vides feedback to the user. It also controls the mode, converts the signal for correctpower output, and turns off/on the lights.

Driveline – Motors, batteries, parking brake, power distribution, and ESC. Thedriveline is responsible for the propulsion of the board.

Control – Controller and receiver. The control has to be easy and comfortableto use while providing exact control signals.

Structure – Deck, trucks, wheels, lids, and lenses. The structure is the basewhich the rest is assembled on. It protects the components from the environment.It also incorporates the lenses that protect the LED circuit boards while directingthe light.

13

Page 29: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

3.2 Logic

3.2.1 LightingTo minimize the number of components needed for the board, an module was de-signed for use as both headlight and taillight. A Texas Instruments TL4242 ad-justable LED driver was used. The driver can directly control a series of LEDs witha PWM signal. For the actual LEDs Osram’s OSLON® series LEDs were chosen.The specific number and characteristics of the chosen LEDs can be found in table3.1.

Table 3.1. Used LEDs characteristics [7, 8]

For use Color Serial number Forward voltageVF [V]

Forward currentIF [mA]

Headlight White GW CS8PM1.PM 2.85 350Taillight Red LJ CKBP-JZKZ-25 2.15 350

The PCB can be seen in Figure 3.2. See Appendix E for the circuit board’s layoutand schematic.

The LED driver uses a resistor in series with the LEDs to monitor the current.The formula to determinate the current out of the driver, Iout, relies on the internalreference voltage, Vref and the resistor’s value, Rref [36].

Iout = Vref

Rref(3.1)

Rref = Vref

Iout(3.2)

The TL4242’s internal voltage is typically 177mV and both types of LEDs need aforward current of 350mA.

Rref = 177350 = 506mΩ (3.3)

Since 506mΩ is an uncommon value a 510mohm resistor was used. The current istherefore, according to 3.1:

Iout = 177510 = 347mA (3.4)

The power dissipated by the resistor, PRdis, is:

PR dis = I2out ·Rref = 0.3472 · 0.51 = 0.061W (3.5)

14

Page 30: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.2. LOGIC

To minimize the power dissipated by the driver, PD dis the driver is connected toone battery giving an maximum input voltage, Vin, of 21V.

The forward voltage of the series of LEDs has to be less than the input voltage. Forthe red taillight eight LEDs are used. For the white LEDs six in series are used andtwo LEDs positions are bypassed, this is done with a ”solder jumper” on the board.Since the driver provides a constant current the number of LEDs does not affectthe current over each LED. The white and the red LED have forward voltages of17.1V and 17.2V respectively.

Figure 3.2. Light module PCB. Made with Adobe Illustrator and Autodesk Eagle.

3.2.2 SensorsTo monitor the batteries a simple voltage divider board was constructed. The volt-age divider is connected to six of the batteries’ cells. The voltage dividers convertthe high voltage of the battery cells to a predictable lower voltage, which can besafely measured with an MCU. See Appendix G for the voltage divider’s circuitboard’s layout and schematic.

Originally digital temperature probes were supposed to monitor battery and motortemperatures, this proved hard to implement with a single MCU and was thereforeomitted.

3.2.3 LED matrixAn 8x8 RGB LED matrix was chosen to provide feedback to user. The matrixis an Adafruit design rebranded as Luxorparts [37, 38]. All LEDs are individuallyaddressable which makes it possible to show graphics and text. Since the used MCUlacks the needed protocol a “bit-banging” approach is used. This however limitsmatrix updates to times when the board is stationary. Each LED can use up to60mA. The maximum total consumption is just under 4A [39]. The LED matrixshowing ”cell error” can be seen in Appendix I.

3.2.4 MCUThe MCU used in the board is an Arduino mega 2560. It was chosen for its relativelylarge usable flash memory of 248KB [40]. It also provides more than enough outputsand inputs.

15

Page 31: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

3.3 Driveline

3.3.1 MotorsTo validate that the motors would be able to brake with enough force, the requiredforce was determined. With a retardation, aret, of 3 m/2 an 80 kg user, musr, wouldneed a braking force according to this equation:

Fbrake = musr · aret = 80 · 3 = 160N (3.6)

Further the braking effect, Pbrake, is dependent of the speed, v. It is the highest atthe maximum speed. The highest needed braking effect is therefore:

Pbrake = Fbrake · V = 160 · 5.56 = 880W (3.7)

Two MTO9055-HBM-60-HA hub motors from Chinese Maytech Electronics Co, Ltdwere chosen. The hub motors were chosen for their simplicity and large diameter.They also have hall effect sensors built in. The motors are 90 mm in diameter andhave a rated power of 800 W which gives a total power of 1600 W. A rendering ofthe motor can be seen in Figure 3.3. The motors are also rated for 22 A and 36 V.Their voltage constant is ΨR = 1/60 V/rpm , 1/2π (V s)/rad [41].

Disassembly found that the motor has 24 poles. The ratio between the electrical ro-tational speed and mechanical rotational speed is therefore according to formula 2.2

ωmech

ωel= 1

6 (3.8)

Figure 3.3. Render of Maytechs 90 mm hub motor. Made with Autodesk Fusion360.

16

Page 32: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.3. DRIVELINE

For a top speed of 20kmh (5.56m/s) the wheel and motor has to rotate at a rotationalspeed of 123.5 rad/s and the electrical field at 370.5 rad/s. The motor’s EMF atthe top speed is according to equation 2.4

Eph = 1π· 123.5 = 19.66V (3.9)

Measurements on the motor found that the winding resistance R is 62.5mΩ and theinductance L is 13.8µH. With all needed variables known, the factor cosϕ could becalculated according to formula 2.7. A current of 22A is assumed.

cosϕ = cos(

arctan( 370.5 · 13.8 · 10−6 · 22

62, 5 · 10−3 · 22 + 19.66

))= 0.999986 (3.10)

This proves the high efficiency of the motors with almost all electric power convertedinto mechanical effect. This also means that the continuous electric power may notexceed 250W as required by the law.

17

Page 33: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

3.3.2 BatteriesTo keep the scope of the project within the time constraints, commercially availablehobby RC Li-Po batteries have been used.

The maximum continuous power at street mode is 250W. For half an hour thetotal power consumption, Wh1h, comes to 125Wh. A 10-cell battery was chosenfor its nominal voltage of 37V. To keep the batteries’ cycle life high, an maximumdischarge of 80% is allowed.

The batteries’ energy content, Wh, is calculated by using the maximum alloweddischarge. To calculate the required capacity, Ah1h, the highest nominal batteryvoltage was used:

Wheff = Wh

0.8 = 156.25Wh (3.11)

Ah0.5h = Wh

Vnom= 156.25

37 = 4.22Ah (3.12)

Since Li-Po batteries are only available in some common configurations the finalbattery pack was based upon one of these. Hong Kong based Hobbyking was usedas a source of configurations. A safe discharge rate of 20C is assumed. Table 3.2 hassome possible configurations, based both on available batteries and the calculatedcell count and capacity.

The batteries have to be charged individually and have to fit within the board.

Table 3.2. Possible battery configurations [9].

In se-ries

Inparal-lel

Cells perbattery

Capacityper bat-tery

Totalcapac-ity

Totalcurrent

Totalenergycapacity

Totalamount ofbatteries

2 1 5 5.0Ah 5.0Ah 100A 185Wh 22 2 5 3.0Ah 6.0Ah 100A 222Wh 45 1 2 5.0Ah 5.0Ah 100A 185Wh 55 2 2 3.0Ah 6.0Ah 120A 222Wh 10

The two-battery configuration was chosen. Due to availability 25C batteries werepurchased, giving an maximum safe discharge rate of 125A.

18

Page 34: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.3. DRIVELINE

3.3.3 Parking brake

The major technical challenge with the parking brake was how the brake shouldengage. If constructed incorrectly the brake might accidently stop the board whileat speed. If this happens quickly the user can be thrown off the board.

A servo was chosen to actuate a small metallic wire. The wire interlocks in oneof the front wheel’s hub, this locks the wheel and immobilizes the board. See Fig-ure 3.4. An image of the parking brake can be found in Appendix I.

Figure 3.4. Cutaway drawing of the parking brake assembly. Servo arm in green,the metal wire in blue and wire guide in red. Made with Autodesk Fusion 360 andAdobe Photoshop.

While the wire is dimensioned to lock the wheel when stationary the wire is softenough to be bent if actuated while the board is moving.

3.3.4 Power distribution

The board has two different power systems since several components utilize a lowervoltage than the motor system. A power distribution was made to safely distributethe power and convert the high voltage from the batteries to the lower voltage suit-able for some of the board’s components. The structure is shown in Figure 3.5.

19

Page 35: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

Figure 3.5. Diagram of the board’s two voltage systems. Drawn in Adobe Illustra-tor.

Originally an IC was chosen to convert the voltage, but was ommited due to a thec-nical mishap. Two converter modules were purchased, connected, and calibratedfor the 5V needed for the low voltage components. These modules are capable ofconverting up to 3A each [42].

Even though the batteries can handle up to 100A continuous discharge the boardshould not be able to consume that much. A high voltage automotive 50A fuse isimplemented on the power distribution board. A kill switch strap is also imple-mented, by pulling a cord the user can quickly cut the power to the ESC’s. SeeAppendix F for the power distribution board’s layout and schematic.

3.3.5 ESCBenjamin Vedder’s VESC was chosen for its availability and ease of use. One wasused per motor. Each VESC is specified for a continuous power output of 50A at60V [43]. The VESC has several different methods for controling, monitoring, andpowering the motor. The control and power methods were configured using theVESC Tool software [44].

The control methods are:

PID Speed – The controller simply sets the desired speed and the ESC triesto match it.

Current – The controller sets the desired current.

Duty cycle – The controller sets the desired switching duty cycle, the higher theduty cycle the higher the voltage.

20

Page 36: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.4. CONTROL

Early tests demonstrated the current control method most intuitive. Both PIDspeed control and duty cycle control would accelerate quickly and then freewheel,jolting the user, back and forwards. While this can be fixed by changing rampingvariables, these control methods provided no overwhelming advantage over cur-rent control. Current control gives a similar experience to an accelerator and brake,needing a little extra input to get the board going and to hold the speed going uphill.

The power methods are:

BLDC – As noted in section 2.2 this method powers the motor as a BLDC.

FOC – Stands for “Field Orientation Control” this method powers the motor as aBLAC.

DC – This method is for DC motors and is therefore not applicable.The chosen motors had a sinusoidal back EMF, therefore the FOC setting was cho-sen. Tests with BLDC settings resulted in much louder electrical noise from themotors.

For FOC the possible monitoring methods are:

Sensorless – As described in section 2.2.

Hall Sensors – As described in section 2.2.

Encoder – For external encoders.

Since the motors already have built-in Hall effect sensors, this method was used.VESC Tool software has a built-in detection mode that was used to find the posi-tions of the hall effect sensors. The rest of the settings were set up according to themotors’ and batteries’ specifications.

3.4 Control

3.4.1 Hand controller and receiver

To control the board, a controller and receiver was needed. Maytech’s MTSKR1712receiver/controller combination was chosen. It utilizes two-way 4GHz communica-tion between the controller and receiver and swaps channel automatically to mini-mize the risk of interference [45]. The signal that the receiver sends was found to bea PWM signal. The VESC was therefore configured in PPM mode (which acceptsPWM signals) to properly receive the signal.

21

Page 37: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

By moving a spring-loaded lever back or forth the user can control the board.Pressing the lever forward the board accelerates. Letting the lever spring back tocenter lets the board roll freely and pulling the lever backwards applies the brakes.The signal is analog. This means that the user can set the level at which the boardwould accelerate/brake.

Since an AW-dev was needed, a buzzer with internal oscillator was purchased. Thebuzzer, Mallory MSO206NR, works with voltages between 2 and 6V [46]. A sim-ple circuit board connects the buzzer directly to the battery with a push-buttonto activate the buzzer. See Appendix H for the buzzer circuit board’s layout andschematic. Since the included battery is quite small an 18650 cell was added toimprove the controller’s battery life.

To fit all the parts within the controller a new 3D-printed shell was designed. Anexploded view of the controller design can be seen in Figure 3.6. See Appendix Jfor images of the hand controller. See Appendix K for a 3D model of the handcon-troller.

Figure 3.6. Exploded view of the hand controller. The 3D-printed shell is in blue,the 18650-battery in pink, the controller circuit board in grey and black, the buzzercircuit board in green and the buzzer is the black hexagon. Made with AutodeskFusion 360.

22

Page 38: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.5. STRUCTURE

3.5 Structure

3.5.1 The DeckSince the board has multiple components that need to be housed and protectedfrom the environment, a custom deck was designed and built. The board has threemain compartments, one for each battery and one for the main electronics. Thecompartments are shown in Figure 3.7. The deck utilizes modern materials and

Figure 3.7. Placement of the three compartments. Battery compartments in blueand the main compartment in orange. Drawn in Adobe Illustrator

construction methods to keep the weight low. The deck’s structure is shown inFigure 3.8. Note how the printed parts mesh with the foam through dovetail joints.See Appendix L for a simplified 3D model of the board. See Appendix I for imagesof the completed board. The whole board without any components weighs about2000g this is comparable to similarly wooden sized boards [47].

The board also has mounts and electrical conduits to allow the headlights andtaillights to be mounted at the front/back of the board. On the right side of theboard a 3D-printed holder for the kill switch cord is present.

To allow the LED matrix to be seen, a patch on the top of the board has beenconstructed in translucent materials. See Appendix I for images of the matrix litthrough the board.

23

Page 39: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

Figure 3.8. Exploded view of the deck’s structure. Made with blender and AdobeIllustrator

24

Page 40: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.5. STRUCTURE

3.5.2 Trucks and wheelsTo allow the back wheels (motors) to be mounted, a special truck was needed.Normal trucks are designed to let the wheels spin freely while the motors needto have the stator locked. Maytech MTSKT1614B that lock the stators was usedfor the back truck and Maytech MTSKT1614F for the front. For the front wheelsMaytech MTSKW1614 were chosen to match the diameter of the back wheels.

3.5.3 LidsTwo lids were made, one to cover and hold the batteries and one to cover theelectronics. The lid that covers the electronics also has momentary push buttonwith a LED built-in. A render of the electronics lid can be seen in Figure 3.9. Theywere made by vacuum forming, a process where a heated plastic sheet is pulleddown on a form using vacuum. The sheet is allowed to cool and harden. Then theexcess plastic is removed.

Figure 3.9. Render of the main lid. The push-button is seen as black and red onthe top of the lid. Made in Autodesk fusion 360.

25

Page 41: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

3.5.4 LensesTwo lenses were designed and constructed out of a transparent plastic. They incor-porate simple spherical lenses to direct the light. A render of the front lens can beseen in Figure 3.10.

Figure 3.10. Render of the front lens. Note the 6 divots for the LED. Designed inAutodesk Fusion 360 rendered in blender.

3.6 SoftwareThe final part of the board was the software. The software is responsible of con-trolling the lights, LED matrix, parking brake, monitoring the batteries and con-trolling/monitoring the board’s power output.

To read the signal from the receiver, the MCU utilizes a simple interrupt func-tion. When the PWM signal changes state, e.g. goes from a low to a high voltage,a timer starts. Next time the signal changes the timer stops. The time taken is thelength of the pulse and therefore proportional to the analog signal value. To sendthe signal to the VESCs, the MCU simply sends a high pulse with a correspondinglength to the desired throttle/power output.

Switching between modes is done by pressing and holding the push-button whileconnecting the battery, this is to minimize the risk of changing modes unintention-ally. While in “Race mode” the LED matrix displays a checkered race flag symbol.

In the “Race mode” the board simply forwards the in-signal to the ESCs, thisis called “Normal throttle” since no conversion occurs.

During “Street mode” the MCU checks the in-signal and, depending what modethe throttle is in, it goes in to one of three functions. If the in-signal is outside aspecified value range the LED matrix displays an error symbol.

26

Page 42: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.6. SOFTWARE

If the throttle is neutral the board runs a “Neutral function”. If the throttle isleft in neutral position for a set number of cycles the board enters into monitoringmode. This is only done in “Street mode”. During monitoring mode, the boardchecks the battery voltages. If a cell is outside the normal voltage range the matrixshows an error symbol indicating which cell. All error symbols can be found inAppendix I.

If the throttle is less than neutral the MCU runs the “Brake function”, in thisfunction the board forwards the in-signal to the ESCs.

Lastly if the throttle is forward the MCU runs the “Power check functions”, thesefunctions monitor and controls the board’s power continuously. The monitoring ofthe power output is done by the MCU communicating with one VESC.

Four power control methods were tested:

Simple power limiting – here each VESC was set for a maximum power out-put of 125W. This was done with the board in “Race mode”.

Running average cutoff - here the Arduino monitored the board’s output andcut off the power if the running average exceeded 250W. The function’s flowchartcan be seen in Figure 3.11.

Running average - here the Arduino monitored the board’s power and limitedthe power if the running average exceeded 250W. The function’s flowchart can beseen in Figure 3.12.

Average - here the Arduino monitored the board’s power and limited the power ifthe average over a certain period exceeded 250W. The function’s flowchart can beseen in Figure 3.13.

Turning on and off the lights is done by pressing the push-button after startup.When the throttle is set to brake, the taillight turns on or is set to a higher level toindicate that the board is applying its brakes.

The flowchart of the main program is Figure 3.15 and the push-buttons interruptfunction flowchart is Figure 3.14.

The code was written as two files, one with the main program and functions andone with the variables needed. See Appendix A for the code.

27

Page 43: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

Figure 3.11. Flowchart for the ”Running average cutoff” function. Made withdraw.io and Adobe Illustrator.

Figure 3.12. Flowchart for the ”Running average cutoff” function. Made withdraw.io and Adobe Illustrator.

28

Page 44: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

3.6. SOFTWARE

Figure 3.13. Flowchart for the ”Average” function. Made with draw.io and AdobeIllustrator.

Figure 3.14. Flowchart for the push-button interrupt function that changes betweenlight states. Made with draw.io and Adobe Illustrator.

29

Page 45: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 3. DEMONSTRATOR

Figure 3.15. Program main flowchart. Made with draw.io and Adobe Illustrator

30

Page 46: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Chapter 4

Experiments

To compare the power control methods and verify the prototype board a few ex-periments were conducted.

4.1 Acceleration and retardation test

To test the different power control methods the board was tested over an 80mstretch. A 65kg rider started from standstill. The rider began by setting the controlto fully forward, and then set the control to full brake to stop at the 80m mark. Thiswas done at least 4 times per mode alternating direction each time. A cellphonewith a K6DS3TR Acceleration Sensor was held horizontal during the test. Theacceleration data was logged. Lastly the data for acceleration in the horizontalplane was calculated and filtered in Matlab. See Appendix C for the Matlab code.

4.2 Range test

The board was used twice for commutes. The distance and time were logged. Atthe end of the ride the batteries voltages were written down. Also, the elevationgain and loss were noted. From the battery voltages an estimate of the used energywas made. This combined with the time made calculation of the average powerconsumption possible.

4.3 Light pattern measurements

The board’s headlight/taillight was placed 600mm from a flat wall. A measuringpattern was drawn on the wall. The measurement pattern has 9 points, both onthe vertical and horizontal axis as well as above the horizontal axis. The measuringpattern can be seen in Figure 4.1. The lights were turned on at a known strength.A cellphone with an AMS AG TMD49XX RGB sensor was used to measure theilluminance at each point. The test was repeated with Lezyne Hecto Drive 300XL

31

Page 47: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 4. EXPERIMENTS

bicycle headlight and a Lezyne Strip Drive bicycle taillight. Lastly the data wasloaded into Matlab and the whole field was interpolated using a cubic method.

Figure 4.1. Test pattern for the lights. Drawn in Adobe Illustrator.

4.4 Light strength testA straight piece of road was used to measure at which point the lights could not beseen. The board’s lights were set to 25% and then 100%. The board’s were run inboth directions and as far as could be seen.

4.5 Parking brake testA simple servo actuation program was uploaded to the MCU. The board was placedon an MDF sheet with the parking brake applied. One edge of the sheet was slowlylifted and when the board started moving the angle was noted. The failure modewas also noted: sliding or mechanical failure. The tests were done twice, initiallywith the board’s direction facing the top of the sheet and a second time with theboard’s direction facing down. The test was repeated with the grip tape facingdown onto the MDF sheet.

32

Page 48: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Chapter 5

Findings

5.1 Acceleration and retardationOnly one result per mode is shown in Table 5.1. See Appendix B for all the accel-eration graphs.

The acceleration and retardation tests showed that the “Simple power limiting”and “Average” control methods were the fastest to cover the 80m. Both the “Run-ning average” methods proved to have jerky acceleration where the board wouldaccelerate intermittently. “Simple power limiting” method was the quickest.While data shows that the board decelerated at a rate of above 3.0m/s2 during mosttests, the slower tests did not reach this retardation goal.

33

Page 49: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 5. FINDINGS

Table 5.1. Acceleration data from the different power modes.

Simple power limiting: Running average cutoff:

Running average: Average:

34

Page 50: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

5.2. RANGE

5.2 RangeThe result of the two tests are shown in Table 5.2. Some things were noted duringthe range tests: During hill climbs and when going against the wind the boardneeded more throttle input. During the first ride the parking brake got accidentlyapplied while moving. While the wire, described in section 3.3.3, went into thewheel it did not lock the wheel, instead it bent as supposed, allowing it to be bentstraight later.

Table 5.2. Noted data from the range test.

Ride # Length[km]

Time[min]

Climband Fall[m]

Battery1 [V]

Battery2 [V]

Usedbatterypower[Wh]

Averagepower con-sumption[W]

1 8.5 34 52/54 18.5 19.0 ˜95 ˜170

2 14.5 53 111/123 14.2 17.7 ˜150 ˜175

35

Page 51: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 5. FINDINGS

5.3 Light patternThe interpolated data is shown in Figures 5.1 to 5.4. The actual measurements areshown in the Matlab code as Appendix D.

Figure 5.1. Measured light pattern for the board’s headlight, generated in Matlab.

Figure 5.2. Measured light pattern for the board’s taillight, generated in Matlab.

36

Page 52: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

5.3. LIGHT PATTERN

Figure 5.3. Measured light pattern for Lezyne Hecto Drive 300XL, generated inMatlab.

Figure 5.4. Measured light pattern for Lezyne Strip Drive, generated in Matlab.

The test shows that the bicycle headlight has a more condensed light pattern andthat the bicycle provides more light straight forward. The light from the taillightof the board is instead more condensed and brighter than that of the bicycle light.

37

Page 53: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 5. FINDINGS

5.4 Light strengthThe light range test showed that the board can be seen with 25% or 100% lightintensity from over 850m. This is beyond the required distance of 300m. At 100%light intensity the light was blinding but at 25% the blinding was minimal.

5.5 Parking brakeThe noted data from the parking brake test can be seen in table 5.3.

Table 5.3. Measured angles and failures for the parking brake tests.

Test Angle [°] Failure

Board facing up, uphill 5.2 Bent wire

Board facing up, downhill 5.5 Bent wire

Board facing down, uphill 20.7 Sliding

Board facing down, downhill 23.1 Sliding

38

Page 54: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Chapter 6

Discussion and conclusion

6.1 Discussion

The biggest challenge with the construction was fitting all the board’s components.While the final board can house everything, working on the board leaves a lot to bedesired in terms of space. The lids’ ability to keep dust out of the compartmentswas underwhelming.

The numbers read from the VESC did not match the ones read from the VESCTool. The implemented fix was a simple converting factor that was calculated froma few readings, this combined with the slow sampling rate might give inaccuratevalues. By only looking at the power output of one VESC, the power output mayover/undershot the allowed power.

For the acceleration/retardation tests the user’s ability to hold the cellphone stablemay have influenced the results. If the cellphone was not completely horizontalthe earth’s gravitational acceleration may have raised the calculated acceleration.This may have contributed to the variations between tests. The stopping point wasnot always perfect. This along with human reaction times can have influenced themeasured time for each test. The lower retardation rate at lower speeds is probablya result of the motors’ not being able to generate the same amount of power. Thisis because of the lower generated voltage.

Since the legal power output is so low, electric vehicle companies might not want toinclude stronger motors, this would hinder the vehicle’s performance. If the motorpower is too low the vehicle cannot use EMF to brake and would have to rely onmechanical brakes. Mechanical brakes add to the amount of particulates in the airwhich can be a health concern [48].

While the range tests monitored the final battery voltages, continuous monitor-ing would be desired. Climbing hills and going against the wind seemed to use a lot

39

Page 55: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

CHAPTER 6. DISCUSSION AND CONCLUSION

more current and therefore power, but without continuous monitoring, it is hard toconfirm. Calculating used energy from the battery voltages is not the most exactway of monitoring the used energy. The VESC has built-in energy drawn monitor-ing but this was not read after the tests.

While the monitoring of the power output worked, the rate at which it did wasquite slow. This may have contributed for the overshoots during the “running av-erage” and “running average cutoff” tests.

For the light tests, more test points might give a better picture over the totallight pattern, specially more points under the horizontal axis. The parking braketests would probably be different on different surfaces. The law requiring a mechan-ical parking brake seems unnecessary for a vehicle of this size and weight. For theacceleration and light pattern tests, purpose-built sensors might have given moreaccurate readings.

6.2 Conclusion

From the list of personal goals this is what was achieved:

• Maximum speed (street mode): 20kmh, 5.56m/s.Not implemented, however the average speed of both commutes were underthis limit.

• Maximum continuous motor power (street mode): 250w.Implemented and working.

• The board must be able to brake at 3m/s2. The braking system should befunctionally safe during normal operating conditions.Worked at higher speeds.

• The board should have a parking brake that can keeps the board stationaryon a 15° incline, even without electrical power. This brake should not be adanger to the user if accidentally engaged.The parking brake was not able to hold the board. Flipping the board overproved more than adequate.

• The board should have white lights forward and red lights backwards that canbe clearly seen from 300m. The lights cannot be blinding or must be able tobe dimmed quickly.Implemented and working.

• The board should have an audible warning device (AW-dev).Implemented and working.

40

Page 56: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

6.2. CONCLUSION

• The board should be able to monitor the batteries to allow safe usage.Partially implemented.

• The board should be able to run at full power (street mode) for at least halfan hour.Technically possible more tests needed.

• The board’s components have to be protected from the environment.Needs improvement.

The project has shown several possibilities for a street-legal longboard. It showsthe possibility of a dual-purpose vehicles and provides a method of giving feedbackto the user. It shows that the law as it is written today is reasonable but could beimproved for different sizes and types of vehicles.

41

Page 57: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Chapter 7

Further work

For further work a dual MCU system could be implemented, where one would han-dle the monitoring and feedback and one the power output. Having two MCUscould allow for continuous monitoring of the batteries voltages and temperatures.With more time a PID control method could be implemented, this might improvethe jerkiness of “running average” control method.

An ambient light sensor could be implemented to control the brightness of thehead and taillights. Adaptive brightness can minimize the risk of blinding and im-prove visibility and battery life.

Test on the board with purpose-built accelerometers could probably differentiatebetter between the different control modes.

The system can relatively easily be converted for other wheeled vehicles withoutswapping any components. By placing the motors(wheels) against one or severalbigger wheels on a vehicle, the periphery force and speed would be the same, thusproviding similar performance.

42

Page 58: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Bibliography

[1] Boosted Boards, “Electric skateboard — Boosted boards.” [Online]. Available:https://boostedboards.com/

[2] Woodbank Communications, “Electropaedia, Energy Sources and Storageand History of Technology.” [Online]. Available: http://www.mpoweruk.com/index.htm

[3] T. Crompton, Battery reference book, 3rd ed. Linacre House Jordan Hill,Oxford, United Kingdom: Newnes, 2000.

[4] G. J. May, A. Davidson, and B. Monahov, “Lead batteries for utilityenergy storage: A review,” feb 2018. [Online]. Available: https://www.sciencedirect.com/science/article/pii/S2352152X17304437

[5] I. Buchmann, “Basic to Advanced Battery Information from BatteryUniversity,” 2018. [Online]. Available: http://batteryuniversity.com/

[6] ——, “Battery Discharge Methods – Battery University,” 2018. [Online].Available: http://batteryuniversity.com/learn/article/discharge methods

[7] OSRAM, “OSLON SSL 80 GW CS8PM1.PM — OSRAM OS.”[Online]. Available: https://dammedia.osram.info/media/resource/hires/osram-dam-5537590/GWCS8PM1.PM EN.pdf

[8] ——, “OSLON Signal LJ CKBP — OSRAM OS.” [On-line]. Available: https://dammedia.osram.info/media/resource/hires/osram-dam-2493850/LJCKBP EN.pdf

[9] “Hobbyking.com,” 2018. [Online]. Available: https://hobbyking.com/

[10] L. Garfield, “Cities are going car-free around the world - Busi-ness Insider,” 2017. [Online]. Available: http://www.businessinsider.com/cities-going-car-free-2017-2?r=US&IR=T

[11] Regeringskansliet, “Regeringen ger besked om miljozoner.” [On-line]. Available: http://www.regeringen.se/pressmeddelanden/2018/03/regeringen-ger-besked-om-miljozoner/

43

Page 59: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

BIBLIOGRAPHY

[12] Transportstyrelsen, “Nya miljozoner kan ge renare luft i staderna,”2018. [Online]. Available: https://www.transportstyrelsen.se/sv/Press/Pressmeddelanden/nya-miljozoner-kan-ge-renare-luft-i-staderna/

[13] Sveriges Riksdag, “Lag (2001:559) om vagtrafikdefinitioner Svensk forfat-tningssamling 2001:2001:559 t.o.m. SFS 2017:360 - Riksdagen.” [On-line]. Available: https://www.riksdagen.se/sv/dokument-lagar/dokument/svensk-forfattningssamling/lag-2001559-om-vagtrafikdefinitioner sfs-2001-559

[14] Transportstyrelsen, “Transportstyrelsens foreskrifter om cyklar, hastfordon ochsparkstottingar,” 2010. [Online]. Available: https://www.transportstyrelsen.se/TSFS/TSFS2009 31k.pdf

[15] Inboard technology, “Inboard Technology - M1 Premium Electric Skateboard.”[Online]. Available: https://www.inboardtechnology.com/

[16] S. Gordon, “Composite sports board such as a skateboard deck,” Patent, dec,2003. [Online]. Available: https://patents.google.com/patent/US6648363B2/

[17] L. W. Docter, “Skateboard / longboard truck with improved mechanicaladvantage,” Patent, nov, 2014. [Online]. Available: https://patents.google.com/patent/US9199158

[18] SKF, “Loads calculations for roller bearings.” [Online].Available: http://www.skf.com/uk/products/bearings-units-housings/engineered-products/insocoat-bearings/loads/index.html

[19] H. Duane C, Brushless permanent magnet motor design, 2nd ed. Orono, ME:Magna Physics Publishing, 2006.

[20] P.-E. Lindahl, R. Meyer, H. Johansson, H. Grimheden, W. Sandqvist, andM. Paulson, Elektroteknik, 2013th ed., M. Paulson, Ed. Stockholm: Institu-tionen for maskinkonstruktion, Tekniska hogsk., 2013.

[21] Acroname, “Back-EMF Motion Feedback blog post — Acron-ame,” 2011. [Online]. Available: https://acroname.com/blog/back-emf-motion-feedback-blog-post

[22] P. Yedamale, “Brushless DC motor Fundamentals,” Chandler, AZ, Tech.Rep., 2003. [Online]. Available: http://ww1.microchip.com/downloads/en/AppNotes/00885a.pdf

[23] M. Miyamasu and K. Akatsu, “Efficiency comparison between Brushless dcmotor and Brushless AC motor considering driving method and machinedesign,” in IECON Proceedings (Industrial Electronics Conference). IEEE,nov 2011. [Online]. Available: http://ieeexplore.ieee.org/document/6119584/

44

Page 60: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

BIBLIOGRAPHY

[24] K. Y. Nam, W. T. Lee, C. M. Lee, and J. P. Hong, “Reducingtorque ripple of brushless DC motor by varying input voltage,” in IEEETransactions on Magnetics, vol. 42, no. 4, apr 2006. [Online]. Available:http://ieeexplore.ieee.org/document/1608454/

[25] The Verge, “Inboard M1 electric skateboard review - YouTube.” [Online].Available: https://www.youtube.com/watch?v=p6WkoK0zJJM

[26] MIT Electric Vehilce Team, “A Guide to Understanding Bat-tery Specifications,” Current, no. December, 2008. [Online]. Available:http://web.mit.edu/evt/summary battery specifications.pdf

[27] Concordia University, “Lead Acid Batteries,” 2005. [Online]. Avail-able: https://www.concordia.ca/content/dam/concordia/services/safety/docs/EHS-DOC-146 LeadAcidBatteries.pdf

[28] T. Moynihan, “Why Lithium Ion Batteries Keep Exploding —WIRED,” 2017. [Online]. Available: https://www.wired.com/2017/03/dont-blame-batteries-every-lithium-ion-explosion/

[29] M. Swider, “Here’s why the Samsung Galaxy Note 7 batteries caught fire andexploded — TechRadar,” 2017. [Online]. Available: https://www.techradar.com/news/samsung-galaxy-note-7-battery-fires-heres-why-they-exploded

[30] Federal Aviation Administration, “LITHIUM BATTERIES & LITHIUMBATTERY-POWERED DEVICES Aviation Cargo and Passenger Bag-gage Events Involving Smoke , Fire , Extreme Heat or ExplosionInvolving Lithium Batteries or Unknown Battery Types,” 2016. [On-line]. Available: https://www.faa.gov/about/office org/headquarters offices/ash/ash programs/hazmat/aircarrier info/media/Battery incident chart.pdf

[31] I. Buchmann, “BU-304b: Making Lithium-ion Safe – Battery Uni-versity.” [Online]. Available: http://batteryuniversity.com/learn/article/bu 304b making lithium ion safe

[32] ——, “Calculating the Battery Runtime - Battery University,” 2018.[Online]. Available: http://batteryuniversity.com/learn/article/dischargecharacteristics li

[33] C. Chan and K. Chau, Modern electric vehicle technology. GreatClarendon Street, Oxford, OX2 6DP, United Kingdom: oxford universitypress, 2001. [Online]. Available: https://global.oup.com/academic/product/modern-electric-vehicle-technology-9780198504160?cc=se&lang=en&

[34] Y. Fujiwara, “Self-synchronizing pulse position modulation with errortolerance,” IEEE Transactions on Information Theory, vol. 59, no. 9, jan2013. [Online]. Available: https://arxiv.org/abs/1301.3369

45

Page 61: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

BIBLIOGRAPHY

[35] J. Malasek, “Pololu - Servo control interface in detail.” [Online]. Available:https://www.pololu.com/blog/17/servo-control-interface-in-detail

[36] Texas Instruments Incorporated, “TL4242 Adjustable LED Driver — TI.com.”[Online]. Available: http://www.ti.com/product/TL4242

[37] Adafruit, “Adafruit-NeoPixel-8x8-Matrix.” [Online]. Available: https://github.com/adafruit/Adafruit-NeoPixel-8x8-Matrix

[38] Kjell & Company, “Luxorparts Adresserbar RGB LED-matris 64x LED.”[Online]. Available: https://www.kjell.com/se/sortiment/el-verktyg/arduino/tillbehor/luxorparts-adresserbar-rgb-led-matris-64x-led-p90767

[39] Adafruit, “Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix.”[Online]. Available: https://www.adafruit.com/product/1487

[40] Arduino, “Arduino Mega 2560 Rev3.” [Online]. Available: https://store.arduino.cc/arduino-mega-2560-rev3

[41] Maytech, “MTO9055-HBM-60-HA hub motor,” 2015. [Online]. Available:http://www.maytech.cn/en/mto91hbm-nh/8803.html

[42] Kjell & Company, “Luxorparts Variabel mini-spanningsreg-ulator Switchad - Stromforsorjning.” [Online]. Available:https://www.kjell.com/se/sortiment/el-verktyg/arduino/stromforsorjning/luxorparts-variabel-mini-spanningsregulator-switchad-p90771

[43] B. Vedder, “VESC – Open Source ESC — Benjamin’s robotics.” [Online].Available: http://vedder.se/2015/01/vesc-open-source-esc/

[44] ——, “VESC Tool.” [Online]. Available: https://vesc-project.com/vesc tool

[45] Maytech, “Maytech MTSKR1712 mini wireless re-mote.” [Online]. Available: http://www.maytech.cn/en/maytech-mtskr1712-e-skateboarding-mini-wireless-remote/11032.html

[46] Mouser, “MSO206NR Mallory Sonalert.” [Online]. Avail-able: https://www.mouser.se/ProductDetail/Mallory-Sonalert/MSO206NR?qs=94V4QatVK%252bej6G6GKbjORw==

[47] Original Skateboards, “Arbiter 36 DK Longboard by Original Skate-boards.” [Online]. Available: https://originalskateboards.com/product/double-kick-arbiter-deck/

[48] A. Font and G. W. Fuller, “Did policies to abate atmospheric emissions fromtraffic have a positive effect in London?” Environmental Pollution, vol. 218,nov 2016. [Online]. Available: https://www.sciencedirect.com/science/article/pii/S0269749116305966?via%3Dihub

46

Page 62: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix A

Arduino code to control the board

A.1 The main code

1 /* Project name: Eboard2 Author: Leo Sodergren3 Date: 2018-054 School: KTH5 Course: MX133X6 Description: Code for controlling the electric board

prototype7 Configuration:8 MCU: ATmega25609 Clock Speed: 16 MHz

10 Board: Arduino MEGA11 Used pins: See config12 */1314 // Includes the needed libraries15 #include <Adafruit_NeoMatrix.h>16 #include <gamma.h>17 #include <Adafruit_NeoPixel.h>18 #include <Adafruit_GFX.h>19 #include <Adafruit_SPITFT.h>20 #include <Adafruit_SPITFT_Macros.h>21 #include <gfxfont.h>22 #include <datatypes.h>23 #include <VescUart.h>24252627 #include "config.h"//Includes the config.h file

47

Page 63: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD

282930 // --------------------Varible Initilization

----------------------------3132 // Initilizes the volitile varibles3334 volatile int ThrottleIn = 0; // volatile, we set this in the

Interrupt and read it in loop so it must be declaredvolatile

35 volatile unsigned long ulStartPeriod = 0; // set in theinterrupt

36 volatile int state = 1;373839 // Initilizes varibles4041 int mode;42 int timN=0; //times neutral43 int Mfull = false; //defines the matrix empty44 int BLS=0; //backligt base brightness45 float motor_current = 0.0; //Measured motor current46 float batvoltage = 35.0; //Measured battery voltage,

starts at47 float c_speed = 0.0; //Measured rpm48 float power = 0.0; //Measured power49 float avaragePWR; //Average power50 unsigned long sum; //The sum of the poweroutput51 int averagenum=0; //Number avarage samples

starts at 052 int PWRarray[avragrot]; //Initilizes the avrrage

array53 int calulated_Throttle=0; //Starts the calculate

throttle at 054 int index;5556 bool cellstate[]=false,false,false,false,false;// cell

state. False means ok.57 char cellstr[]=’1’,’3’,’5’,’8’,’X’;// cell str585960 struct bldcMeasure measuredValues;6162 // Matrix Initilization.

48

Page 64: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

A.1. THE MAIN CODE

63 Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(8, 8, Mpin,64 NEO_MATRIX_TOP + NEO_MATRIX_LEFT +65 NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,66 NEO_GRB + NEO_KHZ800);676869 // --------------Interrupt functions---------------70 void interrupt()//Interrupt function for street mode7172 if(digitalRead(Siginpin) == HIGH)// if the signal pin is

high, its the start of a high pulse.73 ulStartPeriod = micros();74 75 else // if the pin is low calculate the

passed time76 ThrottleIn = (int)(micros() - ulStartPeriod);77 ulStartPeriod = 0;78 79 8081 void racemodeinterrupt()//Interrupt function for race mode82 // if the signal pin is high, set the pin high83 if(digitalRead(Siginpin) == HIGH)84 digitalWrite(Sigoutpin, HIGH);85 ulStartPeriod = micros();86 87 else // if the pin is low set the output low88 digitalWrite(Sigoutpin, LOW);89 ThrottleIn = (int)(micros() - ulStartPeriod);90 ulStartPeriod = 0;91 92 9394 void cstate()// Function to change state turn on off lights

.95 static unsigned long last_interrupt_time = 0; //Defines

static function varible96 unsigned long interrupt_time = millis();97 if (interrupt_time - last_interrupt_time > 200) // If

interrupts come faster than 200ms, assume it’s a bounceand ignore, source: [mikalhart forum.arduino.cc]

98 if(state==1)99 state=2;

100 analogWrite(BLpin,BLbr); //Turn on the lights with the

49

Page 65: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD

brightness set in Config.h101 analogWrite(FLpin,FLbr);102 BLS=BLbr; //sets the backlight base brightness to the

configured brightness.103 104 else 105 state=1;106 digitalWrite(FLpin,LOW); //Turns off the lights107 digitalWrite(BLpin,LOW);108 BLS=0; //sets the backlight base brightness 0;109 110111 112 last_interrupt_time = interrupt_time;113 114115116 // -----------------SETUP-------------------117 void setup() 118 pinMode(Pbutpin, INPUT_PULLUP); //Set push-button as input

with internal pullup119 pinMode(Siginpin, INPUT_PULLUP);120121 //Set various outputs122 pinMode(Sigoutpin, OUTPUT);123 pinMode(Servopin, OUTPUT);124 pinMode(BLpin, OUTPUT);125 pinMode(FLpin, OUTPUT);126 pinMode(PBled, OUTPUT);127128 analogWrite(PBled,20);129130 for(int index=0; index<=avragrot; index++) //Sets up an

average array, if not used comment out131 PWRarray[index]=0;132 133134 //Starts matrix135 matrix.begin();136 matrix.setTextWrap(false);137 matrix.setBrightness(Mbr); //Sets the brightness of the

matrix acording to that set in Config.h138 matrix.fillScreen(matrix.Color(0, 0, 0)); //Starts the

screen black

50

Page 66: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

A.1. THE MAIN CODE

139 matrix.show();140141 //Serial begin142 Serial1.begin(115200);143 //Serial.begin(115200); //debug serial over usb not needed

for normal use.144145146 if (digitalRead(Pbutpin) == HIGH) // Checks if push-

button pressed at start if so goes into race mode147 attachInterrupt(digitalPinToInterrupt(Siginpin),

interrupt,CHANGE);148 attachInterrupt(digitalPinToInterrupt(Pbutpin),cstate,

FALLING);149 mode=1;150 151 else152 raceM();153 attachInterrupt(digitalPinToInterrupt(Siginpin),

racemodeinterrupt,CHANGE);154 attachInterrupt(digitalPinToInterrupt(Pbutpin),cstate,

FALLING);155 mode=2;156 157158 delay(500); //Delay 500ms to be shure to have an first

interrrupt159 160161 // ------------------MAIN---------------------162 void loop() 163 if (mode==2) //164 racemode();165 166 else167 streetmode();168 169 170171 //----------------------Mode functions----------------------172 void streetmode()173 brakelights();174175 if(ThrottleIn>(Max_Throttle+Throttle_fault)) //Signal too

51

Page 67: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD

high error176 timN=0;177 neutralThrottle();178 errorM();179 180 else if(ThrottleIn<(Min_Throttle-Throttle_fault))//Signal

too low error181 timN=0;182 neutralThrottle();183 errorM();184 185 else if ((ThrottleIn>=Neutral_Throttle-Deadband_Throttle)

&&(ThrottleIn<=Neutral_Throttle+Deadband_Throttle))//Neutral throttle

186 if(timN>=neutraltimes) //If enough neutral has beenenough times switch to monitoring mode

187 voltcheck();188 batteryerror();189 neutralThrottle();190 191 else192 normallThrottle();193 timN++;194 195 196 else //Normal throttle197 timN=0;198 clearM();199 readvesc();// Tries to read the VESC200 // Here the wanted power limiting method is set.201 //PWRavarage(); // "Running average" mode202 //PWRavaragecutoff(); //"Running average cutoff" mode203 PWRavarageclocks(); //"Average"204 205 206207 void racemode()208 brakelights();209 210211 //-----------------------Power mode functions---------------212 void PWRavaragecutoff()213 if (ThrottleIn<=Neutral_Throttle-Deadband_Throttle)//if

braking do no conversion

52

Page 68: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

A.1. THE MAIN CODE

214 averagenum++;215 avaragePWR=sum/averagenum;216 217 else218 long sum= sum+power;219 averagenum++;220 avaragePWR=sum/averagenum;221 222 if (avaragePWR<=maxpower||ThrottleIn<=Neutral_Throttle-

Deadband_Throttle)223 normallThrottle();224 225 else226 neutralThrottle();227 228 229230 void PWRavarage()231 if (ThrottleIn<=Neutral_Throttle-Deadband_Throttle)//if

braking do no conversion232 averagenum++;233 avaragePWR=sum/averagenum;234 235 else236 sum= sum+power;237 averagenum++;238 avaragePWR=sum/averagenum;239 240 calulated_Throttle=maxpower/(auS*batvoltage)+

Neutral_Throttle+Deadband_Throttle;241 if (avaragePWR<=maxpower || ThrottleIn<= Neutral_Throttle-

Deadband_Throttle)242 normallThrottle();243 244 else if(ThrottleIn>=calulated_Throttle)245 calculatedThrottle();246 247 else248 normallThrottle();249 250 251252 void PWRavarageclocks() //https://www.arduino.cc/en/

Tutorial/Smoothing

53

Page 69: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD

253 sum =(float) sum - PWRarray[index];// subtract the lastreading:

254 PWRarray[index] = power; // read the power output:255 sum = sum + PWRarray[index];// add the reading to the

total:256 index = index + 1;// advance to the next position in the

array:257 if (index >= avragrot) // if we’re at the end of the

array...258 index = 0; // ...wrap around to the beginning:259 260261 // calculate the average:262 avaragePWR = (float) sum / avragrot;263 calulated_Throttle=maxpower/(auS*batvoltage)+

Neutral_Throttle+Deadband_Throttle;264 if (avaragePWR<=maxpower || ThrottleIn<= Neutral_Throttle-

Deadband_Throttle)265 normallThrottle();266 267 else if(ThrottleIn>=calulated_Throttle)268 calculatedThrottle();269 270 else271 normallThrottle();272 273 274275 //----------------------Random Functions--------------------276 void neutralThrottle()277 digitalWrite(Sigoutpin, HIGH);278 delayMicroseconds(Neutral_Throttle-neutralcomp);279 digitalWrite(Sigoutpin, LOW);280 delayMicroseconds(frequen);281 282283 void normallThrottle()284 digitalWrite(Sigoutpin, HIGH);285 delayMicroseconds(ThrottleIn-neutralcomp);286 digitalWrite(Sigoutpin, LOW);287 delayMicroseconds(frequen);288 289290 void calculatedThrottle()

54

Page 70: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

A.1. THE MAIN CODE

291 digitalWrite(Sigoutpin, HIGH);292 delayMicroseconds(calulated_Throttle-neutralcomp);293 digitalWrite(Sigoutpin, LOW);294 delayMicroseconds(frequen);295 296297 void brakelights()298 if(ThrottleIn<=Neutral_Throttle-Deadband_Throttle)//If

signal under neutral(braking) turn on back lights299 analogWrite(BLpin, (BLS+Bbr));300 301 else302 analogWrite(BLpin, BLS);303 304 305306 void voltcheck()307 static float voltage;308 batvoltage=analogRead(voltagepin[0])*Vconv/Vfact[0]*10.0;309 for (int cell=0 ; cell<=4 ; cell++)310 311 float voltage=( analogRead(voltagepin[cell])*Vconv/Vfact

[cell]);312 if (voltage <= Uvolt*cellnum[cell] || voltage >= Ovolt*

cellnum[cell])313 314 cellstate[cell]=true;315 316 else317 318 cellstate[cell]=false;319 320 321 322323 void batteryerror()324 for (int cell=0 ; cell<=4 ; cell++)325 326 if (cellstate[cell]==true)327 328 batteryM(cellstr[cell]);329 delay(1000);330 331 else

55

Page 71: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD

332 clearM();333 334 335 336 void readvesc() //Function to read values from VESC and

calculate power337 if (VescUartGetValue(measuredValues)) 338 c_speed= (measuredValues.rpm);339 motor_current= measuredValues.avgInputCurrent/80000;340 power=(float)motor_current*batvoltage;341 342 343344345 //----------------------------Matrix pattern functions

---------------------346347 void clearM() //Clear matrix function.348 if (Mfull) //checks if screen actually is filled to

minimize cycles spent uppdating349 350 matrix.fillScreen(matrix.Color(0, 0, 0));351 matrix.show();352 Mfull=false;353 354 355356 void raceM()//Function to draw raceflag357 358 matrix.drawLine(0, 0, 7, 7, matrix.Color(255, 255, 255));359 matrix.drawLine(2, 0, 7, 5, matrix.Color(255, 255, 255));360 matrix.drawLine(4, 0, 7, 3, matrix.Color(255, 255, 255));361 matrix.drawLine(6, 0, 7, 1, matrix.Color(255, 255, 255));362 matrix.drawLine(0, 2, 5, 7, matrix.Color(255, 255, 255));363 matrix.drawLine(0, 4, 3, 7, matrix.Color(255, 255, 255));364 matrix.drawLine(0, 6, 1, 7, matrix.Color(255, 255, 255));365 matrix.show();366 Mfull=true;367 368 369370 void batteryM(char cell) //Function to show battery error371 matrix.fillScreen(0);372 matrix.drawRect(1, 1, 6, 7, matrix.Color(255, 0, 0));

56

Page 72: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

A.2. CONFIG CODE

373 matrix.drawFastHLine(2, 0, 4, matrix.Color(255, 0, 0));374 matrix.setCursor(1, 0);375 matrix.print(cell); //Displays which cell is outside the

critera.376 matrix.show();377 Mfull=true;378 379380 void errorM() //Function to show error381 matrix.fillScreen(0);382 matrix.fillRect(2, 0, 4, 5, matrix.Color(255, 0, 0));383 matrix.drawRect(3, 6, 2, 2, matrix.Color(255, 0, 0));384 matrix.show();385 Mfull=true;386 delay(500);387

A.2 Config code

1 //Config.h2 /*Configuration file for Eboard3 * Leo Sodergren 20184 */56 //Defining controllable varibles7 #define Min_Throttle 1000 //[us] Minimum throttle time.8 const int Neutral_Throttle=1500; //[us] This is the duration

in of neutral throttle pulse.9 #define Max_Throttle 2000 //[us] Maximum throttle.

10 #define Throttle_fault 500//[us] Margin for to long/shortpulses.

11 #define frequen 200000 //[us] Duration between pulses.12 #define Deadband_Throttle 25//[us] The deadband for which

the controll is accepted neutral(+-)13 #define FLbr 25 //Brightness of the front light

(255 for 6W)14 #define BLbr 20 //Brightness of the back light

(255 for 8W)15 #define Mbr 20 //Brightness of the LED matrix

(100 for 100%)16 #define Bbr 50 //extra brightness for braking17 #define neutraltimes 300 //Times before entering neutral

mode.18 #define neutralcomp 200 //[us]

57

Page 73: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD

19 #define maxpower 125 //[W] Max power output per motor20 #define avragrot 100 //Number ov values to calculate

average21 #define maxspeed 20 //[kmh] maximum speed2223 const float Ovolt=4.35; //[V] Overvoltage24 const float Uvolt=3.2; //[V] Undervoltage25 const float maxA=22.0; //[A] Maximal ampere2627 //Defining calculation varibles28 const float Vconv =(5.0/1023.0); //defines the voltage

constant29 const float Vfact[]=1.0,0.39324,0.220765,0.14651,0.11665;

//defines the voltage factors for all measured cells.Optimized for low volatage

3031 //Defining random varibles32 const int cellnum[]=1,3,5,8,10;3334 const float auS=maxA/(Max_Throttle-Neutral_Throttle); //

Ampere per micro second3536 const float wheeldia=0.09; //[m] wheeel diameter37 const int erpm=6; // Factor omega elec/omega mech38 const float rpmconv=wheeldia*6.28*60/(1000*erpm);394041 //-----------------------------Output Input

-----------------------------4243 //Defining ouputs44 #define Mpin 8 //Matrix pin45 #define BLpin 9 //Backlight pin46 #define FLpin 10 //Headlight pin47 #define Servopin 11 //Servo (parking brake) pin48 #define Sigoutpin 46 // Signal out pin49 #define PBled 13 // Push button LED pin5051 //Defining digital inputs52 #define Siginpin 20 //Signal interrupt 153 #define Pbutpin 21 //Push-button interrupt 05455 //Defining analog inputs56 const int voltagepin[]=0,1,2,3,4;

58

Page 74: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

A.2. CONFIG CODE

57 //cell 1, cell 3, cell 5, cell 8, cell 10

59

Page 75: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix B

Acceleration tests graphs

B.1 Average modeTest graphs for ”average” mode:

60

Page 76: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

B.2. RUNNING AVERAGE CUTOFF

B.2 Running average cutoffTest graphs for ”Running average cutoff” mode:

61

Page 77: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX B. ACCELERATION TESTS GRAPHS

B.3 Running averageTest graphs for ”Running average” mode:

62

Page 78: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

B.4. SIMPLE POWER LIMITING

B.4 Simple power limitingTest graphs for ”Simple power limiting” mode:

63

Page 79: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX B. ACCELERATION TESTS GRAPHS

B.5 Race modeTest graphs for ”Race mode” mode:

64

Page 80: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix C

Matlab code to convert accelerometerdata

1 %% Filename: acceleration.m, Autor: Leo Sodergren, Date:2018-05-20

2 % Accepts .tsv file in format " counter timestamp[ms] x[m/sˆ2] y[m/sˆ2]

3 % Z[m/sˆ2]" and calculates/plots the absolue accelaration inx and y axis.

4

5

6

7

8 clc9 clf

10 clear all11 close all12

13 file =’race42.tsv’14 accM = tdfread(file); % Creates a struct of the .tsv file15 names = fieldnames(accM); % Finds the structs fields names

and creates a cell16 timeN =[’accM.’ names2]; % Creates a sting of the time

variable17 XN=[’accM.’ names3]; % Creates a sting of the X variable

name18 YN=[’accM.’ names3]; % Creates a sting of the Y variable

name19 timecode=eval(timeN); % Creates vector of the timecodes20 timecode=timecode/1000; % Converts the timecode from ms to s21 timestart=timecode(1); % Finds the first time

65

Page 81: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX C. MATLAB CODE TO CONVERT ACCELEROMETER DATA

22 time = zeros(length(timecode),1); %Creates empty time vector23 for ii = 1:length(timecode) % Loops through the timecodes24 time(ii)=timecode(ii)-timestart; % Calculates the passed

time from start25 end26 X=eval(XN); % Creates vector of x accelerations27 Y=eval(YN); % Creates vector of y accelerations28 tot=sqrt(X.ˆ2+Y.ˆ2); % Calculates the combined vector length29 tott=smooth(tot,20); % Creates a smoothed dataset30 average=ones(length(timecode),1)*sum(tot)/length(timecode);

%creates vector with average acceleration31

32 figure(’pos’,[1 50 1600 700]) %Designates where the plotwill display

33 hold on34 plot(time,average,’--k’,’Linewidth’,2) % Plots the average35 hold on36 plot(time,tot,’.’,’color’,[1,0.4,0.2],’markers’,15) % Plots

the sampled data37 hold on38 plot(time,tott,’Linewidth’,4,’color’,[0,0,1]) % Plots the

sampled data39 hold on40 legend(’Average’,’Sampled data’,’Smoothed data’,’FontSize’

, 15)41 xlabel(’time’,’FontSize’, 20)42 ylabel(’m/sˆ2’,’FontSize’, 20)43 xlim([0 time(length(timecode))])44 set(gca,’fontsize’,15)45 file=[file ’.png’];46 fig = gca;47 print (’-dpng’,figure(1),file,’-r200’)

66

Page 82: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix D

Matlab code to analyze lightmeasurements

1 clc2 clear all3 X=[-20 0 20];4 Y=[0 10 20];5 Z=[190 300 173; %Light measurements for the board’s front

lights6 120 240 125;7 86 150 85];8 Z=Z*255/25; %Conversion rate because the lights were not at

full power9

10 ZR=[70 120 73; %Light measurements for the board’s backlights

11 64 101 58;12 56 54 50];13 ZR=ZR*255/20; %Conversion rate because the lights were not

at full power14

15 Z2=[734 4500 636; %Light measurements for the Lezyne HectoDrive 300XL

16 402 1400 387;17 280 374 265];18

19 ZR2=[82 83 73; %Light measurements for the Lezyne HectorStrip.

20 70 73 69;21 64 70 60];22

67

Page 83: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX D. MATLAB CODE TO ANALYZE LIGHT MEASUREMENTS

23 [xx yy] = meshgrid(-20:0.1:20,0:0.1:20); %Makes a grid with1mm spacing

24 ZZ=interp2(X,Y,Z,xx,yy,’cubic’); %Cubic interpolation ofthe measurements

25 ZZR=interp2(X,Y,ZR,xx,yy,’cubic’);26 ZZ2=interp2(X,Y,Z2,xx,yy,’cubic’);27 ZZ2R=interp2(X,Y,ZR2,xx,yy,’cubic’);28

29 figure(1)30 contourf(xx,yy,ZZ,100,’LineColor’ , ’flat’,’DisplayName’,’

Lux’) %Makes a contour plot of the interpolated data31 axis equal %Sets the axis to equal scale.32 set(gca,’fontsize’,15)33 c=colorbar;34 c.Label.String = ’Lux’;35

36 figure(2)37 contourf(xx,yy,ZZR,100,’LineColor’ , ’flat’,’DisplayName’,’

Lux’)38 axis equal39 set(gca,’fontsize’,15)40 c=colorbar;41 c.Label.String = ’Lux’;42

43 figure(3)44 contourf(xx,yy,ZZ2,100,’LineColor’ , ’flat’,’DisplayName’,’

Lux’)45 axis equal46 set(gca,’fontsize’,15)47 c=colorbar;48 c.Label.String = ’Lux’;49

50 figure(4)51 contourf(xx,yy,ZZ2R,100,’LineColor’ , ’flat’,’DisplayName’,’

Lux’)52 axis equal53 set(gca,’fontsize’,15)54 c=colorbar;55 c.Label.String = ’Lux’;56

57 print (’-dpng’,figure(1),’Boardw.png’,’-r200’)58 print (’-dpng’,figure(2),’BoardR.png’,’-r200’)59 print (’-dpng’,figure(3),’cykelw.png’,’-r200’)60 print (’-dpng’,figure(4),’cykelR.png’,’-r200’)

68

Page 84: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix E

Layout and schematic for the LEDboard

Figure E.1. LED module circuit board layout. Made in Autodesk Eagle

Figure E.2. LED module circuit board layout. Made in Autodesk Eagle

69

Page 85: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix F

Layout and schematic for the powerdistribution board

Note this includes the IC voltage regulator that was not used in the final board.

Figure F.1. Power distribution circuit board top. Made in Autodesk Eagle

70

Page 86: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Figure F.2. Power distribution circuit board bottom. Made in Autodesk Eagle

Figure F.3. Power distribution battery connection circuit schematic. Made inAutodesk Eagle

71

Page 87: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX F. LAYOUT AND SCHEMATIC FOR THE POWER DISTRIBUTIONBOARD

Figure F.4. Power distribution voltage regulation circuit schematic. Made in Au-todesk Eagle

Figure F.5. Power distribution VESC connection circuit schematic. Made in Au-todesk Eagle

72

Page 88: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix G

Layout and schematic for the voltagedivider board

Figure G.1. Voltage divider circuit board layout. Made in Autodesk Eagle

73

Page 89: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX G. LAYOUT AND SCHEMATIC FOR THE VOLTAGE DIVIDER BOARD

Figure G.2. Voltage divider circuit schematic. Made in Autodesk Eagle

74

Page 90: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix H

Layout and schematic for the buzzerboard

Figure H.1. Buzzer circuit board layout. Made in Autodesk Eagle

Figure H.2. Buzzer circuit schematic. Made in Autodesk Eagle

75

Page 91: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix I

Images of the completed board

Figure I.1. The completed board

76

Page 92: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Figure I.2. The underside of the completed board

Figure I.3. Lid over battery compartment

77

Page 93: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX I. IMAGES OF THE COMPLETED BOARD

Figure I.4. The main compartment lid with the push-button.

Figure I.5. The front of the board with the headlight.

78

Page 94: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Figure I.6. The parking brake as seen from underneath the board. Note that thewire guide is missing.

Figure I.7. The LED matrix displaying a battery cell error for cell 8.

79

Page 95: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

APPENDIX I. IMAGES OF THE COMPLETED BOARD

Figure I.8. The LED matrix displaying an in-signal error.

Figure I.9. The LED matrix displaying a checkered flag.

80

Page 96: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Figure I.10. The board with its head and taillights lit.

81

Page 97: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix J

Images of the completed hand controller

Figure J.1. Side view of the hand controller.

Figure J.2. Front view of the hand controller. Note the push-button to activate theAW-dev

82

Page 98: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Figure J.3. Top view of the hand controller.

Figure J.4. The hand controller in a hand.

83

Page 99: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix K

3D model of the hand controller

A 3D model of the hand controller. Use a compatible PDF viewer to view 3D files.

84

Page 100: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

Appendix L

3D model of the board

A simplified 3D model of the board. Use a compatible PDF viewer to view 3D files.

85

Page 101: Electric longboard - DiVA portal1237821/FULLTEXT01.pdf · 2018. 8. 10. · A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill riding

TRITA ITM-EX 2018:72

www.kth.se