Measure HIGH rpm and sent to computer HELP inertiadyno

Hi,

In school I work on a project. I'm about to make a inertiadyno for model motors, running att speeds up to 30000PRM. thus I have to know the time for every rotation of the "inertiawheel" during the acceleration of the motor and not lose any signals.
I use a reflex detector to get a puls from status low to high and read it on pin2 at my arduino atmega328.

The problem is that when I run the test of the motor and plot the graph (Watt over rpm) in my computer after the run the line sort of jumps up very high here and there and sometimes goes to zero. I think im losing information somewhere, maybe in my logger or on to way to my computer. (I count the time for the first rotation and send it directly to the computer, then the second rotation and send that time to the computer and so on..)

(I havent my code here right now)

I ques my code is to simple to do this at those high RPM:s, so i would like to ask someone to give me a idé of how to write a good script that can handle this high rpms and not lose any data.

Thanks!

Without a circuit diagram and a sketch we're struggling. It sounds like its missing revs or possibly adding a few in sometimes.

Some spec. data on your sensor, from where you getting signals
would be really helpfull.
30.000 rpm is not a problem for arduino, as it 30.000/60 = 500 Hz only.
the same time if pulse is short in time (microsec. area),
it could be lost.

Well, the pulses is very long. I have painted half the inertiawheel white and half black so the length of the pulses is no problem I guess.
again I haven't the script here right now because Im writing this from my mobile.

let's say I get pulses with a freqency of 500hz, then my arduino sends data to the computer of a frequency 500hz to, can't that be a problem for the computer to process that information, even its very small data?

There is always difference between what you expect and reality...
In other words, if it painted in half doesn't mean the signal follow it sharp.
Only oscilloscope may show the truth.
In meantime, I'd suggest in order to suppress the noise/jitter
(what , probably the cause)
try to read digital input a few times in a row, 3-5 should works, and
"majority" decision after that.
If more than half "0"-s, than it LOW and vice versa.

Yes your right. I use the attachInterupt function and tells the program to do something when the signal is rising. I made a second run yesterday and I noticed a problem with the times I get from the program. During the run the motor first run at idle, but when I run it faster and faster the times for the rotations wasent even half as big as the idletimes. It should be at least 5 times smaller!! Do you think i should chose to get I pulesencorder instead and use the syncpules?

Sounds like you are dropping pulses. Why?

Maybe you should give the circuits you are using, the code and a hardware description that includes the clock rate.

If you are using the Mega328 you can run it up to 16MHz -- is that the case?

As someone said -- ans oscilloscope is a marvelous thing. It can tell you the nature of the pulse ... nice and sharp or soft and squishy? There is too much information missing to be terribly helpful.