Go Down

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

bill2009

you can see my latest hardware and code at http://fritzing.org/projects/motorcycle-computer-based-on-arduino/


If you haven't seen the Fritzing software by the way, have a look - it's pretty neat.

shvr

Nice work! I've actually begun to work on one of my own (I've gotten as far as ordering an arduino haha, waiting for it to be shipped) for my Kawasaki. Want to eventually replace the stock panel and build in a data logger for the track. This thread has given me lots more insight to what I'm getting myself into, I'm going to keep an eye on this and see if it can help me out some more.  8-)

mrf582

#62
Oct 02, 2009, 10:07 pm Last Edit: Oct 02, 2009, 10:09 pm by mrf582 Reason: 1
Cool looking schematic.

What are your thoughts on using an LM7805 to cap the voltage on the RPM signal instead of a voltage divider? The reason I'd want to do that is it'll keep very high voltage spikes from damaging the board. With a 22K/10K voltage divider, anything above 16V will send more than 5V into the board.
The downside is I don't know how quickly voltage regulators work. And if the capacitance inside will keep the signal high for a bit even if the input voltage is low. This will probably be the biggest issue at high RPM.   The signal probably won't be over 1kHz at anytime.  Most likely under 500Hz.

Typical LM7805 Datasheet
http://www.datasheetarchive.com/pdf-datasheets/Datasheets-8/DSA-140811.pdf

Or do I not need to worry about it so much because the signal is coming from the ECU and not the distributor. So if there's a voltage spike coming out of that, then my ECU itself has probably fried by then.

Or I could just use a 15k/5K divider which will allow up to a 20V spike.  But then Vout at Vin of 12 to 14v drops down to 3v. Is that good enough for the Arduino to read? Digital low = 0v and digital high = 3v? Or does it need the full 5V to register a 'high' condition?

bill2009

Quote
Cool looking schematic.
Liar, but thank you.

Quote
What are your thoughts on using an LM7805 to cap the voltage on the RPM signal instead of a voltage divider? The reason I'd want to do that is it'll keep very high voltage spikes from damaging the board.

I wouldn't have thought that would work.  As I understand it the purpose of a regulator like a 7805 is to give you a fixed voltage from a higher fixed voltage.  They can tolerate some fluctuations in the supply with decoupling capacitors but I can't imagine it would faithfully replicate a x00 hz tach signal - at least not for any length of time ;)

I had someone suggest using zeners to limit the voltage but they seemed to need too much current for the circuit I was using.  

I BELIEVE that the atmega's input protection diodes will save it from an overvoltage if there's a decent size resistor in the circuit (like the 22K).

My original version used 1M/470K for the divider and i don't think a truck could get thru that but I found i was picking up spurious ignition ppulses which went away when I reduced the size of the resistors.  

Quote
Or I could just use a 15k/5K divider which will allow up to a 20V spike.  But then Vout at Vin of 12 to 14v drops down to 3v. Is that good enough for the Arduino to read? Digital low = 0v and digital high = 3v? Or does it need the full 5V to register a 'high' condition?

I believe you need a minimum of 3.5v for a high(vcc*.7). so if you want a safe "1" at 11.5v you can't go much below the 10/22.

I could never afford the space for a bunch of regulators but if you come up with a better idea I'm all ears.

mrf582

I did say it was cool looking...  ;D

I'll research the Zener diodes a bit to see if it can be made to work.  Also, an Op-Amp is probably the most ideal thing to use in this scenario?  As of now however, I'm probably just going to go with a 22k/10k divider as you've recommended.

tz

Clamping 101:

You need a series resistor to cut the current coming in and to isolate that part of the circuit (the one on the RPM sensor) from the inner part.

Then you need ordinary (small) diodes to clamp what does come across the resistor to V+ and ground (i.e. one diode preventing the voltage from getting above V+ by conducting anything above V+ to V+, and a second preventing anything from going below ground - don't get these backward).  Then a second, probably smaller resistor to go into the arduino's input.

You can use a zener as a single diode  to ground - e.g. a 3 volt zener would clamp below ground to ground, and above 3 to 3.

bill2009

Quote
You need a series resistor to cut the current coming in and to isolate that part of the circuit (the one on the RPM sensor) from the inner part.

Then you need ordinary (small) diodes to clamp what does come across the resistor to V+ and ground (i.e. one diode preventing the voltage from getting above V+ by conducting anything above V+ to V+, and a second preventing anything from going below ground - don't get these backward).  

Then a second, probably smaller resistor to go into the arduino's input.


All right! Good answer! I can completely understand that and it sounds quite bulletproof - thank you for the lesson.

Quote
You can use a zener as a single diode  to ground - e.g. a 3 volt zener would clamp below ground to ground, and above 3 to 3.


I did try a zener but It needed a fair bit of current flowing to regulate - 10 or 20ma I think and I wasn't comfortable putting that load on my circuit.

Thanks again.

tz

Since it is a sensor, it probably has a fairly low impedance, so unless there is a lot of noise, you can use a fairly big resistor, 10k to 100k.

The other purpose of the series resistor is to prevent your clamping from affecting the signal - if the signal is 12 volt, a clamp to 5 will mean it will be 5.5 volts (diode drop) at the end of the resistor, so roughly 7 volts / 10k = .7 mA which is good for most auto sensors.  Do watch ignition noise right near the arduino, but the point is .7ma won't push or pull the other end.  The reason for the small resistor between the clamp and input is similar - if it is at 5.5v, and the internal protection wants 5.4v, you want to limit the current there too.  There will always be some variation, but there isn't much current going anyway.

The internal protection will actually power the Arduino (there was a project creating an RFID using the excess voltage from the coil which would be shunted to Vcc and power the chip).  You really don't want to do this, and you won't with a large enough resistor.

The internal protection is also basically a set of diodes, and with a large enough series resistor you really don't need the external diodes, depending on the voltage and current that needs to go through.

If the sensor is high-impediance (low current), you can't use a big resistor since .7 mA might be a large amount of current for the sensor and it will pull down the signal to where the system won't work.  One common automotive example is an oxygen sensor.   For those, you need to use something with higher impedance like an op-amp.

The inputs on the Arduino are high impedance (if you turn the pull-ups off) but are still clamped and the clamping can act more like a dead short when you get out of the voltage range.  Often just the series resistor alone works, but it depends on the signal coming in and what it can drive and the voltage range.

ptool64ar

I know I'm way behind on this ongoing motorcycle computer/ arduino thread.  I read a few of the posts, made remark or two at the beginning.  Been working on a similar, less complicated project.


 I used sirmorris's method to store data on an sd card:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235125412

It's an arduino set up.  I use it on a Harley sportster to count and store pulses from the speed sensor.  With the count(pulses/second) stored on the sd card, the card can be removed from the arduino cktry., then plugged into my computer.  

The data can then be loaded onto a spreadsheet, such as excel, then the data can be used to calculate things that happened over a period of time, speed, acceleration, rpm, make curves on the spreadsheet, calculate derivatives or integrals from the various curves.

I haven't been able to calculate torque or hp yet, but I can graph speed and acceleration curves.  If I make any mechanical changes to the bike, those curves will give an indication of any changes in performance that might have resulted from my mech. changes.  

From the speed sensor pulses, I can calculate wheel rpm, mph.   Using drive train ratio info from my bike manual, I can calculate engine rpm.  I could also collect data from the cam position sensor, which feeds an input to the ignition and possibly get a direct engine rpm read from that.  My arduino set up would work with that also.

I tried other methods to read and count pulses from the ignition output, but the pulses are very, very messy due to the connection to the ignition coil.  However, that is the same point where an electronic tach reads from.  

An electronic tach uses an LM2917 frequency to voltage converter.  Output from the LM2917 is a varying dc, which varies in proportion to pulse frequency, the tach merely reads it in the same manner as a voltmeter.  However, to store that data, 2917 output would need to be converted to digital.  An arduino could do that, then use sirmorris method to store digital on an sd card,  WHEW.

That's my $.02

Any body have any ideas of how to use rpm, speed, and time to calculate torque and horsepower?  
I've been using different formulas, calculus,  curve analysis, but I'm doing something wrong  :o

PO'T  :)  

tz

Force = mass * acceleration, and apparently you have acceleration and know the mass of you on your bike.

Torque is force * distance (normal, i.e at a right angle), so if you know the diameter of the rear tire you know the torque there from the force.  Then you have to go back through the gearing ratios (the drive chain, transmission, etc.) and determine if you want to account for friction.

Work is force * distance (in the same direction as the force), which is also calculable from the acceleration.  Power (watts/horsepower) is work per second, i.e around 750 foot-pounds per second.

A lot of it is basic physics, but more of it is just getting the units to cancel out.

ptool64ar

Quote
Posted by: tz
Force = mass * acceleration, and apparently you have acceleration and know the mass of you on your bike.

Torque is force * distance (normal, i.e at a right angle), so if you know the diameter of the rear tire you know the torque there from the force.  Then you have to go back through the gearing ratios (the drive chain, transmission, etc.) and determine if you want to account for friction.

Work is force * distance (in the same direction as the force), which is also calculable from the acceleration.  Power (watts/horsepower) is work per second, i.e around 750 foot-pounds per second.

A lot of it is basic physics, but more of it is just getting the units to cancel out.


Here's what I've tried:
1)made a curve on spdsheet. seconds as X axis, mph as Y axis, curve then = mph/secs, changed mph to feet/secs so curve shows ft/sec/sec or ft/sec^2, am I right so far?  (ft/sec^2 is acceleration), right ? or wrong?

2)wt of bike+me = approx 700lb, mass = wt(lbs)/32.18ft/sec^2 (force of gravity in ft/sec^2)= 700/32.18 = 21.75lb-sec^2/ft

3)force = mass*accel = 21.75b-sec^2/ft *(say) 30 ft/sec^2  this will = 652.5 lb of force

4)torque = force * radius of turned wheel, wheel = 2ft in diam, radius =1ft, therefore: torque= force of 652.5lb * 1ft = 652.5ft-lb on the driving wheel, right? wrong? at time when accel=30ft/sec^2 ???

5) find rpm,  rpm=ft/sec^2 @1-sec =ft/sec (say)30ft/sec^2 @1sec = 30ft/sec, *60 =1800ft/min,  diam of wheel =6.33ft, then rpm=1800ft/min/6.33ft/rev= 284.4 rpm for dr. wheel

6)hp=torque*rpm/5252 = 652.5ft-lb*284.4pm/5252 = 35HP at the dr. wheel when bike is being accel at 30ft/sec^2

7) however, following this chain of calculations up the curve, I end up with ridiculously high HP, almost 400hp,(at the dr. wheel)  not on my harley sportster. :o
Further calcs. for engine hp gives a high hp of 109 hp from the engine which is doubtful. :-/

I found the derivatives of the original curve, which give instantaneous change in accel, using that,  I end up with extremely low hp. :-[

Any advice would be appreciated, but I know this is off subject. :)

PO'T



tz

You will need to go to the gearing to get engine torque v.s. wheel torque if you want the torque at the engine, but I don't understand:

diam of wheel =6.33ft,

This wheel is taller than I am.

The force given the mass would cause about a 1G acceleration so the calculation is likely good through that point.

ptool64ar

#72
Oct 08, 2009, 10:41 pm Last Edit: Oct 08, 2009, 10:42 pm by ptool64ar Reason: 1
Sorry, NOT  diameter of the wheel - the circumference = 6.33 ft
My mistake  :-[ :-[
po't

tz

I'm guessing the acceleration is not quite right as you go up.

Acceleration is ft/sec^2 statically, but to be correct, it is dv/dt - change in velocity with time.

Kinetic energy is 1/2 m v^2 and maybe that would be a better place to calculate the energy per second.

ptool64ar

Quote
Acceleration is ft/sec^2 statically, but to be correct, it is dv/dt - change in velocity with time.

Kinetic energy is 1/2 m v^2 and maybe that would be a better place to calculate the energy per second.


Thanks for the help.
in your equation 1/2 m v^2, is that (m in meters, or m = mass) and v is velocity? in what? meters/second?

Thanks for the previous help.

Go Up