Go Down

Topic: Motorcycle Control Panel with Arduino + Bluetooth (Read 25 times) previous topic - next topic

bill2009

#45
Jul 30, 2009, 10:37 pm Last Edit: Jul 31, 2009, 01:59 am by bill2009 Reason: 1
Quote
I bought (another!) bike speedo and I'm going to try using that as a readout - presumably it's waterproof.

It's also kind of a neat idea if you think of it as a bike speedo circuit bending exercise.  You're basically breaking into the speedo's sensor wire and installing an arduino that changes the readout depending on the tach input.


Ok, so meet FrankenBoB - it's BoB with a head transplant.


This is my attempt to use the original bike speedometer head as a waterproof serial LCD display - initially I was just using it to show what gear the bike is in.   The good news is, it's serial, it's waterproof, it's simple to drive.  The bad news is it's meant to be a bicycle speedometer!  It doesn't want to register very low speeds so I couldn't just run 1mph for first gear etc.  I tried a bunch of things
  • and what I settled on was driving it at gear*10+"a bit" kph - the gear number shows up in the 10's digit of the speed.  In principle you could mask off or disable the other digits but then you have a more limited display.

    I had it out on the road today for a couple of hours and it worked fine except for being sluggish and the extra digits being distracting.  I don't really care for the look of it either so I probably won't pursue the idea further - although knowing me I don't like to let a bad idea go without a fight.

    Ok, in the spirit of beating a dead horse, I just had a go at keeping the gear indicator in the ones digit with an offset of 10.5 i.e. 1st gear is 11.5, 2nd is 12.5.  This was responsive enough that I might try finding a small speedo who's LCD traces I can hack.

bill2009

BoB has had another head transplant.  This one is named Charlie - it's a set of 5 leds charlieplexed from 3 pins on the arduino.  I's a tad fugly but it's something I wanted to try.



mowcius

What are the 5 LEDs showing exactly?

It looks ok, you just need a better place to mount it I think. With the motorcycle being chrome, maybe you will need to spend some money getting a mount chromed...

Mowcius

designer2k2

there is chrome paint, its not very nice to apply but you get the look on any surface you want  ;)

Paulg5678

I hate to be a bother Bill, but I am currently attempting to build a digital tach for a car my buddies and I will be entering in the "24 hours of lemons" race this fall.  

Can you please give me a run down on how you built the circuit to trap the tachometer signal from the bike?

I am a definite novice when it comes to electronics, I was trying to read the pulses earlier today and am afraid I've killed my first arduino board.

Please help me if you can, Thanks.

bill2009

#50
Aug 24, 2009, 11:29 pm Last Edit: Aug 25, 2009, 03:25 am by bill2009 Reason: 1
Say hello to my little friend.  A while ago I decided that there would be two versions of the computer control panel.  One, code-named Brawny, would be a full function arduino clone with heavy duty power and connections, and would have all kinds of output capabilities - LCD, bluetooth etc.  Brawny became BoB who has been successful but won't fit on my bike without taking off the tachometer.

Pikachu, I figured, would be based on an attiny, have simpler connections, and be small enough to fit alongside my tachometer.  Sadly, I haven't succeeded with the attiny and I couldn't put aside my connection lust.  The results is sort of a Pikachu-heavy.  I'm still using a 168/328 with a resonator but it MIGHT be able to fit.

I'm pretty pleased with how the parts layout turned out.  I look at it now and I think, yeah, that's pretty obvious, but this took me hours and hours of staring and poking.  On the bottom right are 4 voltage dividers, one each for reading battery voltage, signal lights, neutral light, and tachometer.  The bottom left is a 10K resistor on the reset line and above that the debounce circuit for the reed switch wheel sensor.  There's female headers for the tx&rx pins but no other outputs yet.  

I've decided the most practical waterproof output is the charlieplexed led strip.  That needs 3 pins, probably the 28-27-26 on the top left.

I really wish I could have used an attiny, I look at the bottom of the board and half of the atmega's pins aren't connected.

Anyway, I've tested it with a few sketches and it worked fine, I'm hoping to try it out with serial output tonight.  Once I have that I'll start on a new LED strip hoping to get done in the next week before I leave on a 5,000 km motorcycle trip.

bill2009

Pikachu hits the road.

Tomorrow I'm leaving on a three week motorcycle trip starting in Ottawa and ending in Seattle with lots of stops in between.  I got pikachu buttoned down under the tank cowl and it's on board for the ride.

The only functions implemented are the basic gear indicator and a voltmeter during startup.

Wish me luck.

tz

I'm doing something similar.

My Arduino uses IC1 to decode J1850 (could measure RPM directly), but also goes to a GPS, bluetooth, and a 3 axis accelerometer.

http://forum.sparkfun.com/viewtopic.php?t=17018

And my radar detector.

http://www.radardetector.net/forums/valentine-one/49568-what-would-you-like-see-logging-v1-time-gps.html

Using my n810 (wimax edition with Harley colors!) as a front-end so I can use the map, media player, etc. while logging the GPS and other data.

The J1850 stream on my harley includes speed, rpm, gear with clutch and neutral, fuel consumption, odometry, fuel level, and even turn signals.  I wrote up a quick dash program in python linked to minigpsd (my project at maemo.org).  It also does OBD-II via the J1962 connector if you have it in a car.  (it probably includes cruise control, but I don't have that on my bike, I only see the indicator on the speedo so it might also be part of the data stream).

In Google Earth, after some post processing: (729kb, 360kb)
http://www.zdez.org/HarleyTelem.kmz (from last year)
http://www.zdez.org/Radar.kmz
both of these are pre-arduino - I used an bluetooth OBD2 with monitor mode for j1850 and a direct bluetooth UART to V1 radar detector (the pulse train decodes at 19200 baud), and a 10Hz bluetooth GPS into my tablet.

The Arduino merges all the devices (with better GPS!) into one bluetooth link and adds the 3 axis acceleration.

I plan on testing it this weekend.

tz

Crossposted from http://forum.sparkfun.com/viewtopic.php?p=80410#80410

URLs are to the 1-2 Meg 12MP version

The Nokia Tablet with the dashboard program:

http://www.zdez.org/NokTabletHDash.jpg

Bottom of the board.

http://www.zdez.org/BoardBot.jpg

Top of the board.

http://www.zdez.org/BoardTop.jpg

The Ram box on the DockNRock on the handlebars

http://www.zdez.org/Handlebar3q.jpg

The test stack in my bag for the test

http://www.zdez.org/TestStacked.jpg

Closeup of the Ram Aqua Box (medium/wide)
http://www.ram-mount.com/CatalogResults/PartDetails/tabid/63/partid/082065077045072079076045065081054085/Default.aspx

http://www.zdez.org/RamMountNear.jpg

The Ram Aqua Box.  A blackberry bluetooth audio gateway is in the back, and I have a nokia recharger behind.

http://www.zdez.org/RamMountFar.jpg

mrf582

#54
Sep 28, 2009, 12:42 pm Last Edit: Sep 28, 2009, 12:43 pm by mrf582 Reason: 1
@ tZ
Quote
My Arduino uses IC1 to decode J1850 (could measure RPM directly)

Can you point me in the right direction to learn how to measure RPM directly?


OP : I'm looking at your code for reading tach signals and I'm slowly understanding it. However, I realized I need to fully understand/implement interrupts before I use your method of reading a tach signal.  Thanks.

Time to read up on how to use interrupts with an Arduino.

tz

Can you point me in the right direction to learn how to measure RPM directly?
Basically you want a frequency counter, but you need to convert Hz - which will be some pulses per second to the actual revolutions per minute.  Frequency = 1 / period in seconds.   If you get 5 pulses per rotation, and that is coming in at 10 hz, the equation is 10 pulses / second * 60 seconds / 1 minute * 1 revolution / 5 pulses = 120 revolution / minute.  (note if you write this out like an equation, you can cancel the measurement units in the numerators and denominators just like 2/3 * 3/2).

With 4 cycle engines, there is one pulse every 2 revolutions for each cylinder.  There may be a different sensor that does some number of pulses per revolution.  Also you can inductively pick-up the spark plug.

My code http://www.zdez.org/pulse1.c uses 1000000 baud but feel free to edit that.  It prints out high and low values.  To get period, just add the current width and previous, or remove the edge detect flip code at the top of the IC ISR.  Once you have it printing out the correct period, just do the appropriate scaling to get RPM.

My j1850 code uses the J1850 bus to read messages.  You can find out more about the protocols if you google for OBD-II or some variant.  the ELM327 chip will read from automotive busses, and there are OBD-II commands for cars that will return the engine RPM (Wikipedia has a page with the codes).  It is a simple protocol, but I wouldn't know what any specific motorcycle uses (except recent Harleys using J1850).  Even if the bike doesn't support OBD2, if it has a compuer, there is usually a datastream available somewhere.

mrf582

#56
Sep 29, 2009, 03:51 am Last Edit: Sep 29, 2009, 03:52 am by mrf582 Reason: 1
@ tZ
Thanks.  I guess I could just use trial/error methods to find out how many pulses I'm getting per revolution.  I originally thought you meant that you could read RPM with the IC1 or something. I assumed that might have something to do with the ICSP interface on-board...?

For the hardware side, I'm probably just going to use a voltage divider to scale to 5v but can I just use an LM805 to attenuate to 5v instead? I think it has a fairly low drop-out voltage.  


bill2009

Quote
My code http://www.zdez.org/pulse1.c uses 1000000 baud but feel free to edit that.  It prints out high and low values.  To get period, just add the current width and previous, or remove the edge detect flip code at the top of the IC ISR.  Once you have it printing out the correct period, just do the appropriate scaling to get RPM.


holy cow, that seems complicated.  I was envying the J1850 but maybe not...

the whole setup is very nice though.

mrf582

Can I get some sort of a wiring schematic for the RPM pickup?  I wonder if the signal needs any sort of hardware filtering.  I imagine it would be a good idea to filter the data in software too. Maybe throw out the highest and lowest value and average the ones in between?

Or is the signal so clean in your experience that it doesn't need anything like this? The tach signal I'll be capturing is coming straight off the ECU and not off the distributor or ignition signal wire or anything like that. So I'm assuming the signal should be cleaner than Britney during her Mickey Mouse Club days...

bill2009

Quote
Can I get some sort of a wiring schematic for the RPM pickup?  I wonder if the signal needs any sort of hardware filtering.  I imagine it would be a good idea to filter the data in software too. Maybe throw out the highest and lowest value and average the ones in between?

Or is the signal so clean in your experience that it doesn't need anything like this? The tach signal I'll be capturing is coming straight off the ECU and not off the distributor or ignition signal wire or anything like that. So I'm assuming the signal should be clean...


For my motorcycle the tach signal is very clean - a 0-14v square wave while it's running.  I just use a 22k/10K voltage divider to bring it down to the arduino's voltages.  i am told that vehicles can have really noisy electrics though so you may want additional protection.

I would encourage you to capture some of the signal to see what you're dealing with before you worry about averaging.

Go Up