Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: Tachometer project stalled on: November 21, 2012, 04:40:14 pm
That doesnt seem to solve the negative number problem either.  I think its just my lack of experience.  I've got my sights set on a pretty advanced project and only have a basic understanding of Arduino. I'll do some more reading and searching and see what I come up with.
Thanks for your help I appreciate it.
2  Using Arduino / Project Guidance / Re: Tachometer project stalled on: November 20, 2012, 12:54:17 am
Thank you!
  I'll give that a try and report back.
3  Using Arduino / Project Guidance / Tachometer project stalled on: November 18, 2012, 07:41:49 pm
I am trying to make a tachometer for my car.
The car ecu puts out at 5v square wave with each ignition pulse. (4 per revolution)
I thought I could use the tutorials for the IR computer fan tachometer, but I dont understand the code.
When I run the pulses too high, the terminal window gives me negative numbers. 
I am using Picaxe 28X2 shield to provide the pulses, so at this point they are free from ignition noise while I figure out how to program it.
Here is the current code, Can someone explain it to me and help me get it to not give negative numbers?
Thanks in advance

volatile float time = 0;
volatile float time_last = 0;
volatile int rpm_array[5] = {0,0,0,0,0};

void setup()
  //Digital Pin 2 Set As An Interrupt
 attachInterrupt(0, fan_interrupt, FALLING);

  Serial.println("Current RPM:");

//Main Loop To Calculate RPM and Update LCD Display
void loop()
 int rpm = 0;

     //Slow Down The LCD Display Updates
  //Update The Rpm Count

  ////lcd.setCursor(4, 1);

  //Update The RPM
  if(time > 0)
    //5 Sample Moving Average To Smooth Out The Data
      rpm_array[0] = rpm_array[1];
      rpm_array[1] = rpm_array[2];
      rpm_array[2] = rpm_array[3];
      rpm_array[3] = rpm_array[4];
      rpm_array[4] = 60*(1000000/(time*7));   
    //Last 5 Average RPM Counts Eqauls....
      rpm = (rpm_array[0] + rpm_array[1] + rpm_array[2] + rpm_array[3] + rpm_array[4]) / 5;

//Capture The IR Break-Beam Interrupt
void fan_interrupt()
   time = (micros() - time_last);
   time_last = micros();
4  Using Arduino / Programming Questions / Re: Counting pulses against time? on: November 10, 2012, 01:22:08 pm
CLSegraves :
 Did you get this working?  I am working on a project that needs to calculate RPM from an ignition module also.
I am totally new to Arduino, so I dont understand all to code without referencing it all to the manuals.
Could you post the code you have so far?
I understand all the math, just learning the arduino data types as I go.
Thanks for you help
Pages: [1]