Introduction: Giant/Yamaha E Bike Speedo Corrector

An arduino based, DIY solution to the 15MPH speed limit on a Giant e+2 with the Yamaha syncdrive motor.

This solution will likely work for other variants but I have only tested on this specific model.

I have used a slightly modified version of the code used by Tom M'Guinness in his 1986 944 Turbo Speedometer Calibrator to produce the desired output pulse.

https://members.rennlist.com/tom86951/Speedometer%...

Basically, when activated by the lamp switch on the handlebars, a relay diverts the original speed signal to an arduino nano. The nano reads the frequency, multiplies it by some conversion factor then outputs a pulse to the syncdrive motor. This causes the motor to read a speed lower than the actual speed - effectively raising the speed limit.

The major downside to this method is that the display reads the now modified speed so the speedo and trip meter are inaccurate (only when the device is activated via the lamp switch).

The data between the motor and the display is CAN based, so an ideal solution would involve interrupting and modifying CAN data (Maybe for a future project).

I found that using a conversion factor of 0.5 worked out best as I simply double the readout to get the actual speed. This of course means there is a much simpler way to achieve the same result using logic to produce one output pulse for every 2 inputs. See one the best, online physics resources out there for more info http://hyperphysics.phy-astr.gsu.edu/hbase/Electro... on how this works.

But, by using a micro controller we get to experiment with different configurations without having to strip the bike down every time we want to make an adjustment.

Step 1: Get the Parts You'll Need

1 x changeover relay with a 5 V coil

2 x diodes (I used 1N4001 - overkill but its what I had)

Arduino nano or similar.

Wire, solder, tape, heatshrink

Step 2: Prepare the Bike

I didn't take many pictures as I didn't plan in making an instructable but...

There are youtube videos on how to remove the fairing that I'd like to link to but it feels kind of unfair as they are well produced and are designed to sell their product.

I removed the motor completely but I believe it could be done with the motor in place ( depending on who run the wiring when the bike was built)

Remove the battery

Remove the 4 x torx bolts that hold the battery connector in place and lift the connector out.

Remove the 4 bolts holding the chain ring to the crank - This allow you to access the bolts that hold the plastic cover on the right hand side.

Remove all the torx and allen bolts that hold the covers on.

With the bash plate removed you should be able to see the wiring (mine was crammed up the front tube).

If not, then you will need to remove the motor completely - no biggie.

Step 3: Build the Circuit

Fortunately, on this model there is a lamp output driven from the motor controller that is switched by the CAN signal from the display (which gets its input from the handlebar switch).

It puts a nice clean 6V DC to an unused 2 pin connector from the motor. We will use this to power the relay and the arduino. (See pic)

(disclaimer - I do not know the limit of this output as I'm reluctant to strip the motor down just yet to find out as the bike is only a few months old). But, the few hundred mA draw of this circuit seems to be fine but I advise the use of a 500mA fuse in series with the power.

I wanted a failsafe so that if the micocontroller failed, the default condition was to set the bike to standard. As the nano digital I/O pins draw current when the arduino is powered down, the output needed to be isolated using a relay.

As always, when using a relay around sensitive electronics a diode should be used to quench back EMF - do not leave this diode out and be sure of the polarity!

Please excuse my hand scribbled schematic :)

Locate the 3 pin connector from the speed sensor. The sensor is simply a magnetic reed switch that grounds the 5V ref from the motor controller every time the magnet in within range. The blue wire is the signal wire.

Cut the blue wire (leaving enough room to play). Extend the wires so they can easily reach up the front tube as this is where everything will live. The motor side will go to the common of the relay and the speed signal (VSS) goes to the normally closed contact of the relay (NC).

Connect the relay coils terminals to the arduino nano Vin and GND connections and don't forget to add the diode across the relay coil terminals.

Solder the remaining diode to digital pin 3 and connect to the NC contact of the relay.

The nano output (pin 7) goes to the NO contact of the relay.

The power supply will go the the 2 pin plug but I would advice powering up from a ~5V supply before connecting to the bike to confirm.

When powered up, the relay should energize and the arduino should power up.

If correct you can plug the arduino in and upload the code.

const int debounce = 25000;

const int output = 7;

const int sensorPin = 3;

int pulseState = LOW;

int sw;

volatile unsigned long currentMicros = 0;

volatile unsigned long previousMicros= 0;

volatile unsigned long currentSpeed = 0;

volatile unsigned long previousSpeed = 0;

volatile unsigned long interval = 0;

unsigned long modInterval = 0;

float calFactor = .5; // decrease to slow down speedometer

void setup()

{

pinMode (13, OUTPUT); pinMode (4, INPUT_PULLUP);

pinMode(output, OUTPUT);

pinMode(sensorPin, INPUT_PULLUP);

digitalWrite (sensorPin, HIGH);

attachInterrupt (1, iSr, FALLING);

}

void loop()

{

noInterrupts();

modInterval=interval;

interrupts();

currentMicros = micros();

if (currentMicros-previousSpeed<2000000) // this was 1s

{

if (currentMicros - previousMicros>((modInterval)/calFactor))

{ previousMicros = currentMicros;

digitalWrite(output, LOW); delay(100); digitalWrite(output,HIGH);

}

}

}

void iSr()

{

currentSpeed=micros();

{

if ((currentSpeed - previousSpeed) > debounce)

{

interval = currentSpeed - previousSpeed;

previousSpeed=currentSpeed;

}

}

}

Step 5: Install and Test

With the code uploaded you can go ahead and wire the power supply up to the 2 pin plug and test.

If you are careful you can re install the battery and turn on the display.

If you spin the back wheel the speedo should register as usual.

If you then switch on the light, you should hear the relay click and the speedo should read half the actual speed (depending on the value of cal factor in the line: float calFactor = .5; // decrease to slow down speedometer)

if all is good, power down, remove the battery and insulate all the connections.

Its a good idea to cover the whole arduino in hot glue or some king of sealant to prevent moisture ingress.

Run a USB cable from the arduino to the battery port so you can edit the code easily in the future.

I used large diameter heatshrink over the whole circuit, plugged the ends with hot glue and bent them over to be extra protected.

Rebuild the bike and enjoy.

I will experiment with different settings to see whether I can get it to use the standard speed up to 14MPH then hold so the trip computer produces a more accurate reading. Although I suspect this will log a fault in the standard controller.