Skip to content

Commit

Permalink
Merge pull request #5 from ajs123/v1.0_working
Browse files Browse the repository at this point in the history
v1.1
  • Loading branch information
ajs123 authored Oct 5, 2021
2 parents 00f8f7b + b643727 commit 534f4aa
Show file tree
Hide file tree
Showing 13 changed files with 906 additions and 56 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@
- Adjacent pins, ordered to match the termination of the cable in the bike, supporting use of a ribbon cable in wiring.
- Use of an analog input pin for RESISTANCE_TOP enables measurement of Vdd
- Option to check for sag in Vdd and trigger the low battery indicator accordingly
- V1.1
- Changed to Vdd as the ADC reference. This makes the resistance reading truly potentiometric (independent of Vdd), so the resistance scale factor should be truly constant from bike to bike as long as the resistance in cables and connections is insignificant compared with the 10K potentiometer value.

336 changes: 336 additions & 0 deletions Cal_20211003.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,336 @@
c Edge of 1/2
edge of 1/2

res 10
Raw ADC value 186
Resistance 6.7%
Keiser gear number 1

Raw ADC value 184
Resistance 6.5%
Keiser gear number 1

Raw ADC value 185
Resistance 6.6%
Keiser gear number 1

Raw ADC value 184
Resistance 6.5%
Keiser gear number 1

Raw ADC value 185
Resistance 6.6%
Keiser gear number 1

Raw ADC value 184
Resistance 6.5%
Keiser gear number 1

Raw ADC value 184
Resistance 6.5%
Keiser gear number 1

Raw ADC value 185
Resistance 6.6%
Keiser gear number 1

Raw ADC value 184
Resistance 6.5%
Keiser gear number 1

Raw ADC value 185
Resistance 6.6%
Keiser gear number 1

10 measurements.
Average ADC value 184.6
Estimated mean 184.7; SD 0.6 .

c edge of 4/5
edge of 4/5

res 10
Raw ADC value 233
Resistance 17.1%
Keiser gear number 5

Raw ADC value 233
Resistance 17.1%
Keiser gear number 5

Raw ADC value 232
Resistance 17.0%
Keiser gear number 5

Raw ADC value 233
Resistance 17.1%
Keiser gear number 5

Raw ADC value 233
Resistance 17.1%
Keiser gear number 5

Raw ADC value 232
Resistance 17.0%
Keiser gear number 5

Raw ADC value 233
Resistance 17.1%
Keiser gear number 5

Raw ADC value 233
Resistance 17.1%
Keiser gear number 5

Raw ADC value 232
Resistance 17.0%
Keiser gear number 5

Raw ADC value 232
Resistance 16.9%
Keiser gear number 5

10 measurements.
Average ADC value 232.6
Estimated mean 232.7; SD 0.5 .

c edge of 10/11
edge of 10/11

res 10
Raw ADC value 295
Resistance 30.7%
Keiser gear number 10

Raw ADC value 295
Resistance 30.6%
Keiser gear number 10

Raw ADC value 296
Resistance 30.8%
Keiser gear number 10

Raw ADC value 295
Resistance 30.7%
Keiser gear number 10

Raw ADC value 296
Resistance 30.8%
Keiser gear number 10

Raw ADC value 295
Resistance 30.7%
Keiser gear number 10

Raw ADC value 296
Resistance 30.8%
Keiser gear number 10

Raw ADC value 296
Resistance 30.9%
Keiser gear number 10

Raw ADC value 294
Resistance 30.6%
Keiser gear number 10

Raw ADC value 295
Resistance 30.6%
Keiser gear number 10

10 measurements.
Average ADC value 295.3
Estimated mean 295.4; SD 0.7 .

c edge of 15/16
edge of 15/16

res 10
Raw ADC value 360
Resistance 44.7%
Keiser gear number 15

Raw ADC value 359
Resistance 44.6%
Keiser gear number 15

Raw ADC value 359
Resistance 44.6%
Keiser gear number 15

Raw ADC value 359
Resistance 44.6%
Keiser gear number 15

Raw ADC value 360
Resistance 44.8%
Keiser gear number 15

Raw ADC value 359
Resistance 44.7%
Keiser gear number 15

Raw ADC value 359
Resistance 44.6%
Keiser gear number 15

Raw ADC value 359
Resistance 44.6%
Keiser gear number 15

Raw ADC value 360
Resistance 44.8%
Keiser gear number 15

Raw ADC value 360
Resistance 44.8%
Keiser gear number 15

10 measurements.
Average ADC value 359.4
Estimated mean 359.4; SD 0.5 .

c edge of 20/21
edge of 20/21

res 10
Raw ADC value 463
Resistance 67.2%
Keiser gear number 21

Raw ADC value 462
Resistance 67.1%
Keiser gear number 21

Raw ADC value 463
Resistance 67.2%
Keiser gear number 21

Raw ADC value 463
Resistance 67.3%
Keiser gear number 21

Raw ADC value 462
Resistance 67.1%
Keiser gear number 21

Raw ADC value 463
Resistance 67.2%
Keiser gear number 21

Raw ADC value 462
Resistance 67.1%
Keiser gear number 21

Raw ADC value 463
Resistance 67.2%
Keiser gear number 21

Raw ADC value 463
Resistance 67.3%
Keiser gear number 21

Raw ADC value 461
Resistance 67.0%
Keiser gear number 21

10 measurements.
Average ADC value 462.5
Estimated mean 462.4; SD 0.7 .

c brake contact
brake contact

res 10
Raw ADC value 687
Resistance 115.5%
Keiser gear number 24

Raw ADC value 687
Resistance 115.9%
Keiser gear number 24

Raw ADC value 686
Resistance 116.0%
Keiser gear number 24

Raw ADC value 686
Resistance 116.0%
Keiser gear number 24

Raw ADC value 686
Resistance 116.0%
Keiser gear number 24

Raw ADC value 686
Resistance 116.0%
Keiser gear number 24

Raw ADC value 686
Resistance 115.9%
Keiser gear number 24

Raw ADC value 686
Resistance 115.9%
Keiser gear number 24

Raw ADC value 686
Resistance 116.0%
Keiser gear number 24

Raw ADC value 685
Resistance 115.8%
Keiser gear number 24

10 measurements.
Average ADC value 686.1
Estimated mean 686.0; SD 0.6 .

c zero stop
zero stop

res 10
Raw ADC value 108
Resistance 0.1%
Keiser gear number 1

Raw ADC value 108
Resistance 0.0%
Keiser gear number 1

Raw ADC value 109
Resistance 0.0%
Keiser gear number 1

Raw ADC value 108
Resistance 0.0%
Keiser gear number 1

Raw ADC value 108
Resistance 0.0%
Keiser gear number 1

Raw ADC value 108
Resistance 0.0%
Keiser gear number 1

Raw ADC value 107
Resistance 0.0%
Keiser gear number 1

Raw ADC value 108
Resistance 0.0%
Keiser gear number 1

Raw ADC value 107
Resistance 0.0%
Keiser gear number 1

Raw ADC value 108
Resistance 0.0%
Keiser gear number 1

10 measurements.
Average ADC value 107.9
Estimated mean 107.9; SD 0.5 .

37 changes: 37 additions & 0 deletions Calibration_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Migrating from fixed to Vdd ADC reference
If you installed KBikeBLE prior to v1.1, the default ADC reference for reading the bike resistance setting was the fixed 3.6V reference. Starting with v1.1, the reference is the nominal 3.3V supply, i.e., Vdd. This was done because the Vdd reference should be more reliable. Resistance sensing is by the rotation of a potentiometer in the resistance magnet assembly, and the Vdd reference will provide a reading that's independent of the precise Vdd value, which can vary a bit from unit to unit. Using the Vdd reference also keeps the measurements table as the battery gets low and, potentially, Vdd begins to sag.

Since the calibration values saved in nonvolatile memory are used without regard to changes in the reference, you'll need to adjust those values. There are two straightforward options:

- Returning to default values and re-calibrating the bike. This is the most straightforward if you have the Keiser cal tool on hand. It should also be the most accurate.
- Adjusting the calibration parameters you already have.

### Re-calibrating the bike
The ideal approach is to re-calibrate the bike using Keiser's tool. This is because the default scale factor has been re-calculated against a Keiser computer reference. If you have the Keiser tool, this is quick and easy:

1. Have the tool ready. Move the gearshift lever to the bottom position.
1. Connect with a USB cable and the Arduino serial monitor, or by Bluetooth using the Adafruit Bluefruit Connect app and its UART funciton.
1. Return to default calibration values:
- Enter the command *defaults*. The system should respond with

Defaults...

followed by the default values. These defaults include the correct scale factor.

- Enter the command *activate* and confirm with *Y*.

1. Calibrate the bike:
- Enter the command *calibrate* and follow the prompts.
- Enter *activate* to make the new calibration active.
- Enter *write* to save the new calibration.

### Migrating the existing calibration

1. Enter the command *adcref*. The system should respond with

ADC reference is now internal 3.6V.

1. Enter the command *read*. The system will read the calibration values that were used, prior to v1.1, with the fixed 3.6V reference.
1. Enter the command *activate* to make those values active.
1. Enter *adcref* to return to the Vdd reference. When switching references, the system will adjust the active calibration values.
1. Enter *write*, and confirm with *Y*, to save the new values.
Loading

0 comments on commit 534f4aa

Please sign in to comment.