Hey, I'm really pleased with how this is going. This is still a prototype but it's functionally complete and works very well. It's messy because I hacked up a generalized arduino proto-shield to mount it but there's really not a lot to the hardware and now that it's working I can refine it to something much smaller and neater. The functions that are there at the moment are speedo, tach, and gear indicator the speedo and tach are dead accurate and the gear indicator responds very crisply to shifting up or down.

Actually, if you think this is messy, have a look at yesterdays incarnation which had a bluetooth module on it. I rode around with my laptop in a backpack for 20 minutes gathering data.

HardwareUnderneath the protoboard is a standard arduino. It's getting fed pulses from the bike's tachometer circuit, a reed switch senses wheel rotation, and there's a connection to the neutral light. The sort-of-beige connector on the left carries the connections from the bike and the round barrel connector goes from the power resistor on the protoboard to the arduino's regulator.

A lot of the complexity comes from interfacing with the bike's electrical system: There's a power resistor to take a bit of a load off the regulator and there are resistor divider networks to bring the tach signal and the neutral light connection under 5 volts. There's also a debounce circuit for the reed switch. Otherwise it's all software.

SoftwareThe code is mostly not too tricky. At each wheel pass it calculates wheel speed in RPM and then divides that into the most recent engine RPM. The ratio is unique for each gear ranging from around 12 in 1st gear to around 4.5 in 5th gear. I require 2 consecutive wheel passes to give the same result before I accept the gear change.

This all sounds ok on the surface by the way but what you're really doing is counting how many times the engine turns while the wheel turns once. The answer is a smallish integer generally in the range of 4-12 but depending on the exact coincidence of engine and wheel you could get an answer of 4,5, or 6 in 4th gear and the possibilities for 5th and 3rd fully overlap these. Taking the time for each rather than actually counting works pretty well. When I was monitoring with bluetooth I saw a few false selections but none that persisted long enough to get to the display.

I said the code was mostly not too tricky, the exception is in the interrupt handling. My standard way of handling interrupts is to queue them in a log which I peel off in the "loop" function. This lets me put all kinds of debugging stuff in the code without worrying about missing interrupts. Because the tach interrupts can be fairly quick - maybe 100 a second, I bulk them up by only logging every 10th one. This probably doubles the amount of code but I'm used to it and the flexibility is great.

Next StepsI'm going to redo the hardware based on an RBBB circuit board from Modern Device Company with a section of vero-board or other prototype PCB beside it rather than above it to hold the dividers and debounce circuits. It should be easy to get this into a package that can go inside the tank console instead of being glued to the top.

I'll use the same software for now but I'm dreaming up functions I can add. I want to do some work with 0-60 timing and wind resistance calculations. I also have a notional idea of getting rid of the tank console indicators and do a little strip of lights on the handlebars.

I found that these pulses, on my Harley Sportster, are greatly disfigured by the ignition coil. (they are the same as the electronic ignition output) I tried using a parallax basic stamp to count them but the counts were very innaccurate, in other words the ignition output pulses were very difficult to work with. I know that the ignition pulses feed the tach circuit, where a ckt. similar to a lm2917 converts the pulses to a varying dc.

I found two other sources on my bike that provide clean pulses. One is the speed sensor, and the other is a sensor that feeds the electronic ignition.(can't remember the name of that one). I also changed to an arduino set up, which works much better, for me, and is less expensive, than the basic stamp. I prefer to use the speed sensor, since it won't mess with the ignition and is easier to get at. However, the speed sensor pulses come out at 12v, but I use a volt divider to reduce them to approx. 4v.

Presently, I'm simply counting and timing the pulses and storing that data on an SD card. (SD/MMC FROM THE GROUND UP, by sirmorris, arduino forum exhibition)

By your picture, it looks like you have your ckt. attached to the gas tank cap.

I found that these pulses, on my Harley Sportster, are greatly disfigured by the ignition coil. (they are the same as the electronic ignition output) I tried using a parallax basic stamp to count them but the counts were very innaccurate, in other words the ignition output pulses were very difficult to work with. I know that the ignition pulses feed the tach circuit, where a ckt. similar to a lm2917 converts the pulses to a varying dc.

These are the pulses that feed the tach. They are very clean. a 0V, 14V square wave with something like a 50% duty cycle. I was very pleased with how easy they were to work with. I am also using a voltage divider to bring the signal down to a workable range.

Quote

By your picture, it looks like you have your ckt. attached to the gas tank cap.

You make it sound like that's a bad thing! No, just kidding, the triumph has the tach mounted in the tank console ahead of the filler cap. The breadboard is mounted on a plastic blank above the tach. My next prototype will go under the blank with only the display showing through.

Probably my biggest issue with this project has been working in the 14V electrical environment. I'm using a 100 ohm resistor to drop a bit of the voltage before the arduino's regulator sees it - how are you handling it? Where is your setup mounted? got a pic?

Be sure you add a diode in series with a + supply (a 1N4000-whatever). And it would be a good idea to put a Zener to ground (anything in the 20-30V range will do) after the 100 Ohm resistor. That'll help get rid of any noise spikes (which can be both positive and negative) from the bike's supply. Bikes are probably not as bad as cars, because they don't have lots of motors and solenoids for things like wipers and power windows/locks, but it's still not a "clean" electrical environment like your benchtop supply is.

Presemtly, I don't have the circuitry attached to the bike. I'm still kinda in the testing stage, but the ckt is operational. Like your's I need to arrange the circuit into a smaller system.

I pick up the 12v square wave pulses from the speed sensor, which I believe is a magnetic pickup device(at this time I can't remember the name of that kind of device). I'm not exactly sure where the pick up device is located; I would need to look in the bike's maintenance manual. However, under the seat there is a deutch connecter, which connects a cable from the speed sensor to a cable going to the speedometer. I split the deutch connecter apart, then using a T connection, which I made from deutch connecters, I feed the arduino device. (a diagram of how to make the deutch-connector T was illustrated in the bike's maintenance manual). As I mentioned before, I use a voltage divider to bring the pulse volts down to ~4v.

I'm using an arduino RBBB (really bare bones board) that I bought from http://www.wulfden.org/TheShoppe/freeduino/starting.shtml, which is the same as the RBBB from Modern Device. For extra circuitry, I have to attach the RBBB to a radio shack peg board. Extra ckts. being voltage dividers, a regulator and an SD/MMC mini(interfacing)board from http://www.futurlec.com/Mini_SC.shtml. and attached that according to plans from http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235125412. I need to figure out how to fit this stuff onto the bike so that I can use it while I'm riding.

Earlier methods that I used, such as the basic stamp method, I tried using pulses from the tach feed, and I attached the circuitry to the handle bars, and it was all very clumsy and very inconvenient to operate, etc, etc, etc, while riding. With the SD/arduino method I can just leave the circuit running, since the SD card will record much data for a long period of time.

Are you using the MC battery as the power source? If so, are you using a voltage divider to bring the voltage down to 5 volts?

Ran Talbottrural Arizona Re: Motorcycle Control Panel with Arduino + BluetoothReply #4 - Today at 05:34:26 Be sure you add a diode in series with a + supply (a 1N4000-whatever). And it would be a good idea to put a Zener to ground (anything in the 20-30V range will do) after the 100 Ohm resistor. That'll help get rid of any noise spikes (which can be both positive and negative) from the bike's supply. Bikes are probably not as bad as cars, because they don't have lots of motors and solenoids for things like wipers and power windows/locks, but it's still not a "clean" electrical environment like your benchtop supply is.

Posted by: bill2009]Next StepsI'm going to redo the hardware based on an RBBB circuit board from Modern Device Company with a section of vero-board or other prototype PCB beside it rather than above it to hold the dividers and debounce circuits. It should be easy to get this into a package that can go inside the tank console instead of being glued to the top.

Another bare bones ckt. to check outhttp://store.fundamentallogic.com/ecom/index.php?main_page=index&cPath=2&zenid=1e5fa2768ad20847d6d308d30584a605The Iduino. You will need to provide a seperate 5v (7805) regulator for this, though.(fora couple of bucks) However, it connects to your pc via USB for programmoing, as do other arduino devices. I use one of these to store data on a seperate EEPROM chip.

the(Wulfden, Modern Device) RBBB requires an off-board USB to TTL serial adapter ($15-20) or an RS232 to TTL adapter ($5) for programming. For my RBBB, I ended up buying both, since I couldn't get the RBBB to operate with the RS232 to TTL adapter. (it works ok with a USB adapter that I bought at: http://store.fundamentallogic.com/ecom/index.php?main_page=index&cPath=6 )

There aren't many bikers on this board, your project looks very interesting. 8-)

Be sure you add a diode in series with a + supply (a 1N4000-whatever). And it would be a good idea to put a Zener to ground (anything in the 20-30V range will do) after the 100 Ohm resistor. That'll help get rid of any noise spikes (which can be both positive and negative) from the bike's supply. Bikes are probably not as bad as cars, because they don't have lots of motors and solenoids for things like wipers and power windows/locks, but it's still not a "clean" electrical environment like your benchtop supply is.

Thanks for the explanation. I have read that the supply can be spiky but no sign of problems so far and i wasn't sure where to put the zener or what voltage it should be. There is certainly the starter and its solenoid that could cause spikes. In theory I think I should have zeners on the tach and neutral light lines as well as the power supply. I'll look at the diode and zener for the ps in the next layout. I've also thought about cannibalizing a cheap cigarette lighter ipod charger and just getting that away from my circuit altogether. The RBBB power supply has a diode in it by the way, where would that come in?

I'm working on two versions now codenames Brawny and Pikachu.

Brawny will be the rbbb version with a multi-function display and robust power supply.

Pikachu will be a mini version with basically just the atmega and a minimum of other bits. Pikachu's display will be something like a single LED or a bicycle speedo or a panel voltmeter which I think would be kind of fun - 1 to 5 volts for the different gears, 0 for neutral. I thought if I kept the current draw down to something really low I could get away with some really simple power arrangement - maybe even a coin cell.

The diode in the RBBB is on the +5 supply. It provides the reverse-polarity protection if you don't use the on-board regulator, and plug in an external 5V, instead.

No damage "so far" doesn't mean "so good": I once connected a 12V LED array (one of those 1-inch "super jumbos" with 6 LEDs in series) into the lighter socket of my pickup, just to see how long it would last. It worked fine for about 3 weeks, then just quietly died, with no release of magic smoke or similar dramatic symptoms.

The AVR chip should already have protection diodes on all its digital inputs. If you're worried about spikes, you can probably get away with just putting a resistor in series with the input, so most of the energy will be dissipated there, instead of in the diodes (where there might be enough to blow one up, since they're tiny little things). You need the more elaborate protection on the power supply because it's supposed to let lots of energy through to run the system, so you can't just throw most of it away.

No damage "so far" doesn't mean "so good": I once connected a 12V LED array (one of those 1-inch "super jumbos" with 6 LEDs in series) into the lighter socket of my pickup, just to see how long it would last. It worked fine for about 3 weeks, then just quietly died, with no release of magic smoke or similar dramatic symptoms.

Ok, good example of what i don't want to have happen! Thanks again for the explanation.

Color me confused, but why not do a 2 stage regulation? The mobile vehicle power system is horrible, to put it mildly. I can't speak for bikes, but voltage swings from just under 12V (before start) to 15+ are common in cars. As well as all manner of hash, noise,etc. If you still want to use the arduino regulator, stick a L7809ABV (SMTMicro) between the car's supply, and the arduino. That will take 10.5-26V, and convert to regulated 9V - which you can then feed the arduino. Yes, it's a little lossy, but it provides a secondary level of protection. (This assumes you don't need 12V) the LM7812ACT would give you 12V, but it needs 14V in - a bit iffy when the engine is not running.

Actually, a drop down to about 8V during cranking is not only common, it's not even considered "a problem".

Well, except by the people who don't know about it, and assume they'll always get at least 12V or so coming into their projects

If it's really important to keep your system running during crank, you need to either spring the extra money for a switching regulator, or use a linear and give it a good heat sink to handle the normal 14-15V of the alternator. For the products and projects I've done in the past, it usually hasn't mattered, so I've just let them reset themselves when the voltage droops, and start running when the engine does.