Author Topic: DIY gear indicator display project  (Read 5616 times)

0 Members and 1 Guest are viewing this topic.

Offline Sphaleron

  • Member
  • ***
  • Joined: Feb 2017
  • Posts: 20
  • Bike: DL650 K7 GT
  • Location: Daventry, Northants
DIY gear indicator display project
« on: March 10, 2017, 07:51:12 »
The GiPro gear indicator looks like a pretty nifty product if not a bit on the expensive side at ~£90. I decided to have a go at making one myself. The rise of Arduino has spawned a whole raft of dirt cheap but amazingly powerful micro controllers that are perfect for such a project. This DIY device simply reads the voltage output by the gear position sensor and outputs the gear number to a 7-segment display. The whole thing is epoxy encapsulated within a tiny plastic box. All the parts were purchased from ebay. Total materials cost <£10!

Arduino Pro mini - Chinese knockoff - £2.50


7 segment LED display – 1 inch size digit, blue illumination  - £1.50


ABS plastic box – 40mm x 28mm x 18mm - £2.25
9x 680 Ohm 0.25W resistor - £1
6.2V 1W Zener diode - £0.10p
7 x 10 holes veroboard piece - 10p
2m 4-core telephone cable - £1
Araldite / epoxy resin - £1
Soldering kit and simple tools.

The circuit -
https://drive.google.com/file/d/0B5nxwfQs_YGoSmF0VWdaSDJYRVU/view?usp=sharing

The circuit is very simple and can be reliably constructed without the need for an additional printed circuit board, simply a soldering iron and a steady hand is required. Telephone cable is used to provide the power supply and signals from the gear position sensor (GPS) located at the gearbox.

The power supply for the circuit is supplied from any ignition switched 12V outlet. There are many points within the wiring loom that will provide such a supply including the heated grips connector and ECU (dealer mode) connector. Additionally you could use a relay switching unit sold by Birdpie (http://www.v-strom.co.uk/smf/index.php?topic=24607.0). Although refererred to as “12v” this supply will actually range between 12v and 15v depending on the rev speed of the engine and the health of the battery. To cope with this variability the circuit employs a zener diode in combination with a 680 Ohm resistor to reduce the input voltage at the RAW pin and avoid burning out the board's tiny voltage regulator. Make sure the polarity of the zener diode is correct!

The voltage signal output by the GPS ranges from 0v to 5v depending on the selected gear. This voltage is fed into the analog input pin A0. At pin A0 a device known as an analog-to-digital converter (ADC) converts this signal into a digital number that can be interpreted by the program running on the Arduino's microprocessor. The following voltages are output by the GPS depending on the selected gear -
1st gear - 1.4v
2nd gear - 1.84v
3rd gear - 2.53v
4th gear - 3.23v
5th gear - 4.07v
6th gear – 4.51v
Neutral 4.95v

The 7-segment LED actually has 8 segments if you count the decimal point. Each of the segments is an individual LED that can be powered by the Arduino's output ports. A series resistor is required for each segment to limit the current and prevent the LEDs from burning out. To limit total current flow I advise the use of 680 Ohm resistors. The will reduce the strain on the board's tiny voltage regulator. The 7-segment LED has a common GND connection that connects to a GND connection on the Arduino board.

Finally the Arduino board is supplied with a programming header that is required to upload the program from your PC. The Arduino website provides all the development tools required to implement the necessary functionality. The program is written in a simple C language that is relatively straightforward to learn. There are plenty of examples provided to get you started. I will provide my code as an example. Very simply the code is one continuous loop that reads the voltage on the A0 pin, decides what gear the bike is in based on predefined voltage ranges for each gear, illuminates the required segments to display a digit, then returns to the start.

Resistors soldered to veroboard
https://drive.google.com/file/d/0B5nxwfQs_YGoTVRpWXBRaHFvRkE/view?usp=sharing

Legs of resistors fed through to top face
https://drive.google.com/file/d/0B5nxwfQs_YGod0F4cXlCbUZyUnM/view?usp=sharing

Legs routed on surface and fed back through holes on edge of board -
https://drive.google.com/file/d/0B5nxwfQs_YGoQi1lMVNLQ2d3T3c/view?usp=sharing
https://drive.google.com/file/d/0B5nxwfQs_YGoZUMxYnVHMkwyU0k/view?usp=sharing

7 segment display soldered to veroboard -
https://drive.google.com/file/d/0B5nxwfQs_YGoQi1WekxzcVpReUU/view?usp=sharing
https://drive.google.com/file/d/0B5nxwfQs_YGoSnE5V0FaTmU5aDg/view?usp=sharing

Veroboard with line of resistor legs soldered to pins 2-9 and GND of Arduino
https://drive.google.com/file/d/0B5nxwfQs_YGod1ppR2lFbC1OWWxxV3hVbzZSZzFrakN4RGtv/view?usp=sharing
https://drive.google.com/file/d/0B5nxwfQs_YGoR29YcEV1YjBRY3V6VE03WkNkaGViV2tjdWk4/view?usp=sharing

Fitting it in the tiny box!
https://drive.google.com/file/d/0B5nxwfQs_YGoNDducUl3WWMtcms/view?usp=sharing
https://drive.google.com/file/d/0B5nxwfQs_YGoR3BXOVhsQlVmVjg/view?usp=sharing
https://drive.google.com/file/d/0B5nxwfQs_YGoNUYyVWR3azVDZnZiS2RoRGRwUTUxXzJGLUI0/view?usp=sharing

First test with all segment illuminated
https://drive.google.com/file/d/0B5nxwfQs_YGoVW51UGVWZ2xTUEE/view?usp=sharing

Offline UK_Vstrom650

  • Member
  • ***
  • Joined: Jun 2012
  • Posts: 6715
  • Bike: DL650A L2
Re: DIY gear indicator display project
« Reply #1 on: March 10, 2017, 08:11:47 »
That sounds really good but the links don't work... think I'll bookmark this and have a go at making one soon to practice my soldering skills  :thumb:

Edit: links seem to be working so ignore that (was getting a 'file not found' error)

 :ty:

Offline Sphaleron

  • Member
  • ***
  • Joined: Feb 2017
  • Posts: 20
  • Bike: DL650 K7 GT
  • Location: Daventry, Northants
Re: DIY gear indicator display project
« Reply #2 on: March 20, 2017, 13:24:05 »
As promised the Arduino code for the project (below). The switched 12v and GND supply was taken from the diagnostic connector. The connection to the gear position sensor was soldered into the wiring loom by stripping back a very small section of insulation and tacking on a wire. Photos of the installed unit to follow. -

Code: [Select]
// 7 segment LED pin connections
//
//  --3--
//  7   4
//  --2--
//  9   6
//  --8--
//         5

void setup() {                   
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
}
void loop() {
 
  int I;
  for (I=0;I<5;I++)
  {
    circle();
  }

  int ReadVal;
  for (;;)  // Infinite loop
  {
    // Average from 20 readings to remove any noise issues
    ReadVal=0;
    for (I=0;I<20;I++)
    {
        ReadVal=ReadVal+analogRead(A0);
    }
    ReadVal=ReadVal/20;
   
    // Display appropriate digit
    if (ReadVal<329)  // 1.39V      <1.61V
    {
      one();
    }
    else if (ReadVal>=329 && ReadVal<448) // 1.82V      >1.61V <2.19V
    {
      two();
    }
    else if (ReadVal>=448 && ReadVal<591) // 2.55V      >2.19V <2.89V
    {
      three();
    }
    else if (ReadVal>=591 && ReadVal<747) // 3.22V      >2.89V <3.65V
    {
      four();
    }
    else if (ReadVal>=747 && ReadVal<878) // 4.07V      >3.65V <4.29V
    {
      five();
    }
    else if (ReadVal>=878 && ReadVal<968) // 4.51V      >4.29V <4.73V
    {
      six();
    }
    else if (ReadVal>=968)  // 4.95V      >4.73V
    {
      zero();
    }
   
  }
   
}

void circle(){
  digitalWrite(3, HIGH);
  delay(100);
  digitalWrite(3, LOW);
 
  digitalWrite(4, HIGH);
  delay(100);
  digitalWrite(4, LOW);
 
  digitalWrite(6, HIGH);
  delay(100);
  digitalWrite(6, LOW);
 
  digitalWrite(8, HIGH);
  delay(100);
  digitalWrite(8, LOW);
 
  digitalWrite(9, HIGH);
  delay(100);
  digitalWrite(9, LOW);
 
  digitalWrite(7, HIGH);
  delay(100);
  digitalWrite(7, LOW);
}

void DP_On(){
  digitalWrite(5, HIGH); 
}

void DP_Off(){
  digitalWrite(5, LOW); 
}

void blank(){
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW); 
}

void zero(){
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, HIGH); 
}

void one(){
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW); 
}

void two(){
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, HIGH);
}

void three(){
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
}

void four(){
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
}

void five(){
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
}

void six(){
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, HIGH);
}

void eight(){
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9, HIGH); 
}

Offline Graham62

  • Member
  • ***
  • Joined: May 2015
  • Posts: 2658
  • Bike: DL650 K6 Blue
  • Location: Mansfield Nottinghamshire
Re: DIY gear indicator display project
« Reply #3 on: March 20, 2017, 19:09:41 »
Hi piggy,
I just wondered for those of us that's not technically minded would you be willing to make some and sell to members on the site.
A drunken man's words are a sober man's thoughts.

Graham

Offline panrider

  • Member
  • ***
  • Joined: Oct 2014
  • Posts: 54
Re: DIY gear indicator display project
« Reply #4 on: March 20, 2017, 20:06:54 »
Yes I would be interested if you start making them.  :thumb:

Offline pr

  • Member
  • ***
  • Joined: Feb 2016
  • Posts: 138
  • Bike: DL650A K7
  • Location: Netherlands
Re: DIY gear indicator display project
« Reply #5 on: March 20, 2017, 23:10:35 »
Nice project! How do you reckon the water resistance is?

Offline Sphaleron

  • Member
  • ***
  • Joined: Feb 2017
  • Posts: 20
  • Bike: DL650 K7 GT
  • Location: Daventry, Northants
Re: DIY gear indicator display project
« Reply #6 on: March 21, 2017, 13:04:17 »
Water resistance shouldn't be an issue, the whole thing is excapsulated in epoxy/Araldite. I'll let you know after the next big rainstorm  :)

Offline pr

  • Member
  • ***
  • Joined: Feb 2016
  • Posts: 138
  • Bike: DL650A K7
  • Location: Netherlands
Re: DIY gear indicator display project
« Reply #7 on: March 22, 2017, 14:07:49 »
Good.

This GI pro works via the dealer mode connector, right? Any chance this could be connected to that as well? In other words, any idea how to read out the voltage information from the ECU?

I've found this forum and they managed to read out some stuff, but I can't figure out anything about the gears.
One bloke managed to write something in arduino for a DL650 K8.

Offline Sphaleron

  • Member
  • ***
  • Joined: Feb 2017
  • Posts: 20
  • Bike: DL650 K7 GT
  • Location: Daventry, Northants
Re: DIY gear indicator display project
« Reply #8 on: March 23, 2017, 09:11:37 »
I've looked into this. Certainly a neater solution than cutting into the wiring loom. And yes, that is how the GIPro works. Unfortunately I haven't managed to decipher the protocol. It hasn't been properly documented and I wouldn't want to corrupt my ECU  :shock:

Edit - Thanks for the pointer to the Arduino code :-) :-) That's the first time I've seem a library to read the specific fnction from the ECU. Might try it now!

Offline Sphaleron

  • Member
  • ***
  • Joined: Feb 2017
  • Posts: 20
  • Bike: DL650 K7 GT
  • Location: Daventry, Northants

Offline pr

  • Member
  • ***
  • Joined: Feb 2016
  • Posts: 138
  • Bike: DL650A K7
  • Location: Netherlands
Re: DIY gear indicator display project
« Reply #10 on: March 23, 2017, 13:35:06 »
How do you upload the code to the board with these pro mini things? They don't have a USB connection

Offline Sphaleron

  • Member
  • ***
  • Joined: Feb 2017
  • Posts: 20
  • Bike: DL650 K7 GT
  • Location: Daventry, Northants