Speedzilla Forums banner
1 - 20 of 69 Posts

· Captain Obvious
Joined
·
738 Posts
Discussion Starter · #1 · (Edited)
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 :D ) 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.
 

Attachments

· Captain Obvious
Joined
·
738 Posts
Discussion Starter · #2 · (Edited)
Here's the schematic (updated 5/24/08).

There are two circuit variants. The first includes components to incorporate an optional ambient light sensor. If you don't care for this option, then use the second variant (ground pin 1, and leave pin 2 open circuit).

Edit 05/24/08: Since starting this thread, I have designed a custom Printed Circuit Board and had a few manufactured. See the attached .pdfs for PCB art work. I'm also attaching an expanded scale view of the top-side silkscreen, showing parts placement.
 

Attachments

· Captain Obvious
Joined
·
738 Posts
Discussion Starter · #3 · (Edited)
Here's a pic of the assembled prototype. The little black box tucks away neatly up in the right side of the upper cowl. And the display fastens nicely to the left side of my instrument cluster.

Edit 05/24/08: Added some pics of the new custom PCB. Unpopulated & populated.
 

Attachments

· Captain Obvious
Joined
·
738 Posts
Discussion Starter · #4 · (Edited)
Here's a pic of the seven segment display velcro'd to the left side of my instrument cluster. Shown here, displaying a .8 inch high "0" (zero), indicating I'm in neutral.... right next to that pretty little green neutral light :p
 

Attachments

· Registered
Joined
·
367 Posts
man that is awsome!!!!!! Thanks for sharing. I don't know a thing about IC's but is it hard to understand when I do have a background in aircraft avionic maintenance and car stereo stuff???? that would definitely help at the track!:rockon
 

· One Liter Duc Eater!
Joined
·
73 Posts
All i wanna know is......will you be willing to build another one and sell it to me??

Very interested!!
 

· Shane RC51
Joined
·
889 Posts
Very, very impressive. You make it sound so easy! I don't think I'd be too successful at making a copy. I agree with Roxx. What do you think about making a few more and selling them?
 

· Registered
Joined
·
3,019 Posts
PDF truth, I applaud you for being a physics genius! :rockon

BRAVO! :notworthy :notworthy

*Ill take one as well :)
Or if you were to actually post up which parts you used, where to get them etc, then I would happily build it myself, but until that happens I would never attempt this project on my own...

WHere does this unit plug in?

Stunna
 

· http://www.moli.com/rc51
Joined
·
237 Posts
DUDE, here's to you :rockon :notworthy :clapper

I would require the following, at minimum, before I could attempt this:

  1. A list of part numbers and where to find the parts if all could not be had at a Radio Shack.
  2. Instructions as to where the unit plugs into, and since I presume where plugs into will also need to be fabricated, instructions on how to do that.
  3. How one goes about "programming" it once supplied the code from you.
  4. Beer.:clapper
  5. Pizza.:D
  6. A lot of luck.:wacky

If you can supply the first 3, I'll try my best on the last 3.
 

· Registered
Joined
·
32 Posts
DUDE, here's to you :rockon :notworthy :clapper

I would require the following, at minimum, before I could attempt this:
  1. A list of part numbers and where to find the parts if all could not be had at a Radio Shack.
  2. Instructions as to where the unit plugs into, and since I presume where plugs into will also need to be fabricated, instructions on how to do that.
  3. How one goes about "programming" it once supplied the code from you.
  4. Beer.:clapper
  5. Pizza.:D
  6. A lot of luck.:wacky
If you can supply the first 3, I'll try my best on the last 3.
You should be able to get everything other than the microcontroller/socket and maybe the LED display at any Radio Shack (resistors, capacitors, diodes, transistors, 5V voltage regulator, and circuit board are all available; at least at the three Radio Shacks near me). Programming the MC is a little harder; probably easier to have him send you one pre-programmed.

pdfruth - you might want to make up a batch of 5-10 and sell them at a small profit. What are you using to program the PIC? I've thought about playing with the PIC series of MCs before, but never got started (there always seems to be something else that needs my time).
 

· Registered
Joined
·
466 Posts
Start building more and sell em here, I'm interested.
:rockon
 

· Captain Obvious
Joined
·
738 Posts
Discussion Starter · #19 · (Edited)
Whoa.... whoa... whoa.
Guys, hang on a minute.
I had no idea there'd be this kind of interest.
After all, there are a number of commercial offerings out there already. I figured everyone would have bought one of those already.

Firstly.... I'm pretty good. But I'm not so arrogant to think this thing is 100% bug free. I'll bet there's a couple kinks here or there that still need to be worked out. I'd like to do a little more testing. Only problem is, ITS FRIGGIN WINTER here, so I can't really get any more quality seat time in this year.

Secondly... I'm just a poor schmuck like the rest of ya. I got a full time job too. Gotta make money to feed this habit somehow:D . Microcontrollers (eh um... I mean motorcycles) just happen to be one of em. With the exception of the microcontroller, I built this thing with a bunch of junk box parts I had laying around. So, I don't have a ton of parts with which to start up a production line. To produce these things in any sort of quantity is going to take some time, and a chunk of change. I'll have to find a supplier(s) I can source the parts from. Honestly, most of the stuff can be ordered right off the Radio Shack website (as yellowt2 pointed out earlier). Its the seven segment display that's a little more problematic. While I was out on my initial test ride yesterday, the one thing that I didn't like so much was the fact that it was hard to see. The display I used was just a cheapo, so it was easily washed out by moderate-to-intense direct sun light. I'm doing some research to see were I can get a super bright LED. Does anyone here know?

So.......... before we go hog-wild. I wanna make sure the kinks are worked out before dumping a bunch of these on the streets. Here's what I'd like to propose. I need two volunteers to do some shake-out testing. Preferably someone in a warm weather climate. Someone who will use the thing at least a couple times a week for the next couple months. I'm willing to supply an assembled prototype for free. You'd have to install it and test it. And you can keep it for your efforts. You should also understand, and accept, that installing this thing does require alterations to your bikes wiring harness. Like anything else in life, there is risk involved, however minimal.

In the meantime, anyone who cares to, is free to build one of their own. I've posted the schematic. And I'll provide source code (free) and/or pre-programmed microcontrollers (for $10 a piece) to anyone who wants one. All I ask is that you feedback any refinements you make, to the community here on the forum.

In the next couple weeks I'll be writing a set of instructions on how to install it. And working on some other refinements. I just posted a new version of the schematic (see post #2 above). I decided to add another transistor (Q1 in the schematic) as a precaution, to protect against the possibility that a voltage spike in the bike's electrical system might wipe out the microcontroller (or vise versa). Should never happen, but it certainly could.

Let me know if you'd be willing to help test.
There isn't enough space to hold all the PM's I've been getting. So Please email me instead of PM'ing (pat atsign patfruth dot com).
 

· Captain Obvious
Joined
·
738 Posts
Discussion Starter · #20 ·
In answer to the questions about how to connect this to the bike.

Here's what I did. By all means not the only option. But seemed the easiest to me.

My little circuit requires six connections to the bike;
- power
- ground
- ignition pules generator
- speed sensor
- neutral switch
- clutch switch

With the exception of the speed sensor, all of these connections are easily accessible (comparatively speaking) from one central location on the bike.

If you pull the left side fairing, you'll see the fuse box. Access to the neutral switch wire, and the clutch switch wire is right there, on the back of the fuse box, where the clutch diode plugs in.
- The wire for the neutral switch is light-green.
- The wire for the clutch switch is green-red.

The rest of the connections are accessible at the blue wiring harness plug, just on the inside of the frame rail that the fuse box is clipped to. You have to lift the tank to get at it (lift it, not remove it). The blue plug in question is tucked inside a translucent rubber boot, just back of the air box. Only a few inches from the fuse box.
- The wire for the ignition pulse generator is yellow.
- The wire for power is black/white
- The wire for ground is green

Access to the speed sensor wire is on the other side of the bike. You'll find a white, 3 terminal, connector, zip-tied to the right side of the rear sub-frame, close to where the sub-frame bolts to the frame. There are three wires in this connector; pink, green, and black. The pink wire is the one you want. I spliced into it and ran a short length of wire over to that blue connector, where all the other connections are made. (so all my connections were within a few inches of each other). If you have a speedo-healer, make sure that you splice into the pink wire, ahead of the speedo-healer.

Alternatively, all these connections can also be made at the two big ECM connectors. I just chose to do it by the fuse box, so as to keep the cable as short as possible.

Oh ya the cable I used..... I just cut the ends off an old computer 9-pin serial port cable. There's nine wires in there so you can use six of em, and cut the others off.


How you actually splice into those wires listed above is up to you. There are many techniques. I prefer solder and shrink wrap myself. In my case, I didn't actually cut into any wires. Instead, I just pulled the spade connectors out of the plastic connector housings, soldered my wires onto the side of the spade connector, and then slid the spade connectors back into their original location. Very neat and tidy. It's quite easy to slide them out of the connector housing. You just have to use a small jewelers screw driver, or a heavy duty stick pin, and take your time. But it results in a very nice, clean, installation.

I'll try to take some pictures, and write an installation manual in the next couple weeks. Pictures will probably make it easier to understand.
 
1 - 20 of 69 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top