• No results found

Electric Longboard

N/A
N/A
Protected

Academic year: 2021

Share "Electric Longboard"

Copied!
101
0
0

Loading.... (view fulltext now)

Full text

(1)

IN

DEGREE PROJECT TECHNOLOGY, FIRST CYCLE, 15 CREDITS

,

STOCKHOLM SWEDEN 2018

Electric Longboard

A dual-purpose personal vehicle

LEO SÖDERGREN

(2)

Electric Longboard

LEO S ¨ODERGREN

Bachelor’s Thesis at ITM Supervisor: Nihad Subasic

Examiner: Nihad Subasic

(3)
(4)

Abstract

Keywords: mechatronics, personal transportation, electric vehicle, last mile transport, adaptive power management. The aim of this thesis is to explore the possibility of a dual-purpose electric vehicle. The vehicle should be able to be used for both commuting and racing. It also aims to describe different power limiting methods and their effect on performance. Lastly it hopes to see if the Swedish laws, as written today are reasonable. An electric longboard has been constructed for this purpose and several tests have been performed.

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

(5)

Referat

Elektrisk Longboard

Nyckelord: Mekatronik, personlig transport, elfordon, ”sista str¨ackan” transportmedel, adaptiv energidrift.

Syftet med detta arbete ¨ar att testa m¨ojligheten med ett tv˚a-l¨ages personligt fordon. Fordonenet ska kunna anv¨andas f¨or b˚ade pendling och t¨avling. Arbetet har ¨aven testat olika energilimeteringsmetoder samt unders¨okt hur dessa meto-der p˚averkar prestandan. Arbetet har ¨aven f¨ors¨okt besvara fr˚agan om det svenska lagarna, som det ¨ar skrivna idag, ¨ar l¨ampliga. En elektrisk longboard har konstruerats och flera test utf¨orts.

Ett antal m˚als¨attningar har definerats f¨or prototypen. Des-sa inkluderar: effekt, k¨ortid och att br¨adan b¨or ha en ring-klocka.

(6)

Acknowledgements

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

(7)

Contents

Acknowledgements List of Abbreviations 1 Introduction 1 1.1 Background . . . 1 1.2 Purpose . . . 2 1.3 Scope . . . 2 1.4 Method . . . 2 2 Theory 3 2.1 The longboard . . . 3

2.2 Permanent magnet synchronous motor and speed controllers . . . 5

2.3 Longboard drive systems . . . 7

2.4 Battery technology . . . 8 2.5 PPM and PWM . . . 11 3 Demonstrator 12 3.1 The system . . . 12 3.2 Logic . . . 14 3.2.1 Lighting . . . 14 3.2.2 Sensors . . . 15 3.2.3 LED matrix . . . 15 3.2.4 MCU . . . 15 3.3 Driveline . . . 16 3.3.1 Motors . . . 16 3.3.2 Batteries . . . 18 3.3.3 Parking brake . . . 19 3.3.4 Power distribution . . . 19 3.3.5 ESC . . . 20 3.4 Control . . . 21

3.4.1 Hand controller and receiver . . . 21

3.5 Structure . . . 23

(8)

3.5.2 Trucks and wheels . . . 25

3.5.3 Lids . . . 25

3.5.4 Lenses . . . 26

3.6 Software . . . 26

4 Experiments 31 4.1 Acceleration and retardation test . . . 31

4.2 Range test . . . 31

4.3 Light pattern measurements . . . 31

4.4 Light strength test . . . 32

4.5 Parking brake test . . . 32

5 Findings 33 5.1 Acceleration and retardation . . . 33

5.2 Range . . . 35

5.3 Light pattern . . . 36

5.4 Light strength . . . 38

5.5 Parking brake . . . 38

6 Discussion and conclusion 39 6.1 Discussion . . . 39

6.2 Conclusion . . . 40

7 Further work 42 Bibliography 43 Appendices 46 A Arduino code to control the board 47 A.1 The main code . . . 47

A.2 Config code . . . 57

B Acceleration tests graphs 60 B.1 Average mode . . . 60

B.2 Running average cutoff . . . 61

B.3 Running average . . . 62

B.4 Simple power limiting . . . 63

(9)

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

(10)

List of Figures

2.1 A deck in red with the griptape in blue. Designed in Autodesk Fusion 360 rendered in Blender. . . 3 2.2 Exploded view of a truck. The hanger is marked blue, the connecting

elements in red and the hanger in yellow. Made with Autodesk Fusion 360. . . 4 2.3 Exploded view of a wheel assembly. The wheel is blue, bearings red and

the spacer yellow. Made with Autodesk Fusion 360. . . 4 2.4 Back EMF for one phase in BLDC and BLAC motors. Drawn in Adobe

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

and belt highlighted in blue. Highlights drawn in Illustrator. . . 8 2.7 Expected cycle life corresponding to level of discharge [2]. . . 10 2.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 in

Adobe Illustrator. . . 13 3.2 Light module PCB. Made with Adobe Illustrator and Autodesk Eagle. . 15 3.3 Render of Maytechs 90 mm hub motor. Made with Autodesk Fusion 360. 16 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 and Adobe Photoshop. . . 19 3.5 Diagram of the board’s two voltage systems. Drawn in Adobe Illustrator. 20 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 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 blue

and the main compartment in orange. Drawn in Adobe Illustrator . . . 23 3.8 Exploded view of the deck’s structure. Made with blender and Adobe

Illustrator . . . 24 3.9 Render of the main lid. The push-button is seen as black and red on the

(11)

3.10 Render of the front lens. Note the 6 divots for the LED. Designed in

Autodesk Fusion 360 rendered in blender. . . 26

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

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

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

3.14 Flowchart for the push-button interrupt function that changes between light 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. . 36

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

5.3 Measured light pattern for Lezyne Hecto Drive 300XL, generated in Mat-lab. . . 37

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

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

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

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

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

F.3 Power distribution battery connection circuit schematic. Made in Au-todesk Eagle . . . 71

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

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

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

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

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

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

I.1 The completed board . . . 76

I.2 The underside of the completed board . . . 77

I.3 Lid over battery compartment . . . 77

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

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

(12)

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

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

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

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

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

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

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

(13)

List of Tables

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

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

3.1 Used LEDs characteristics [7, 8] . . . 14

3.2 Possible battery configurations [9]. . . 18

5.1 Acceleration data from the different power modes. . . 34

5.2 Noted data from the range test. . . 35

(14)

List of Abbreviations

AC – Alternating current

BLDC - Brushless direct current BLAC - Brushless alternating current DC – Direct current

EMF – Electromotive force FOC - Field orientation control IC - Integrated circuit

LED – Light emitting diode

MDF – Medium density fibreboard PCB – Printed circuit board

PID – Proportional-integral-derivative RC – Radio control

(15)
(16)

Chapter 1

Introduction

1.1

Background

A longboard is a type of skateboard, a personal vehicle, generally used for commut-ing and downhill ridcommut-ing. It can have many benefits over more traditional modes of transport: it is generally quicker and requires less effort than walking or running, it is portable so it can be brought inside, removing the need for roadside parking and locks. The major drawback with longboards are their lack of brakes and that they require 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 everyday urban 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 municipalities to adapt new environmental zones to regulate which vehicles would be allowed to travel within these new zones [11]. The strictest zone, “class 3”, would forbid all types of petrol and diesel vehicles, which accounts for about 95% of new vehicles in Sweden, 2015 [12].

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

(17)

CHAPTER 1. INTRODUCTION

1.2

Purpose

The purpose of this thesis is to explore the possibility of a dual purpose electric vehicle. The vehicle should be able to be used for both commuting and racing. It will examine different methods of power management to follow the above noted laws and regulations. Other aspects of this thesis will be the construction of a safe, user friendly vehicle prototype, while still providing adequate performance. The thesis hopes 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

Scope

Since the thesis is done within a limited time frame, a substantial part of the thesis was based on prior work.

• The motors, wireless transmitter/receiver, batteries, and battery charger have been 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 noted regulations.

• 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 on the board, but is not documented.

1.4

Method

(18)

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 improve traction 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 Fusion

360 rendered in Blender.

The

(19)

CHAPTER 2. THEORY

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

Figure 2.2. Exploded view of a truck. The hanger is marked blue, the connecting

elements 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 are pressure fited into the hub of the wheel and a spacer can be used to lower the axial load on the bearings thus improving bearing life[18]. See Figure 2.3. Having bigger wheels make the board less susceptible to uneven terrain. The higher wheels can however add weight and raise the height of the board, making it more difficult for the user to reach the ground.

Figure 2.3. Exploded view of a wheel assembly. The wheel is blue, bearings red

(20)

2.2. PERMANENT MAGNET SYNCHRONOUS MOTOR AND SPEED CONTROLLERS

2.2

Permanent magnet synchronous motor and speed

controllers

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, commonly known as an “electric speed controller” (ESC), to generate the alternating currents needed 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. Without feedback, the ESC has no way of knowing if the motor is spinning or how fast the motor is spinning. This makes motors without feedback very susceptible to stalling during changing loads. Stalling occurs when the rotation of the magnetic field falls out of sync with the rotation of the rotor, thus resulting in a loss of torque. With feedback, the ESC can continuously monitor the rotor’s position and thereby control the rotation of the magnetic field accordingly. Some methods of providing feedback are: Back EMF and Hall effect sensor [20].

Back EMF measures the voltage generated by the relative rotation between the magnetic 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 no relative motion is present. Back EMF requires a more complex ESC to be able to monitor each phase’s voltage but can be used on any motor [21, 19]. This method may be called “sensorless” since no external sensors are needed.

The hall effect sensor method uses sensors placed around the motor’s periphery to 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 sensor with 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, a relatively precise position can be read. This solution gives high precision feedback which gives good low speed torque [22].

(21)

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 Adobe

Illustrator.

Since the motors can have more than one pole per winding, the motors may run at a different frequency, fmec, than that of the electric frequency, fel. The total

amount of motor poles, p, will determine the ratio between the two frequencies [20]. fmec=

fel·2

p (2.1)

Further the rotational speed of the motor, ωmec will be a result of the electrical

“rotational speed”, ωel.

ωmec=

ωel·2

p (2.2)

A generalized equation for the mechanical output power, Pmec, of a BLAC motor is

depending on the current, I, and mechanical efficiency cos ϕ [20]. A schematic can be seen in Figure 2.5.

Pmec= 3 · Eph· Icos ϕ (2.3)

Here Ephis the back EMF generated by a phase for a certain rotational speed. This

depends 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 between two phases, the generated voltage will be that of the back EMF since little to no current 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=

(22)

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 voltage

RI as well as the back EMF[20]. cos ϕ = cos

arctan ωel· LI

RI+ 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 calculate

that 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.

(23)

CHAPTER 2. THEORY

Figure 2.6. Geared drive system [1]. Motor in grey, pulleys highlighted in orange

and belt highlighted in blue. Highlights drawn in Illustrator.

Hub motors are constructed with the motor built into the wheel. This significantly simplifies the mechanical construction of the board. The hub motor design is also less susceptible to dirt and water since the motor is within the wheels. Inboard Technology utilizes this in their board M1 [15]. The gearing of the geared drive can give a higher torque than the hub motors, thus giving better performance while braking and accelerating. While having higher torque, the gearing is reported to feel ”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 to higher efficiencies due to lower frictional losses.

(24)

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 250

Li-ion 3.6 150-180 200-350 315-800

Li-Po 3.7 155 220 260

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

Terminal voltage is the voltage of the battery when measured across the poles with a load applied. This voltage is strongly dependent on the load and on the battery’s internal 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 still have a significant charge. This when the load is high on a battery with high inter-nal resistance. The high current and high interinter-nal resistance will lower the battery’s terminal voltage leading to a lower measurable voltage [20]. Table 2.2 shows differ-ent cutoff voltages for differdiffer-ent technologies.

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

cut off voltage Li-ion/Li-Po[V/cell] Lead acid[V/cell] Normal load 3.0-3.3 1.75

Heavy load 2.7 1.4

(25)

CHAPTER 2. THEORY

While common lead acid batteries are relatively safe, some lithium-based battery technologies have tendencies to combust when improperly handled [27, 4]. In recent years stories about batteries catching fire have surfaced [28, 29]. The US Federal Aviation Administration has compiled a list of over 80 known accidents involving lithium-technology batteries [30].

To minimize the risks associated with Li-ion technology batteries a few points should be 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 rated for [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 cycles while a battery discharged to 90% DOD might only handle a hundred [20]. Figure 2.7 shows the relationship between DOD and cycle life for a lead acid battery, similar results can be expected for the modern battery technologies [33].

(26)

2.5. PPM AND PWM

2.5

PPM and PWM

Pulse position modulation (PPM) and Pulse width modulation (PWM) are both methods of signaling analog data through a digital interface [20, 34]. Both methods are based on a set frequency but use different methods of signaling the data. PWM uses a differing signal length to define the analog value while PPM uses the position of 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. Drawn

in Adobe Illustrator.

(27)

Chapter 3

Demonstrator

The project has a list of goals which it has tried to reach. These goals are based on safety (following the above noted laws and regulations). The aim was also to create a prototype electric board with advanced user feedback functions and to make the ride as practical and comfortable as possible. These goals were (goals with an asterisk 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 be

functionally safe during normal operating conditions.

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

• *The board should have white lights forward and red lights backwards that can be clearly seen from 300m. The lights cannot be blinding or must be able to 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 half

an hour.

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

3.1

The system

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

(28)

3.1. THE SYSTEM

Figure 3.1. System diagram. The orange lines are data and black, power. Drawn

in 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 correct power output, and turns off/on the lights.

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

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

(29)

CHAPTER 3. DEMONSTRATOR

3.2

Logic

3.2.1 Lighting

To 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 with a 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 table 3.1.

Table 3.1. Used LEDs characteristics [7, 8] For use Color Serial number Forward voltage

VF [V]

Forward current IF [mA]

Headlight White GW CS8PM1.PM 2.85 350

Taillight 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 layout and 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 internal

reference 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 a forward current of 350mA.

Rref = 177350 = 506mΩ (3.3)

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

Iout= 177

510 = 347mA (3.4)

The power dissipated by the resistor, PRdis, is:

(30)

3.2. LOGIC

To minimize the power dissipated by the driver, PD dis the driver is connected to

one 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. For the red taillight eight LEDs are used. For the white LEDs six in series are used and two 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 affect the current over each LED. The white and the red LED have forward voltages of 17.1V and 17.2V respectively.

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

3.2.2 Sensors

To monitor the batteries a simple voltage divider board was constructed. The volt-age divider is connected to six of the batteries’ cells. The voltvolt-age dividers convert the high voltage of the battery cells to a predictable lower voltage, which can be safely measured with an MCU. See Appendix G for the voltage divider’s circuit board’s layout and schematic.

Originally digital temperature probes were supposed to monitor battery and motor temperatures, this proved hard to implement with a single MCU and was therefore omitted.

3.2.3 LED matrix

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

3.2.4 MCU

(31)

CHAPTER 3. DEMONSTRATOR

3.3

Driveline

3.3.1 Motors

To validate that the motors would be able to brake with enough force, the required force was determined. With a retardation, aret, of 3 m/2 an 80 kg user, musr, would

need 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 at

the 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, Ltd were 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 and have a rated power of 800 W which gives a total power of 1600 W. A rendering of the 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 roro-tational 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 Fusion

(32)

3.3. DRIVELINE

For a top speed of 20kmh (5.56m/s) the wheel and motor has to rotate at a rotational speed of 123.5 rad/s and the electrical field at 370.5 rad/s. The motor’s EMF at the 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 the inductance L is 13.8µH. With all needed variables known, the factor cos ϕ could be calculated according to formula 2.7. A current of 22A is assumed.

(33)

CHAPTER 3. DEMONSTRATOR

3.3.2 Batteries

To keep the scope of the project within the time constraints, commercially available hobby RC Li-Po batteries have been used.

The maximum continuous power at street mode is 250W. For half an hour the total power consumption, W h1h, comes to 125Wh. A 10-cell battery was chosen

for its nominal voltage of 37V. To keep the batteries’ cycle life high, an maximum discharge of 80% is allowed.

The batteries’ energy content, W h, is calculated by using the maximum allowed discharge. To calculate the required capacity, Ah1h, the highest nominal battery

voltage was used:

W hef f = W h 0.8 = 156.25Wh (3.11) Ah0.5h= W h Vnom = 156.25 37 = 4.22Ah (3.12)

Since Li-Po batteries are only available in some common configurations the final battery pack was based upon one of these. Hong Kong based Hobbyking was used as a source of configurations. A safe discharge rate of 20C is assumed. Table 3.2 has some possible configurations, based both on available batteries and the calculated cell 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 In paral-lel

Cells per

battery Capacityper bat-tery

Total capac-ity

Total

current Totalenergy capacity

Total amount of batteries

2 1 5 5.0Ah 5.0Ah 100A 185Wh 2

2 2 5 3.0Ah 6.0Ah 100A 222Wh 4

5 1 2 5.0Ah 5.0Ah 100A 185Wh 5

5 2 2 3.0Ah 6.0Ah 120A 222Wh 10

(34)

3.3. DRIVELINE

3.3.3 Parking brake

The major technical challenge with the parking brake was how the brake should engage. If constructed incorrectly the brake might accidently stop the board while at 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 one of 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 and Adobe Photoshop.

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

3.3.4 Power distribution

(35)

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 calibrated for the 5V needed for the low voltage components. These modules are capable of converting up to 3A each [42].

Even though the batteries can handle up to 100A continuous discharge the board should not be able to consume that much. A high voltage automotive 50A fuse is implemented 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. See Appendix F for the power distribution board’s layout and schematic.

3.3.5 ESC

Benjamin Vedder’s VESC was chosen for its availability and ease of use. One was used per motor. Each VESC is specified for a continuous power output of 50A at 60V [43]. The VESC has several different methods for controling, monitoring, and powering the motor. The control and power methods were configured using the VESC Tool software [44].

The control methods are:

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

Current – The controller sets the desired current.

(36)

3.4. CONTROL

Early tests demonstrated the current control method most intuitive. Both PID speed control and duty cycle control would accelerate quickly and then freewheel, jolting the user, back and forwards. While this can be fixed by changing ramping variables, these control methods provided no overwhelming advantage over cur-rent control. Curcur-rent 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 a BLAC.

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 the motors.

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 the motors’ and batteries’ specifications.

3.4

Control

3.4.1 Hand controller and receiver

(37)

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 to center 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 board would accelerate/brake.

Since an AW-dev was needed, a buzzer with internal oscillator was purchased. The buzzer, 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-button to activate the buzzer. See Appendix H for the buzzer circuit board’s layout and schematic. Since the included battery is quite small an 18650 cell was added to improve the controller’s battery life.

To fit all the parts within the controller a new 3D-printed shell was designed. An exploded view of the controller design can be seen in Figure 3.6. See Appendix J for 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,

(38)

3.5. STRUCTURE

3.5

Structure

3.5.1 The Deck

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

Figure 3.7. Placement of the three compartments. Battery compartments in blue

and the main compartment in orange. Drawn in Adobe Illustrator

construction methods to keep the weight low. The deck’s structure is shown in Figure 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 images of the completed board. The whole board without any components weighs about 2000g this is comparable to similarly wooden sized boards [47].

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

(39)

CHAPTER 3. DEMONSTRATOR

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

(40)

3.5. STRUCTURE

3.5.2 Trucks and wheels

To 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 need to have the stator locked. Maytech MTSKT1614B that lock the stators was used for the back truck and Maytech MTSKT1614F for the front. For the front wheels Maytech MTSKW1614 were chosen to match the diameter of the back wheels. 3.5.3 Lids

Two lids were made, one to cover and hold the batteries and one to cover the electronics. The lid that covers the electronics also has momentary push button with a LED built-in. A render of the electronics lid can be seen in Figure 3.9. They were made by vacuum forming, a process where a heated plastic sheet is pulled down on a form using vacuum. The sheet is allowed to cool and harden. Then the excess plastic is removed.

Figure 3.9. Render of the main lid. The push-button is seen as black and red on

(41)

CHAPTER 3. DEMONSTRATOR

3.5.4 Lenses

Two 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 be seen in Figure 3.10.

Figure 3.10. Render of the front lens. Note the 6 divots for the LED. Designed in

Autodesk Fusion 360 rendered in blender.

3.6

Software

The final part of the board was the software. The software is responsible of 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 the length of the pulse and therefore proportional to the analog signal value. To send the signal to the VESCs, the MCU simply sends a high pulse with a corresponding length to the desired throttle/power output.

Switching between modes is done by pressing and holding the push-button while connecting 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, this is called “Normal throttle” since no conversion occurs.

(42)

3.6. SOFTWARE

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

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

Lastly if the throttle is forward the MCU runs the “Power check functions”, these functions monitor and controls the board’s power continuously. The monitoring of the 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 and cut off the power if the running average exceeded 250W. The function’s flowchart can be seen in Figure 3.11.

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

Average- here the Arduino monitored the board’s power and limited the power if the average over a certain period exceeded 250W. The function’s flowchart can be seen 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 to indicate that the board is applying its brakes.

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

(43)

CHAPTER 3. DEMONSTRATOR

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

(44)

3.6. SOFTWARE

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

Illustrator.

Figure 3.14. Flowchart for the push-button interrupt function that changes between

(45)

CHAPTER 3. DEMONSTRATOR

(46)

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 80m stretch. A 65kg rider started from standstill. The rider began by setting the control to fully forward, and then set the control to full brake to stop at the 80m mark. This was done at least 4 times per mode alternating direction each time. A cellphone with a K6DS3TR Acceleration Sensor was held horizontal during the test. The acceleration data was logged. Lastly the data for acceleration in the horizontal plane 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. At the end of the ride the batteries voltages were written down. Also, the elevation gain and loss were noted. From the battery voltages an estimate of the used energy was made. This combined with the time made calculation of the average power consumption possible.

4.3

Light pattern measurements

(47)

CHAPTER 4. EXPERIMENTS

bicycle headlight and a Lezyne Strip Drive bicycle taillight. Lastly the data was loaded 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 test

A straight piece of road was used to measure at which point the lights could not be seen. The board’s lights were set to 25% and then 100%. The board’s were run in both directions and as far as could be seen.

4.5

Parking brake test

(48)

Chapter 5

Findings

5.1

Acceleration and retardation

Only 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 would accelerate intermittently. “Simple power limiting” method was the quickest. While data shows that the board decelerated at a rate of above 3.0m/s2during most

(49)

CHAPTER 5. FINDINGS

Table 5.1. Acceleration data from the different power modes.

Simple power limiting: Running average cutoff:

(50)

5.2. RANGE

5.2

Range

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

Table 5.2. Noted data from the range test. Ride # Length

[km] Time[min] Climband Fall [m]

Battery

(51)

CHAPTER 5. FINDINGS

5.3

Light pattern

The interpolated data is shown in Figures 5.1 to 5.4. The actual measurements are shown in the Matlab code as Appendix D.

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

(52)

5.3. LIGHT PATTERN

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

Matlab.

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

(53)

CHAPTER 5. FINDINGS

5.4

Light strength

The light range test showed that the board can be seen with 25% or 100% light intensity 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 brake

The 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

(54)

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 be desired in terms of space. The lids’ ability to keep dust out of the compartments was underwhelming.

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

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

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

(55)

CHAPTER 6. DISCUSSION AND CONCLUSION

more current and therefore power, but without continuous monitoring, it is hard to confirm. Calculating used energy from the battery voltages is not the most exact way 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 was quite 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 total light pattern, specially more points under the horizontal axis. The parking brake tests 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 the acceleration and light pattern tests, purpose-built sensors might have given more accurate 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 under this 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 be

functionally safe during normal operating conditions. Worked at higher speeds.

• The board should have a parking brake that can keeps the board stationary on a 15° incline, even without electrical power. This brake should not be a danger to the user if accidentally engaged.

The parking brake was not able to hold the board. Flipping the board over proved more than adequate.

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

Implemented and working.

(56)

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 half an hour.

Technically possible more tests needed.

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

(57)

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 MCUs could allow for continuous monitoring of the batteries voltages and temperatures. With more time a PID control method could be implemented, this might improve the jerkiness of “running average” control method.

An ambient light sensor could be implemented to control the brightness of the head 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 differentiate better between the different control modes.

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

(58)

Bibliography

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

[2] Woodbank Communications, “Electropaedia, Energy Sources and Storage and 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 utility energy storage: A review,” feb 2018. [Online]. Available: https: //www.sciencedirect.com/science/article/pii/S2352152X17304437

[5] I. Buchmann, “Basic to Advanced Battery Information from Battery University,” 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.busiBusi-nessinsider.com/ cities-going-car-free-2017-2?r=US&IR=T

(59)

BIBLIOGRAPHY

[12] Transportstyrelsen, “Nya milj¨ozoner kan ge renare luft i st¨aderna,” 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 v¨agtrafikdefinitioner Svensk f¨orfat-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 f¨oreskrifter om cyklar, h¨astfordon och

sparkst¨ottingar,” 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 mechanical

advantage,” 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, and M. Paulson, Elektroteknik, 2013th ed., M. Paulson, Ed. Stockholm: Institu-tionen f¨or maskinkonstruktion, Tekniska h¨ogsk., 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

(60)

BIBLIOGRAPHY

[24] K. Y. Nam, W. T. Lee, C. M. Lee, and J. P. Hong, “Reducing torque ripple of brushless DC motor by varying input voltage,” in IEEE Transactions 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 and exploded — 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 & LITHIUM

BATTERY-POWERED DEVICES Aviation Cargo and Passenger Bag-gage Events Involving Smoke , Fire , Extreme Heat or Explosion Involving 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/discharge characteristics li

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

(61)

BIBLIOGRAPHY

[35] J. Mal´aˇsek, “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-sp¨anningsreg-ulator Switchad - Str¨omf¨ors¨orjning.” [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/

(62)

Appendix A

Arduino code to control the board

A.1

The main code

1 /* Project name: Eboard 2 Author: Leo Sodergren 3 Date: 2018-05

4 School: KTH 5 Course: MX133X

6 Description: Code for controlling the electric board prototype

7 Configuration:

8 MCU: ATmega2560

9 Clock Speed: 16 MHz

10 Board: Arduino MEGA

11 Used pins: See config

12 */ 13

14 // Includes the needed libraries 15 #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> 24 25 26

(63)

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD 28 29 30 // ---Varible Initilization ---31

32 // Initilizes the volitile varibles 33

34 volatile int ThrottleIn = 0; // volatile, we set this in the Interrupt and read it in loop so it must be declared volatile

35 volatile unsigned long ulStartPeriod = 0; // set in the interrupt

36 volatile int state = 1; 37

38

39 // Initilizes varibles 40

41 int mode;

42 int timN=0; //times neutral

43 int Mfull = false; //defines the matrix empty

44 int BLS=0; //backligt base brightness

45 float motor_current = 0.0; //Measured motor current 46 float batvoltage = 35.0; //Measured battery voltage,

starts at

47 float c_speed = 0.0; //Measured rpm

48 float power = 0.0; //Measured power

49 float avaragePWR; //Average power

50 unsigned long sum; //The sum of the poweroutput

51 int averagenum=0; //Number avarage samples

starts at 0

52 int PWRarray[avragrot]; //Initilizes the avrrage array

53 int calulated_Throttle=0; //Starts the calculate throttle at 0

54 int index; 55

56 bool cellstate[]={false,false,false,false,false};// cell state. False means ok.

57 char cellstr[]={’1’,’3’,’5’,’8’,’X’};// cell str 58

59

60 struct bldcMeasure measuredValues; 61

(64)

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); 67 68 69 // ---Interrupt functions---70 void interrupt(){//Interrupt function for street mode 71

72 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 time

76 ThrottleIn = (int)(micros() - ulStartPeriod); 77 ulStartPeriod = 0;

78 }

79 } 80

81 void racemodeinterrupt(){//Interrupt function for race mode 82 // if the signal pin is high, set the pin high

83 if(digitalRead(Siginpin) == HIGH){ 84 digitalWrite(Sigoutpin, HIGH); 85 ulStartPeriod = micros();

86 }

87 else {// if the pin is low set the output low 88 digitalWrite(Sigoutpin, LOW);

89 ThrottleIn = (int)(micros() - ulStartPeriod); 90 ulStartPeriod = 0;

91 }

92 } 93

94 void cstate(){// Function to change state turn on off lights .

95 static unsigned long last_interrupt_time = 0; //Defines static function varible

96 unsigned long interrupt_time = millis();

97 if (interrupt_time - last_interrupt_time > 200){ // If interrupts come faster than 200ms, assume it’s a bounce

and ignore, source: [mikalhart forum.arduino.cc] 98 if(state==1){

99 state=2;

(65)

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD

brightness set in Config.h 101 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 lights 107 digitalWrite(BLpin,LOW);

108 BLS=0; //sets the backlight base brightness 0;

109 } 110 111 } 112 last_interrupt_time = interrupt_time; 113 } 114 115 116 // ---SETUP---117 void setup() {

118 pinMode(Pbutpin, INPUT_PULLUP); //Set push-button as input with internal pullup

119 pinMode(Siginpin, INPUT_PULLUP); 120

121 //Set various outputs

122 pinMode(Sigoutpin, OUTPUT); 123 pinMode(Servopin, OUTPUT); 124 pinMode(BLpin, OUTPUT); 125 pinMode(FLpin, OUTPUT); 126 pinMode(PBled, OUTPUT); 127

128 analogWrite(PBled,20); 129

130 for(int index=0; index<=avragrot; index++){ //Sets up an average array, if not used comment out

131 PWRarray[index]=0; 132 } 133 134 //Starts matrix 135 matrix.begin(); 136 matrix.setTextWrap(false);

137 matrix.setBrightness(Mbr); //Sets the brightness of the matrix acording to that set in Config.h

(66)

A.1. THE MAIN CODE

139 matrix.show(); 140

141 //Serial begin

142 Serial1.begin(115200);

143 //Serial.begin(115200); //debug serial over usb not needed for normal use.

144 145

146 if (digitalRead(Pbutpin) == HIGH){ // Checks if push-button pressed at start if so goes into race mode 147 attachInterrupt(digitalPinToInterrupt(Siginpin),

interrupt,CHANGE);

148 attachInterrupt(digitalPinToInterrupt(Pbutpin),cstate,

FALLING);

149 mode=1;

150 }

151 else{

152 raceM();

153 attachInterrupt(digitalPinToInterrupt(Siginpin), racemodeinterrupt,CHANGE);

154 attachInterrupt(digitalPinToInterrupt(Pbutpin),cstate,

FALLING);

155 mode=2;

156 }

157

158 delay(500); //Delay 500ms to be shure to have an first interrrupt 159 } 160 161 // ---MAIN---162 void loop() { 163 if (mode==2){ // 164 racemode(); 165 } 166 else{ 167 streetmode(); 168 } 169 } 170 171 //---Mode functions---172 void streetmode(){ 173 brakelights(); 174

(67)

APPENDIX A. ARDUINO CODE TO CONTROL THE BOARD high error 176 timN=0; 177 neutralThrottle(); 178 errorM(); 179 } 180 else if(ThrottleIn<(Min_Throttle-Throttle_fault)){//Signal too low error

181 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 been enough times switch to monitoring mode

187 voltcheck(); 188 batteryerror(); 189 neutralThrottle(); 190 } 191 else{ 192 normallThrottle(); 193 timN++; 194 } 195 }

196 else{ //Normal throttle

197 timN=0;

198 clearM();

199 readvesc();// Tries to read the VESC

200 // Here the wanted power limiting method is set. 201 //PWRavarage(); // "Running average" mode

202 //PWRavaragecutoff(); //"Running average cutoff" mode 203 PWRavarageclocks(); //"Average" 204 } 205 } 206 207 void racemode(){ 208 brakelights(); 209 } 210

211 //---Power mode functions---212 void PWRavaragecutoff(){

(68)

A.1. THE MAIN CODE

214 averagenum++;

215 avaragePWR=sum/averagenum;

216 }

217 else{

218 long sum= sum+power; 219 averagenum++; 220 avaragePWR=sum/averagenum; 221 } 222 if (avaragePWR<=maxpower||ThrottleIn<=Neutral_Throttle-Deadband_Throttle){ 223 normallThrottle(); 224 } 225 else{ 226 neutralThrottle(); 227 } 228 } 229 230 void PWRavarage(){ 231 if (ThrottleIn<=Neutral_Throttle-Deadband_Throttle){//if braking do no conversion 232 averagenum++; 233 avaragePWR=sum/averagenum; 234 } 235 else{ 236 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 else{ 248 normallThrottle(); 249 } 250 } 251

References

Related documents

Over its history, the Kemano Power Project has been viewed as an engine for northern industrial development, an in- spiration for economic expansion, a blight on the northern

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

Both Brazil and Sweden have made bilateral cooperation in areas of technology and innovation a top priority. It has been formalized in a series of agreements and made explicit

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in

Generella styrmedel kan ha varit mindre verksamma än man har trott De generella styrmedlen, till skillnad från de specifika styrmedlen, har kommit att användas i större

Närmare 90 procent av de statliga medlen (intäkter och utgifter) för näringslivets klimatomställning går till generella styrmedel, det vill säga styrmedel som påverkar

By using concepts from theories of profession, front-line bureaucracy and power, and by conducting interviews with physicians at 6 hospitals the study thoroughly

The first design to switch the power to the ignition coil on and off in order for the spark plug to spark, was based on a computer programmable micro controller board sold under