I know, I know... there's a number of companies out there that you can just buy a ready-made Gear Position Indicator (GPI) from. That's too easy. That's not why I did it.
I've undertaken a renewed interest in embedded microcontrollers lately. Over the past 20 years, I've puttered around with various MC's. I've worked with MC's such as - Intel 805x, Motorola 68xxx, 6502, and Zilog Z80. But never MicroChip PIC MC's. So I wanted to educate myself on PIC MC's, using a real-world application. And have something useful in the end.
It all started one day a couple weeks ago. A buddy and I were talking (he has a Suzuki TL1000R)... he says "I wish I had a gear position indicator". I said "I think we can do that". So, after some research and development, I built him a GPI using a PIC16F88. Turned out to be a rather easy task. Since the Suzuki has a wire coming out of the transmission carrying a voltage ranging anywhere from 0 to 5 volts, depending on what gear it's in, I just used the PIC16F88's A/D converter to read the voltage, and convert it to a gear number. Once the gear number is known, it is a simple matter of displaying it on a seven segment LED, which is now velcro'd to the side of his instrument cluster.
Voila... Now he has a GPI, and I have a good bit of real world experience on PIC microcontrollers.
But noooooooo...that wasn't good enough, I was thinking.... Now I gotta have a GPI too.
So, I set out to build a GPI for my RC51.
However, because Honda doesn't have a wire coming out of the transmission (like the Suzuki's do), a very different approach was required.
Here is the approach I took -
The RC51 has a vehicle speed sensor, which emits a very nicely formed 5v digital square wave. The square wave's frequency varies in direct proportion with wheel speed, via a variable reluctance sensor coupled to one of the gears on the final output shaft (aka, counter-shaft). There are exactly 27 pulses/cycles per counter-shaft revolution.
The RC51 also has an Ignition Pulse Generator (IPG). The IPG emits a very nicely formed semi-square A/C signal. The frequency of the signal varies in direct proportion with engine speed, via a variable reluctance sensor coupled to the flywheel. There are exacly 12 pulses/cycles per crank shaft revolution.
The RC51 also has a neutral switch. When the bike is in neutral, the switch provides continuity to chassis ground.
The RC51 also has a clutch switch. When the clutch lever is pulled in, the switch provides continuity to chassis ground.
Given the signals provided by those four outputs, here is my approach;
Using a PIC16F88 microcontroller, I've written code that essentially; counts pulses, monitors the neutral & clutch switches, and outputs a result on a seven segment display. The microcontroller's onboard microprocessor, running at 4Mhz, does this over and over, very quickly (like a few hundred times per second). If the neutral switch is closed, I know to display a zero (my choice for indicating I'm in neutral). If the clutch switch is closed, I display a dash (my choice for indicating I'm between gears).
The core algorithm, essentially just counts pulses arriving from the speed sensor, and at the same time tallies up the number of ignition pulses that arrive for a given number of speed sensor pulses. Given this ratio of speed sensor pulses -to- ignition sensor pulses, it calculates which gear the bike is in, and displays that gear number on a seven segment display. Very easy, and very elegant.
I've also included an "Initialization routine" that allows me to put the code into "Learning" mode. This allows the code to "learn" how many IGN pulses per speed sensor pulse for each gear, and then stores those values in nonvolatile EEPROM memory built into the microcontroller. Thus, this "learn" mode only needs to be performed once, upon initial installation of the GPI.
It took me a week or so to develop the code, and build a prototype. I just installed the final circuit, and took her for a spin. I'm happy to report, it worked perfectly the first time. Solidly indicates which gear I'm in at all speeds (up to legal limits, of course
) and all engine RPM's.
I did do a fair bit of googling, to see if anyone else had done something like this. I found a few commercial offerings, but no homebrew stuff.
So, incase there are others out there with a propensity to do so, and are a little handy with a soldering iron... here is a schematic of my design. It's pretty simple. It only took me one night to build (once I had debugged it on a breadboard). There's one IC (PIC16F88), a seven segment display, three transistors (one optional), two diodes, a few capacitors, a 5-volt regulator, and a hand full of resistors. The seven segment display turns out to be a critical component. The first one I used (out of the junk box) just wasn't bright enough to see on a sunny day. I eventually managed to find a super-bright red seven segment LED display at Kingbright (www.us.kingbright.com), and it is very visible in direct sun light.
I'm happy to provide source code and/or .hex code for the PIC16F88 if anyone is interested.
I'll even provide a pre-programmed PIC microcontroller and/or a seven segment display (for a nominal fee) if anyone needs/wants one.
Edit: 3/1/2008 -
I've been getting lots of inquiries about when I'm going to be selling these things. I'm not (not pre-built units anyway). So, Before anyone else asks "Can you make me one", or "Will you sell me one"... I just wanna set expectations. This was just an experiment for me. Like I said, it was a means to an end. I built this thing using nothing more than a few junk box parts. I am in no position to start mass-producing GPI's. My job keeps on the road most of the time. I don't have the spare cycles necessary to solder these things together. It is, however, my sincere hope that, by committing the intellectual capital to the public domain, and GPL'ing the source code, other DIY'rs out there will benefit. I also hope that other like-minded, talented, innovators out there will pick it up, improve/enhance/change it, and contribute those innovations back here to the community.
Edit: 5/24/2008 -
I've stocked up on all the components required to build the GPI. I can source individual parts and/or a complete builders kit.
I have 2 different types of builders kit. Each contains all the discrete components necessary to build a GPI
1) With ambient light sensor
2) Without ambient light sensor
...... Note: The above kits include all the components necessary to build a "completed" unit. See post #3 for an example of what a finished unit looks like.
Kit includes;
- Project box
- Custom printed circuit board
- All discrete components (resistors, caps, IC's, diodes, transistors, etc.)
- Pre-programmed microcontroller
- wire/cable, and 6-pin molex connector (to integrate into the bike)
- .8 inch red superbright LED display
- Laser cut, red acrylic, LED display enclosure (as depicted in post #3 below). You glue it together.
Essentially, you get a bag full of parts. You get to solder it ALL together and integrate it into your bike.
The kit DOES NOT include assembly instructions. My assumption is that you can read the schematics, and use circuit board artwork & silkscreen (part placement) documents I've posted later in this thread, to assemble to unit.
I have written a detailed Installation/Setup manual, showing step-by-step how to integrate a completed unit into the RC51's wiring harness, and then set it up (i.e. perform the "Learning" process). The document contains lots of digital pics. Thus, it's too large (3.5MB .pdf) to attach here. If you want a copy, send me a PM with your email address, and I'll send you a copy.
Note: I have ONLY RED .8 inch superbright LEDs from KingBright. If you want a different size or color, you're on your own.
PM me for prices and availability.
Edit: Figured out how to attach the source code. Due to file size limitations, I had to split it into 4 .txt files. You'll have to concatenate them upon downloading.
Edit: 4/17/2010 - Last kit is gone, and I do not plan to continue stocking kits/parts. From this point forward, you're on your own for components/parts.
I've undertaken a renewed interest in embedded microcontrollers lately. Over the past 20 years, I've puttered around with various MC's. I've worked with MC's such as - Intel 805x, Motorola 68xxx, 6502, and Zilog Z80. But never MicroChip PIC MC's. So I wanted to educate myself on PIC MC's, using a real-world application. And have something useful in the end.
It all started one day a couple weeks ago. A buddy and I were talking (he has a Suzuki TL1000R)... he says "I wish I had a gear position indicator". I said "I think we can do that". So, after some research and development, I built him a GPI using a PIC16F88. Turned out to be a rather easy task. Since the Suzuki has a wire coming out of the transmission carrying a voltage ranging anywhere from 0 to 5 volts, depending on what gear it's in, I just used the PIC16F88's A/D converter to read the voltage, and convert it to a gear number. Once the gear number is known, it is a simple matter of displaying it on a seven segment LED, which is now velcro'd to the side of his instrument cluster.
Voila... Now he has a GPI, and I have a good bit of real world experience on PIC microcontrollers.
But noooooooo...that wasn't good enough, I was thinking.... Now I gotta have a GPI too.
So, I set out to build a GPI for my RC51.
However, because Honda doesn't have a wire coming out of the transmission (like the Suzuki's do), a very different approach was required.
Here is the approach I took -
The RC51 has a vehicle speed sensor, which emits a very nicely formed 5v digital square wave. The square wave's frequency varies in direct proportion with wheel speed, via a variable reluctance sensor coupled to one of the gears on the final output shaft (aka, counter-shaft). There are exactly 27 pulses/cycles per counter-shaft revolution.
The RC51 also has an Ignition Pulse Generator (IPG). The IPG emits a very nicely formed semi-square A/C signal. The frequency of the signal varies in direct proportion with engine speed, via a variable reluctance sensor coupled to the flywheel. There are exacly 12 pulses/cycles per crank shaft revolution.
The RC51 also has a neutral switch. When the bike is in neutral, the switch provides continuity to chassis ground.
The RC51 also has a clutch switch. When the clutch lever is pulled in, the switch provides continuity to chassis ground.
Given the signals provided by those four outputs, here is my approach;
Using a PIC16F88 microcontroller, I've written code that essentially; counts pulses, monitors the neutral & clutch switches, and outputs a result on a seven segment display. The microcontroller's onboard microprocessor, running at 4Mhz, does this over and over, very quickly (like a few hundred times per second). If the neutral switch is closed, I know to display a zero (my choice for indicating I'm in neutral). If the clutch switch is closed, I display a dash (my choice for indicating I'm between gears).
The core algorithm, essentially just counts pulses arriving from the speed sensor, and at the same time tallies up the number of ignition pulses that arrive for a given number of speed sensor pulses. Given this ratio of speed sensor pulses -to- ignition sensor pulses, it calculates which gear the bike is in, and displays that gear number on a seven segment display. Very easy, and very elegant.
I've also included an "Initialization routine" that allows me to put the code into "Learning" mode. This allows the code to "learn" how many IGN pulses per speed sensor pulse for each gear, and then stores those values in nonvolatile EEPROM memory built into the microcontroller. Thus, this "learn" mode only needs to be performed once, upon initial installation of the GPI.
It took me a week or so to develop the code, and build a prototype. I just installed the final circuit, and took her for a spin. I'm happy to report, it worked perfectly the first time. Solidly indicates which gear I'm in at all speeds (up to legal limits, of course
I did do a fair bit of googling, to see if anyone else had done something like this. I found a few commercial offerings, but no homebrew stuff.
So, incase there are others out there with a propensity to do so, and are a little handy with a soldering iron... here is a schematic of my design. It's pretty simple. It only took me one night to build (once I had debugged it on a breadboard). There's one IC (PIC16F88), a seven segment display, three transistors (one optional), two diodes, a few capacitors, a 5-volt regulator, and a hand full of resistors. The seven segment display turns out to be a critical component. The first one I used (out of the junk box) just wasn't bright enough to see on a sunny day. I eventually managed to find a super-bright red seven segment LED display at Kingbright (www.us.kingbright.com), and it is very visible in direct sun light.
I'm happy to provide source code and/or .hex code for the PIC16F88 if anyone is interested.
I'll even provide a pre-programmed PIC microcontroller and/or a seven segment display (for a nominal fee) if anyone needs/wants one.
Edit: 3/1/2008 -
I've been getting lots of inquiries about when I'm going to be selling these things. I'm not (not pre-built units anyway). So, Before anyone else asks "Can you make me one", or "Will you sell me one"... I just wanna set expectations. This was just an experiment for me. Like I said, it was a means to an end. I built this thing using nothing more than a few junk box parts. I am in no position to start mass-producing GPI's. My job keeps on the road most of the time. I don't have the spare cycles necessary to solder these things together. It is, however, my sincere hope that, by committing the intellectual capital to the public domain, and GPL'ing the source code, other DIY'rs out there will benefit. I also hope that other like-minded, talented, innovators out there will pick it up, improve/enhance/change it, and contribute those innovations back here to the community.
Edit: 5/24/2008 -
I've stocked up on all the components required to build the GPI. I can source individual parts and/or a complete builders kit.
I have 2 different types of builders kit. Each contains all the discrete components necessary to build a GPI
1) With ambient light sensor
2) Without ambient light sensor
...... Note: The above kits include all the components necessary to build a "completed" unit. See post #3 for an example of what a finished unit looks like.
Kit includes;
- Project box
- Custom printed circuit board
- All discrete components (resistors, caps, IC's, diodes, transistors, etc.)
- Pre-programmed microcontroller
- wire/cable, and 6-pin molex connector (to integrate into the bike)
- .8 inch red superbright LED display
- Laser cut, red acrylic, LED display enclosure (as depicted in post #3 below). You glue it together.
Essentially, you get a bag full of parts. You get to solder it ALL together and integrate it into your bike.
The kit DOES NOT include assembly instructions. My assumption is that you can read the schematics, and use circuit board artwork & silkscreen (part placement) documents I've posted later in this thread, to assemble to unit.
I have written a detailed Installation/Setup manual, showing step-by-step how to integrate a completed unit into the RC51's wiring harness, and then set it up (i.e. perform the "Learning" process). The document contains lots of digital pics. Thus, it's too large (3.5MB .pdf) to attach here. If you want a copy, send me a PM with your email address, and I'll send you a copy.
Note: I have ONLY RED .8 inch superbright LEDs from KingBright. If you want a different size or color, you're on your own.
PM me for prices and availability.
Edit: Figured out how to attach the source code. Due to file size limitations, I had to split it into 4 .txt files. You'll have to concatenate them upon downloading.
Edit: 4/17/2010 - Last kit is gone, and I do not plan to continue stocking kits/parts. From this point forward, you're on your own for components/parts.
Attachments
-
18.4 KB Views: 3,929
-
14.7 KB Views: 1,884
-
12.5 KB Views: 1,521
-
10.7 KB Views: 1,685