research for cruise control

Hi,
I am a newbee :-[
I'm trying to figure out how to measure time between 2 incoming pulses that are approx 70 msecs apart. when i attach a sensor to my cars wheel axis and i am driving 100 km/h this is about the time frame.
My question is : could anyone give me a hint how to store the value so i can compare it with a setpoint? :-?

I would be very cautious with a cruise control system. If it goes wrong (programming error), something coudl go terribly wrong.

Don't worry i am taking the necessary safety precautions such as clutch and brake switches and a fuse puller

could anyone give me a hint how to store the value so i can compare it with a setpoint?

How big is the value? Will if fit in a byte, and int, a long?

type name = value;
where type is byte, int, long, unsigned long, etc., name is the name of the variable, and value is the value to be stored in the variable.

How are you measuring the time between the pulses?

Don't worry i am taking the necessary safety precautions such as clutch and brake switches and a fuse puller

I'm thinking that if you have to ask a question this basic that you are no where near ready to be designing a cruise control.

i'm not measuring yet, i calculated the time frame according to wheel diameter x pi, so when i,m drivind 100km/h the wheel revolutions are 51340rev/hr equals 14,26 rev/sec equals app. 70 msec/rev.
but the calculation is not the problem, its making the arduino understand how to measure the time between the pulses so that i can compare it with my setpoint and control the throttle with a pwm output and a simple pid sketch

@paulS
I am honored that you care about my safety ,
I have an electronics background and i am a plc programmer.
I know how to meaure time witha plc where you are constantly polling a register but i am not so familiar with c programming indeed.
I will not put it in my car untill it is fully tested

Hook it up to an interrupt, read millis() when it flags and store the value in an array of say 10 values, so you can average it. I'd move all the previous values down a postion in the array with a loop before shoving the millis() value in the top position each time the interrupt fires.
Then every half second or whatever, do the sums and output to the throttle actuator.

@pluggy
Thanks, this helps me getting started

As Pluggy said, but there's no need to move the readings up/down in the array because it doesn't matter what order the readings were taken. Just make it a circular buffer and average the contents.


Rob

http://bld.is-a-geek.com/wordpress/2010/09/28/internet-meter/

Maybe this can be used? I was using it to measure load on a internet router...

Hi Hans61

If you are in the UK be carefull, this would class as a modification to the vehicle and would therefore need to be notified to your insurance company prior to implementation. I have 10 years insurance experience and doubt that an insurance company would cover this change and therefore in the event of a claim and you had not notified them they would make your insurance null and void. Therefore making you liable for any costs not only to your vehicle but any third party claim, including personal injury / death, and then the old bill will also be trying to charge you with an IN10 - Driving without insurance and min 6pts as a bonus!

Not trying to put a damper on your project, sounds interesting!

regards

TomKett

Not trying to put a damper on your project, sounds interesting!

Actually I would try and put a damper on this idea. Not trying to insult you in anyway or try and say you are not capable of designing and building a cruise control. Just think of all the possible downside risks you would be assuming Vs the upside gain. I'm a big fan of personal freedom and individual risk taking but there is such a thing as common sense and personal responsibilities also.

Lefty

Just a point the please don't sue us notice on the Atmel data sheet says that this processor is not to be used for any automotive applications.

I Was thinking of doing similar, Han61 does your car have an ECU, my Nissan does and it's a piece of cake to talk to, i was thinking of creating a digital dashboard, already done Speed, RPM, Batt & Temp display, theres alot on youtube, anyway with the ECU as well as reading it you an also control the RPM's and would make cruise control quite easy.