<<

University of Illinois at Urbana-Champaign

ECE 445: Senior Design Laboratory

Spring 2016

Design Review Electronic Bike Shifting

Team 51: Peter Kowalczyk Teaching Assistant: Kevin Luong Katherine O’Kane Matthew Potok Contents

1 Introduction 1 1.1 Statement of Purpose ...... 1 1.2 Current Competitors ...... 1 1.3 Objectives ...... 1 1.3.1 Goals/Benefits ...... 1 1.3.2 Functions/Features ...... 1

2 Design 2 2.1 Block Diagram ...... 2 2.2 Schematics ...... 3 2.2.1 User Input Subsystem ...... 3 2.2.2 Shift Subsystem ...... 4 2.3 Block Description ...... 5 2.3.1 Summary ...... 5 2.3.2 User Input Subsystem ...... 5 2.3.2.1 Microcontroller (ATtiny84) ...... 5 2.3.2.2 Battery (Sparkfun Polymer Lithium Ion) ...... 5 2.3.2.3 User Input (Buttons) ...... 5 2.3.2.4 Bluetooth Module (RN-42) ...... 6 2.3.3 Shifting Subsystem ...... 6 2.3.3.1 Microcontroller (ATtiny84) ...... 6 2.3.3.2 Battery (EC Tech YN-025) ...... 7 2.3.3.3 Servo (JX-Servo 5512MG) ...... 7 2.3.3.4 Accelerometer (Memsic 2125) ...... 7 2.3.3.5 Bluetooth Module (RN-42) ...... 7 2.3.3.6 Cable ...... 8 2.3.3.7 ...... 8 2.4 Hardware ...... 8 2.5 Software ...... 11 2.5.1 User input subsystem ...... 11 2.5.2 Shift subsystem ...... 12 2.6 Calculations, Simulations, and Experiments ...... 12 2.6.1 Power Consumption ...... 12 2.6.1.1 User Input Subsystem ...... 12 2.6.1.2 Shift System ...... 12 2.6.2 Accelerometer Experiment on Test Bike ...... 13

3 Requirements and Verifications 14 3.1 User Input Subsystem ...... 14 3.1.1 Microcontroller [2.5 points] ...... 14 3.1.2 Battery [2.5 points] ...... 15 3.1.3 Bluetooth Module [6 points] ...... 16 3.2 Shifting Subsystem ...... 17 3.2.1 Microcontroller [5 points] ...... 17 3.2.2 Battery [5 points] ...... 17 3.2.3 Servo [17 points] ...... 18

i 3.2.4 Accelerometer [6 points] ...... 18 3.2.5 Bluetooth Module [6 points] ...... 19

4 Tolerance Analysis 19

5 Cost and Schedule 21 5.1 Cost Analysis ...... 21 5.1.1 Labor ...... 21 5.1.2 Parts ...... 21 5.1.3 Total ...... 21 5.2 Schedule ...... 22

6 Safety Statement 22 6.1 Battery Safety ...... 23

7 Ethics 23

References 24

List of Figures

1 Block diagram ...... 2 2 User input subsystem schematic ...... 3 3 Shift subsystem schematic ...... 4 4 Servo mount in isometric view ...... 9 5 Servo mount in exploded view ...... 9 6 Servo mount from bottom view ...... 10 7 Servo mount location ...... 10 8 Direct rear derailleur drive mechanism ...... 11 9 Plot of accelerometer experiment with x-axis perpendicular ...... 13 10 Plot of accelerometer experiment with x-axis parallel ...... 14 11 Lever arm length ...... 20

List of Tables

1 User input microcontroller I/O ...... 5 2 User input Bluetooth I/O ...... 6 3 Shift microcontroller I/O ...... 6 4 Shift accelerometer I/O ...... 7 5 Shift Bluetooth I/O ...... 8 6 User input subsystem battery specs ...... 12 7 Power consumption of user input subsystem ...... 12 8 Shift subsystem battery specs ...... 12 9 Power consumption of shift subsystem ...... 13 Assorted requirements and verifications tables ...... 14 10 Cost of labor ...... 21 11 Cost of parts ...... 21 12 Total cost ...... 21

ii 13 Schedule ...... 22

iii 1 Introduction

1.1 Statement of Purpose Electronic shifting systems have long been an expensive upgrade to their older mechanical counterparts. Currently, only professional racing cyclists have the funds to invest in electronic gear shifting, which have significant advantages compared to mechanical shifting. For example, programming can compensate for poor adjustment and ensure better shift quality. The system can self-calibrate, so there would be fewer adjustments. The electronics, when sealed, are not affected by the elements; whereas mechanical systems rely on cables that must remain exposed. Electronic systems age at a slower rate too, since firmware can be simply updated. Also, wireless communication allows users to have multiple shift points to increase ergonomics. Despite these advantages, currently no retrofittable high-performance economical wireless pack- age exists. With our product, both casual cyclists and serious athletes without sponsor funding will be able to enjoy reliable biking without the hassle of maintenance.

1.2 Current Competitors In traditional mechanical systems, it has been found that slightly overshooting the targeted gear and returning results in the best quality shift. Unfortunately, due to mechanical limitations in the ratchets found in all modern units, this overshoot-return technique can only be applied in one direction. Mechanical systems also rely on springs, and using cables to counter the natural rest state of these springs. This becomes particularly problematic with large tooth count drops in front shifting. In essence, when shifting from the large front chainring to the small front chain ring, a large length of chain is released. The rear derailleur uses a spring to wind back its cage to “soak” up this excess chain length in an effort to restore tension to the chain. The spring often pulls very hard and ends up “throwing” the chain off the front chainrings. At least in the Di2 system, the entire derailleur is motorized; there is no dependence on cables. Motors can be effortlessly configured to apply this overshoot-return technique in both directions. Furthermore, the rear derailleur pulley cage spring is replaced with a motor to gently (instead of suddenly) restore tension to the chain. The Di2 system also permits the addition of extra shift buttons to be placed in convenient places, such for sprinting and for climbing. Of the main three competitors of shifting componentry, Shimano, , and SRAM, only SRAM has released a wireless version.

1.3 Objectives 1.3.1 Goals/Benefits • Little to no maintenance/adjustments required, especially in adverse conditions • Equal or better shift quality to average mechanical system • Improved ergonomics • Reliable performance

1.3.2 Functions/Features • Automatic trimming: the derailleur cage adjusts automatically to prevent chain rub against the cage, but still maintain the desired gear ratio

1 • Successful shift confirmation system: using a closed feedback loop, the derailleur will move until a shift is determined to be successful • Retrofittable package: the system will work with most existing • At least 100 hours of battery life, which is comparable to competitors • Battery level indicator • Shifter buttons only affect user’s own bike and not any other nearby electronic shifting systems

2 Design

2.1 Block Diagram

)

42) -

Power Sparkfun Polymer (RN (

Lithium Ion Bluetooth module module Bluetooth

Power Connection Input/Output Connection Bluetooth Mechanical Connection User InputSystem (ATtiny84) (Buttons) User Input Microcontroller

)

)

Servo Servo 551MG ADXL362 Cable - ( (ATtiny84) JX Derailleur ( Accelerometer Microcontroller (Rear Derailleur) (Rear stem

)

42) - 025 - Power EC Tech (RN YN ( Shifting Sy Bluetooth module module Bluetooth

Figure 1: Block diagram

2 2.2 Schematics 2.2.1 User Input Subsystem

Figure 2: Circuit schematic for user input subsystem

3 2.2.2 Shift Subsystem

Figure 3: Circuit schematic for shift subsystem

4 2.3 Block Description 2.3.1 Summary Our system will be split into two parts: a user input subsystem and a shifting subsystem. The former subsystem will handle user input and transmit it wirelessly via Bluetooth. The latter subsystem will receive the Bluetooth packets and control a servo to shift the rear derailleur. Each subsystem will be powered by its own separate battery. More details on the individual subsystems and their parts can be found below.

2.3.2 User Input Subsystem 2.3.2.1 Microcontroller (ATtiny84) The microcontroller collects user input through button presses and forwards the data to the Bluetooth module. It will also incorporate a small circuit to measure the voltage of the battery and set three LEDs’ statuses accordingly. The microcontroller can be powered anywhere from 2.7 V to 5.5 V. [1] The current iteration of the circuit schematic assumes that the microcontroller will be powered with 5 V; however, if during testing it is found that 3.3 V is sufficient, then the design will changed appropriately. This will eliminate the need to include the level shifting circuits between the Bluetooth module and the microcontroller.

Pin # Function Connection 1 VCC +5 V 2 TX, serial transmitter RN-42 Bluetooth module (13) 3 RX, serial receiver RN-42 Bluetooth module (14) 6 Digital input Upshift button 7 Digital input Downshift button 10 Analog input Battery voltage measurement 11 Digital output Green LED 12 Digital output Yellow LED 13 Digital output Red LED 14 GND 0 V

Table 1: User input subsystem microcontroller I/O configuration [1]

2.3.2.2 Battery (Sparkfun Polymer Lithium Ion) This power source is connected to the microcontroller and the Bluetooth module. There are no mechanical components in this subsystem, so a significant source of power is not needed. This battery provides 3.7 V and 200 mA of current. It has 2000 mAh. Based on our calculations on page 12, this power supply should provide nearly 111 hours of power.

2.3.2.3 User Input (Buttons) Sets of buttons, minimum of two per derailleur, to accept shift commands. One button upshifts, and the other downshifts. The button state is listened to by the microcontroller.

5 2.3.2.4 Bluetooth Module (RN-42) The Roving Network RN-42 Bluetooth module receives user input data from the microcontroller via a serial port and transmits it to the other Bluetooth module in the shifting subsystem. It will be configured to send data at a baud rate of 9600 and takes in an input voltage of 3.3 V. [2] Additionally, a few of its pins will be wired to LEDs for status purposes.

Pin # Function Connection 1 GND 0 V 4 Baud rate +3.3 V 5 Active LOW reset Reset button 11 VDD +3.3 V 12 GND 0 V 13 UART RX, serial receiver ATtiny84 (2) 14 UART TX, serial transmitter ATtiny84 (3) 19 Status, HIGH when connected LED 21 Status, toggles based on state LED 28 GND 0 V 29 GND 0 V 31 Status (RF data RX/TX) LED

Table 2: User input subsystem Bluetooth module I/O configuration [2]

2.3.3 Shifting Subsystem 2.3.3.1 Microcontroller (ATtiny84) The microcontroller receives data from the connected Bluetooth module and uses this data to control a servo to perform shifts with the rear derailleur. Simultaneously, it polls the accelerometer during shifts commands and acts as a redundancy system to ensure that the rear derailleur has indeed shifted. Similarly to the user input subsystem microcontroller, this one will feature a battery voltage indicator circuit with LEDS and may have its inputs voltage changed from 5 V to 3.3 V depending on testing. [1]

Pin # Function Connection 1 VCC +5 V 2 TX, serial transmitter RN-42 Bluetooth module (13) 3 RX, serial receiver RN-42 Bluetooth module (14) 5 PWM signal JX-Servo 5521MG (data) 8 Digital input Memsic 2125 (5) 9 Digital input Memsic 2125 (2) 10 Analog input Battery voltage measurement 11 Digital output Green LED 12 Digital output Yellow LED 13 Digital output Red LED 14 GND 0 V

Table 3: Shift subsystem microcontroller I/O configuration [1]

6 2.3.3.2 Battery (EC Tech YN-025) This battery powers all of the shifting subsystem. It provides 3.7 V and 1000 mA. It has 22 400 mAh.1 It is connected to the microcontroller, servo, accelerometer, and Bluetooth module. This subsystem requires more power due to the mechanical energy needed by the servo. Based on our calculations on page 13, this power supply should provide 263 hours of power.

2.3.3.3 Servo (JX-Servo 5512MG) The 5512MG servo will be responsible for pulling the cable connected to the rear derailleur. This motion enacts gear shifts. The servo has a maximum of 20.32 kg cm at 6 V [3], which provides enough pulling capabilities to change to any gear. It will also need to hold its position when a shift is not in progress. This will be a constant source of power consumption, though it is smaller than gear shift. The microcontroller will command the servo to switch to certain angles. Each angle causes a certain amount of tension on the cable, and different tension levels cause a gear shift to a specific gear. Each servo angle change will cause the derailleur to shift to another gear. The rest of the time, the servo will hold the tension on the cable constant in order to keep the gear the same.

2.3.3.4 Accelerometer (Memsic 2125) The accelerometer tracks movement of the derailleur cage. Mid-shift, there will be a lot of move- ment, and pre- and post- shift periods are largely defined by periods of relatively low movement. We are currently considering either a 2-axis or 3-axis accelerometer.

Pin # Function Connection 2 Digital output ATtiny84 (9) 3 GND 0 V 4 GND 0 V 5 Digital output ATtiny84 (8) 6 VCC +5 V

Table 4: Shift subsystem accelerometer module I/O configuration [4]

2.3.3.5 Bluetooth Module (RN-42) The Roving Network RN-42 Bluetooth module receives data from the other Bluetooth and transmits its microcontroller via a serial port and transmits it to the other Bluetooth module in the shifting subsystem. It will be configured to send data at a baud rate of 9600 and takes in an input voltage of 3.3 V. [2] Additionally, a few of its pins will be wired to LEDs for status purposes.

1See Table 8

7 Pin # Function Connection 1 GND 0 V 4 Baud rate +3.3 V 5 Active LOW reset Reset button 11 VDD +3.3 V 12 GND 0 V 13 UART RX, serial receiver ATtiny84 (2) 14 UART TX, serial transmitter ATtiny84 (3) 19 Status, HIGH when connected LED 21 Status, toggles based on state LED 28 GND 0 V 29 GND 0 V 31 Status (RF data RX/TX) LED

Table 5: Shift subsystem Bluetooth module I/O configuration [2]

2.3.3.6 Cable A stainless steel cable that pulls against the compression spring in the rear derailleur. By applying tension, users can access other than the smallest cog.

2.3.3.7 Derailleur Performs the shifting. Using a parallelogram linkage system, it translates the cable pull mo- tion to lateral motion across a cluster. A separate spring controls the chain tension by automatically adjusting the angle of the pulley cage relative to the derailleur body.

2.4 Hardware A significant part of the project is actuating the derailleur mechanism. This can be accomplished by several ways. To ensure 100% universality, and thus retrofittability, the best method is cable actuation, since all derailleurs since the 1950s, with the exception of the electronic derailleurs, are cable actuated. To this end, a servo mount and cable puller was CADed. It is shown in Figure 4, 5, and 6.

8 Figure 4: Servo mount in isometric view

Figure 5: Servo mount in exploded view

9 Figure 6: Servo mount from bottom view

The cylinder in Figures 4, 5, and 6 represents a dummy seatstay, which is identified in Figure 7.

Figure 7: Servo mount location [5]

The servo mount is designed to be 3D printed and held in place by zip ties for ease of use and inner tube protective shims to protect against frame damage and increase friction. The mount is located away from the chain stay, which, despite having often a brazed cable stop, is vulnerable to chain slap and debris being kicked up. However, cable actuation has its drawbacks. For one, one cannot compress a cable, downshifts are limited to the spring coefficient in derailleur. There exists a balance, as having a higher spring coefficient gives faster downshifts, but the servo must constantly work against the spring, both during shifts and when maintaining a sprocket selection. This disparity causes the same lack of symmetry in shift quality as seen in purely mechanical systems. Worse yet, the servo will draw power regardless of its position, except for the smallest sprocket selection. This will lead to significant power draw and shorten battery life considerably. The alternative, then is to directly drive the derailleur. As with cable actuation, there are also many ways of completing this task, but many of them involve replacing the derailleur pins to secure

10 an additional mounting position. Rear derailleurs vary greatly in their geometries, making direct actuation difficult, especially since there are only ever, at minimum, two threaded positions – the barrel adjuster, and the cable anchor bolt. To this end, a direct drive system was designed, and is shown in Figure 8.

Figure 8: Direct rear derailleur drive mechanism [6]

It exploits the fact that the barrel adjuster and cable anchor location are planar. Thus, a rigid, steel piece (shown in red) can be placed with a slot matching the diameter of the bolt. Pulling the red piece through the barrel adjuster using a sunken rack will shorten the length available on the parallelogram side. The anchor bolt will slip inside the slot. This way, the spring can be cut, and a lower torque, and thus lower power servo can be used. No power will be necessary to maintain any gear except against vibration. There may be difficulties with mounting the servo securely, as two points are required to rigidly and reliably affix the servo, where only one is available. In addition, the red steel piece may not fit all derailleur geometries, but it is likely to work for most.

2.5 Software 2.5.1 User input subsystem The software for the microcontroller on the user input subsystem is fairly straightforward. All the system needs to do is:

1. Start up

2. Connect the Bluetooth module to the corresponding module on the shifting subsystem

3. Listen to state of button inputs

4. Send a simple packet on the Bluetooth module if the upshift button is pressed or the downshift button is pressed

The Bluetooth packet will just say which type of shift the user has requested.

11 2.5.2 Shift subsystem The software for the microcontroller on the shift subsystem is more involved because it is responsible for a servo and accelerometer. After start up and connecting to the other Bluetooth module, the software must listen for incoming Bluetooth messages. It should also set a default gear for system consistency. If an incoming message is a downshift, the software must reduce the gear. Otherwise, it must increase the gear. To do so, the software must keep track of the current gear. The software keeps a predefined list of servo angles to corresponding gear. This is created by a human and stored. On a downshift, the microcontroller will set the angle according to this list. During a gear shift, the software monitors the accelerometer for shaking. Once the shaking has stopped, the software knows the gear shift has been completed.

2.6 Calculations, Simulations, and Experiments 2.6.1 Power Consumption 2.6.1.1 User Input Subsystem

Battery Voltage (V) Current (mA) Amp-hours (mAh) Sparkfun Polymer Lithium Ion 3.7 200 2000

Table 6: User input subsystem battery specs

Components Voltage (V) Current max (mA) Current min (mA) ATtiny84 5 9 @ active 8MHz .01 @ sleep RN-42 Bluetooth 3.3 50 @ data transfer 12 @ idle, sniff 100ms 5050 SMD 2.4, 3.8, 3.8 90 @ continuous 6 @ intermittent Total 5 149 18.01

Table 7: Power consumption for user input subsystem components

2000 mAh • Maximum battery life = 18.01 mA = 111.049 h 2000 mAh • Minimum battery life = 149 mA = 13.4228 h

The LEDs (5050 SMD) in Table 7 are likely going to be on only intermittently, and the Bluetooth module will not be transmitting constantly. Therefore, our typical user input subsystem battery life will be closer to the maximum (111 hours) than to the minimum (13 hours).

2.6.1.2 Shift System

Battery Voltage (V) Current (mA) Amp-hours (mAh) EC Tech YN-025 3.7 1000 22400

Table 8: Shift subsystem battery specs

12 Components Voltage (V) Current max (mA) Current min (mA) ATtiny84 5 9 @ active 8MHz .01 @ sleep RN-42 Bluetooth 3.3 50 @ data transfer 12 @ idle, sniff 100ms Memsic 2125 3.3 5 < 5 JX-Servo 5521MG 5 15 8 5050 SMD 2.4, 3.8, 3.8 90 @ continuous 6 @ intermittent Total 5 169 31.01

Table 9: Power consumption for shift subsystem components

22 400 mAh • Maximum battery life = 31.01 mA = 722.348 h 22 400 mAh • Minimum battery life = 169 mA = 132.544 h As in the user input subsystem, the LEDs (5050 SMD) in Table 9 will only be on intermittently. Our real current maximum will be 169 mA − 90 mA + 6 mA = 85 mA. Therefore, our real minimum 22 400 mAh battery life will be 85 mA = 263.53 h.

2.6.2 Accelerometer Experiment on Test Bike For our software to detect when a gear shift has ended, it needs to detect the end of oscillation on the derailleur. To determine whether accelerometer data would be good enough, we attached an accelerometer to the derailleur on a bike held in place on a trainer. This allowed us to analyze real-world data. We collected data while a person shifted and pedaled with their hand.

Figure 9: Plot of the x-axis of the accelerometer with the x-axis perpendicular to the and pointing toward the derailleur. Annotated with selected gear.

In Figure 9, we shifted approximately every 100 deciseconds without a noticeable difference in the data. In hindsight considering the accelerometer’s orientation, it is obvious why this data is useless.

13 Figure 10: Plot of the x-axis of the accelerometer with the x-axis parallel to the bicycle and along side the derailleur. Annotated with selected gear.

In Figure 10, we also shifted approximately every 100 deciseconds. As shown by the annotations, the shifts are very noticeable. This parallel orientation produces the best results. However, there is still a lot of noise at each gearing, which will be further worsened by the introduction of road noise. We also noticed a correlation between pedal acceleration and noise levels in the graphs. This means pedaling will be another source of noise in addition to the road.

3 Requirements and Verifications

3.1 User Input Subsystem 3.1.1 Microcontroller [2.5 points]

Requirements Verifications

1) Digital I/O functions correctly A. For outputs, blink an LED and ver- ify that it corresponds to correct state in software. B. For inputs, toggle a switch and ver- ify that the 0 V and 5 V are cor- rectly interpreted.

14 3.1.2 Battery [2.5 points]

Requirements Verifications

1) Supplies 3.7 V ± 0.25 V Measure the voltage difference across the power source when the system is un- der no/full loads

2) Supplies 200 mA ± 50 mA Measure the current draw when the sys- tem is under full load

3) Lifetime should be at least 100 hours Fully charge and discharge the battery with the system operating above aver- age loads

15 3.1.3 Bluetooth Module [6 points]

Requirements Verifications

1) Packets are sent and received within 500 A. Install Tera Term (or some other ms when sent from the Bluetooth mod- program that allows Bluetooth ule communication via UART) on a PC with a working Bluetooth modulea B. Pair the Bluetooth module with the PC using the default PIN ”1234” C. Instruct the Bluetooth module via the microcontroller to send a packet D. Confirm that the PC receives this within 500 ms E. Repeat sending the packet and checking transmit time 9 more times

2) Packet drop rate is less than 1% when A. Install Tera Term (or some other sent from the Bluetooth module program that allows Bluetooth communication via UART) on a PC with a working Bluetooth modulea B. Pair the Bluetooth module with the PC using the default PIN ”1234” C. Instruct the Bluetooth module via the microcontroller to send 300 packets spaced 1 second apart D. Ensure there is no loss of connectiv- ity during these 300 seconds E. Check that at least 298 packets were received by the PC

3) Supplied with 3.3 V ± 0.3 V [2] A. Set a multimeter to measure volts B. Place a multimeter probe on pin 11 of the Bluetooth module C. Place the second multimeter probe on pin 1 D. Confirm that the voltage is between 3.0 V and 3.6 V

ahttps://eewiki.net/display/Wireless/Getting+Started+with+RN42+Bluetooth+Module

16 3.2 Shifting Subsystem 3.2.1 Microcontroller [5 points]

Requirements Verifications

1) Commands received from Bluetooth Connect the Bluetooth status pin to the module is processed within 100 millisec- microcontroller and compute the differ- onds ence in times between that pin and the TX pin. The status pin should be ac- tivated before the TX pin since it indi- cates that a message was received.

2) Draws less than the max current spec- Compare the current drawn by the mi- ified in the battery consumption table crocontroller under full load and verify above. that it is less.

3) Digital I/O functions correctly A. For outputs, blink an LED and ver- ify that it corresponds to correct state in software. B. For inputs, toggle a switch and ver- ify that the 0 V and 5 V are cor- rectly interpreted.

3.2.2 Battery [5 points]

Requirements Verifications

1) Supplies 5 V ± 1 V Measure the voltage difference across the power source when the system is un- der no/full loads

2) Supplies 1 A ± 0.25 A Measure the current draw when the sys- tem is under full load

3) Lifetime should be at least 100 hours Fully charge and discharge the battery with the system operating above aver- age loads

17 3.2.3 Servo [17 points]

Requirements Verifications

1) Handles the necessary torque to shift up Attach the cable to the servo through to τcable + 2 kgf · cm, where τcable is the the servo mount (described in hard- minimum cable tension needed to reach ware), apply a known tension in the ca- the largest sprocket ble using a spring scale, and verify that it is able to apply enough force to allow the derailleur to shift through the entire range of gears, τcable, plus 2 kgf · cm.

2) Preserves calibration after introduction A. Short term, shake the bike violently of road motion/vibrations to observe effects on shifting. B. Long term, ride the bike with sys- tem installed and check for any loss in precision of shifting.

3) Draws less than 600 mA Measure the current load while the servo is operating

4) Maintains the largest sprocket selection Shift the bicycle into the largest for at least 100 h, the max battery life sprocket, start a stopwatch, and leave of the next commercial competitor (Shi- the shifting subsystem powered for as mano Di2) long as possible. Stop the stopwatch when the system depowers.

3.2.4 Accelerometer [6 points]

Requirements Verifications

1) Detects tilt angle of ±3 with an accu- Draw out presets of various tilt angles racy of 5% and then rotate the accelerometer to those angles. Compare the output of the accelerometer with the preset and calculate the difference.

2) Functions properly in temperatures Put preset angles along with circuit in ranging from 0◦ F and 120◦. the freezer and compare the accelerom- eter outputs with presets. Perform a similar test with preset and circuit in- side an oven.

18 3.2.5 Bluetooth Module [6 points]

Requirements Verifications

1) Packets are sent and received within 500 A. Install Tera Term (or some other ms when sent to the Bluetooth module program that allows Bluetooth communication via UART) on a PC with a working Bluetooth modulea B. Pair the Bluetooth module with the PC using the default PIN ”1234” C. Instruct the program on the PC to send a packet D. Confirm that the microcontroller re- ceives this within 500 ms E. Repeat sending the packet and checking transmit time 9 more times

2) Packet drop rate is less than 1% when A. Install Tera Term (or some other sent to the Bluetooth module program that allows Bluetooth communication via UART) on a PC with a working Bluetooth modulea B. Pair the Bluetooth module with the PC using the default PIN ”1234” C. Instruct the PC to send 300 packets spaced 1 second apart D. Ensure there is no loss of connectiv- ity during these 300 seconds E. Check that at least 298 packets were received by the microcontroller

3) Supplied with 3.3 V ± 0.3 V [2] A. Set a multimeter to measure volts B. Place a multimeter probe on pin 11 of the Bluetooth module C. Place the second multimeter probe on pin 1 D. Confirm that the voltage is between 3.0 V and 3.6 V

ahttps://eewiki.net/display/Wireless/Getting+Started+with+RN42+Bluetooth+Module

4 Tolerance Analysis

Should a cable actuation be pursued, the max stall torque must be sufficient to hold the selected gear combination in place. A quick test determined the maximum tension in the cable of a test bike to be 33 lbf. It should be noted that the tension required to sustain any gear combination is

19 less than the tension required to shift to a certain gear combination, when upshifting. Referencing the servo mount assembly, the distance from the servo rotation axis to the cable was 0.7449 in, as in Figure 11. So the torque due to the cable is τcable = (0.7449 in)(33 lbf) = 28.3212 kgf · cm. However, the highest torque servo only outputs 20.32 kgf · cm. Obviously, this is problematic, but it is very likely that this is due to using a rare rear derailleur that utilizes two springs instead of the conventional one, and therefore requires a higher cable tension to change sprockets. The design may very well altered in the future, and/or the derailleur changed, so an ideal tolerance for now would be a maximum servo stall torque τservo = τcable + 2 kgf · cm, where τcable is the minimum cable tension needed to reach largest sprocket. Assuming a mass of 42.5 g for the cable puller, its moment of inertia about its spin axis is I = 7990.56 g · mm2. Therefore, solving τ to be the difference, 2 kgf · cm = Iα for angular acceleration α, α is determined to be 3906.55 rev/s2. This angular acceleration represents the maximum angular acceleration that a counter servo torque τservo is capable of. This angular acceleration is more than enough to ensure extremely fast upshifts. Verifying this is simply a matter of pulling on the cable with a known tension, as determined by a spring scale, and checking if the servo can safely counter the minimum cable tension to reach the largest sprocket, τcable, plus 2 kgf · cm. Secondly, a minimum duration of 100 h should be set. At this point, the project will have equalled the battery life of one of the current competitors, the Shimano Di2 system, which claims 1500 mi range, which at 15 mph gives a battery life of 100 h. One can test this by shifting into the largest sprocket, then leaving the shifting subsystem powered on until the system fails. The time elapsed until failure must be greater than or equal to 100 h.

Figure 11: Lever arm length

20 5 Cost and Schedule

5.1 Cost Analysis 5.1.1 Labor

Name Hourly Rate Hours Invested Total Cost Peter Kowalczyk $25.00 200 $12500.00 Kevin Luong $25.00 200 $12500.00 Matthew Potok $25.00 200 $12500.00 Totals $75.00 600 $37500.00

Table 10: Cost of labor

5.1.2 Parts

Item Quantity Unit Cost Vendor Total Cost ATtiny84 2 $2.95 [7] Sparkfun $5.90 JX-Servo 5521MG Servo 1 $16.99 [8] Amazon $16.99 Memsic 2125 Dual-axis Accelerometer 1 $29.99 [7] Sparkfun $29.99 Push buttons 2 $0.99 [7] Sparkfun $1.98 EC Tech YN-025 1 $32.99 [9] Amazon $32.99 Polymer Lithium Ion Battery 1 $12.99 [7] Sparkfun $12.99 Roving Networks RN-42 1 $18.95 [7] Sparkfun $37.90 Total - - - $138.74

Table 11: Cost of parts

5.1.3 Total

Section Total Labor $37500.00 Parts $138.74 Grand Total $37638.74

Table 12: Total cost

21 5.2 Schedule

Week Task Delegation Finalize proposal and obtain testing equipment Kevin Luong 2/8/16 Finalize proposal and research electronics Peter Kowalczyk Finalize proposal and research electronics Matt Potok Design fixture, obtain remaining parts, and start CAD Kevin Luong 2/15/16 Implement microcontroller communication Peter Kowalczyk Log accelerometer data to determine shift graphs Matt Potok Assemble servo shifting system Kevin Luong 2/22/16 Continue implementing microcontroller communication Peter Kowalczyk Write code for servo shifting Matt Potok Finalize CAD design Kevin Luong 2/29/16 Continue improving accelerometer feedback and noise reduction Peter Kowalczyk Implement accelerometer feedback Matt Potok Mount servo system on bicycle Kevin Luong 3/7/16 Implement button event communication Peter Kowalczyk Finalize electronic components Matt Potok Test cable pull ratios Kevin Luong 3/14/16 Rewrite any code changes needed due to electronics finalization Peter Kowalczyk Begin PCB Design Matt Potok Design and CAD mount for shifter placement Kevin Luong 3/28/16 Rewrite any code changes needed due to electronics finalization Peter Kowalczyk Complete PCB Design Matt Potok Optimize component placement Kevin Luong 4/4/16 Implement current gear tracking Peter Kowalczyk Testing/Debugging System Matt Potok Update fixture designs Kevin Luong 4/11/16 Debug any problems with code Peter Kowalczyk Optimization and implementation of minor new features Matt Potok Testing/Debugging System Kevin Luong 4/18/16 Testing/Debugging System Peter Kowalczyk Testing/Debugging System Matt Potok Final Presentation and demos Kevin Luong 4/25/16 Final Presentation and demos Peter Kowalczyk Final Presentation and demos Matt Potok Final Presentation and demos Kevin Luong 5/2/16 Final Presentation and demos Peter Kowalczyk Final Presentation and demos Matt Potok

Table 13: Schedule

6 Safety Statement

Our electronic gear shift system has two major components that present a safety hazard: the two batteries and the servo/derailleur system. The system is not currently designed to be waterproof or water-resistant. Do not operate bikes

22 outfitted with our system while it is raining or drizzling. Avoid puddles, streams, and bodies of water while riding. When cleaning the bike, avoid contacting any component of the gear shifting system with water. Use the same precautions as you would when operating a normal bicycle, such as not placing any part of your body in contact with parts or chains that are moving at high speed. Do not attempt to rotate the servo by hand while the system is powered on. Do not put any part of your body near the derailleur, derailleur cable, or servo, as these may suddenly change in position while the system is powered on. Be properly trained with lab safety and electrical safety before working with or maintaining our system.

6.1 Battery Safety The gear shifting system uses two batteries: one to power the buttons at the front of the bike, and one to power gear shifts on the back . These batteries should be handled with caution:

• Do not charge batteries beyond their maximum safe voltage or their maximum safe current • Do not operate the system when the batteries are below their minimum safe voltage • Do not draw more current than the batteries are designed to provide • Do not charge the batteries outside of their safe charging temperatures • Do not short circuit the batteries • Do not immerse the batteries in water or get them wet • Connect the batteries with correct polarity. Do not reverse the battery connections. • Do not leave the batteries in an area with an excessively high temperature • Before using our system, inspect the batteries for damage or irregularities

7 Ethics

During the making of this project, we will follow the IEEE Code of Ethics [10]. We intend to follow all of it, but we will place emphasis on the following points:

(5) to improve the understanding of technology; its appropriate application, and poten- tial consequences; (6) to maintain and improve our technical competence and to undertake technological tasks for others only if qualified by training or experience, or after full disclosure of pertinent limitations;

We are students of engineering, so our primary objective should be to learn. This includes understanding technology and improving our technical competence. As students, it is also important to understand what we cannot do or are not qualified to do. As such, we have a responsibility to ask questions to our TA if there is anything we are unsure about. This is especially true if we have a safety concern.

(7) to seek, accept, and offer honest criticism of technical work, to acknowledge and correct errors, and to credit properly the contributions of others;

Learning from our mistakes is the best way for us to improve as engineers. That is why we need to be open to criticism of our work and correct any mistakes that we make during our project.

23 (10) to assist colleagues and co-workers in their professional development and to support them in following this code of ethics.

Our team consists of a Mechanical Engineering major, a Computer Engineering major, and a Computer Science major. Our project also requires knowledge in all of these disciplines. Under- standing these other topics can be difficult, but our team members have already displayed great willingness and ability to teach each other so that we all comprehend the different parts of our project.

References

[1] 8-bit AVR Microcontroller with 2/4/8K Bytes In-System Programmable Flash. 8006K–AVR–10/10. ATtiny84. Atmel Corporation. 2010. url: http://www.atmel.com/images/doc8006.pdf. [2] RN-42/RN-42-N Data Sheet. DS-RN42-V1.0. RN-42. Roving Networks, Inc. Dec. 2010. url: https://www.sparkfun.com/datasheets/Wireless/Bluetooth/rn-42-ds.pdf. [3] PS-5521MG 20KG High Precision Metal Gear Analog Standard Servo. Shantou Jianxian Electronic Technology Co., Ltd. url: http : / / www . jx - servo . com / English / Product / 4213902956.html. [4] Memsic 2125 Dual-Axis Accelerometer. 28017. v2.0. Parallax Inc. Jan. 2009. url: http : //www.robotshop.com/media/files/PDF/memsic-2125-datasheet-28017.pdf. [5] 2016 AR FRD. Used for picture of bike. Felt Racing, LLC and Felt GmbH. 2016. url: http: //www.feltbicycles.com/USA/2016/Bikes/road/aero/ar-frd.aspx. [6] Fanny Schertzer. Licensed as CC BY-SA 3.0; via Wikimedia Commons. June 2011. url: https://commons.wikimedia.org/wiki/File:SRAM_Rival_rear_derailleur_-_bottomview. jpg. [7] Look up corresponding product page for price. Sparkfun Electronics, Inc. url: https://www. sparkfun.com. [8] Junsi JX PS-5521MG 4.8-6V 20KG Super Torque Digital Servo Gear for HSP94111 Trucks. Price may vary over time. Amazon.com, Inc. url: http://www.amazon.com/Junsi-PS- 5521MG-4-8-6V-Digital-HSP94111/dp/B017JNA31Q. [9] EC Technology 2nd Gen 22400mAh External Battery with 3 USB Outputs for Smartphones and Tablets - Black & Red. Price may vary over time. Amazon.com, Inc. url: http://www. amazon.com/EC-Technology-22400mAh-External-Smartphones/dp/B00FDK2G2C. [10] IEEE Code of Ethics. IEEE. url: http://www.ieee.org/about/corporate/governance/ p7-8.html.

24