Show Posts
Pages: [1]
1  Using Arduino / Motors, Mechanics, and Power / Re: Engine rpm. on: February 01, 2011, 02:16:03 pm
Great. Thanks for the input.
Will try to use it!
If Need more help I be back here again.
2  Using Arduino / Motors, Mechanics, and Power / Re: Engine rpm. on: January 29, 2011, 02:28:50 pm
Correction to post.

Thanks to EASTY for the rpm code! Not EASY..
3  Using Arduino / Motors, Mechanics, and Power / Engine rpm. on: January 29, 2011, 02:25:26 pm
HELP ME! Not a programmer. Just a hobbie tinkerer.

New Arduino user. I have an rpm code that work very well thanks to EASY!.
Used his rpm code to get rpm of v-8 engine works well! Thanks EASY.  I'm trying to use a button push to read rpm and store it in eeprom and also
use this value in the code to perform my if/else statement's.

At the button push I'd like to store present rpm in as readrpm.
Have no clue how to do this, but this is what I have so far.
Any help is greatly appreciated.
Code:
#include <EEPROM.h>               //don't know how to go from here with this?


volatile int tachCount = 0;
long time;
long rpm = 0;
int outpin = 10;
int ledpin = 13;                       // output visual 
const int buttonPin = 3;          // the number of the pushbutton pin, Copied from debounce at playground...
int buttonState;                     // the current reading from the input pin
int lastButtonState = LOW;      // the previous reading from the input pin
long lastDebounceTime = 0;     // the last time the output pin was toggled
long debounceDelay = 50;       // the debounce time; increase if the output flicker
long readrpm = 0;                  // button push to store rpm as readrpm

void setup()
{Serial.begin(9600);
attachInterrupt(0, tachPulse, RISING);
time = millis();
}

void loop()
{pinMode (ledpin, OUTPUT);
pinMode(2, INPUT);
pinMode (outpin, OUTPUT);

if (rpm  <readrpm)
{digitalWrite (outpin, HIGH);
}
else
{digitalWrite (outpin, LOW);
}
if (rpm  <readrpm)
{digitalWrite (ledpin, HIGH);
}
else
{digitalWrite (ledpin, LOW);
}

  //Runs every 1/4 second
  if (millis() - time >= 250)
  {
    // rpm = number of interrupts counted in 250ms
    //  *4 to make per second
    //  *60 to make per minute
    //  /2 for 2 pulses per rotation (4 cylinder)or 4 for 4 pulses per rev. (8 cyl.)
    //  /10 for some reason???
    rpm = (((tachCount*4)*60)/4)/10;
   
if (buttonState, HIGH) //button push to write rpm as readrpm

   {write (rpm, readrpm?);}   // readrpm value

esle (buttonState, LOW)       //to read rpm store as readrpm in eeprom & also place it in the (rpm < readrpm);

   {read (?);}   //Help.

   
    Serial.println(rpm);
    //delay (50);
    tachCount = 0;
    time = millis();
   

   
   }
   
   
  }
//}

void tachPulse()
{
  ++tachCount;
}
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: Air motor Tachometer and Speed Control on: January 11, 2011, 12:19:31 pm
#include <LiquidCrystal.h>
volatile byte rpmcount;
unsigned int rpm;
unsigned long timeold;
int pin = 2;

//LiquidCrystal lcd(12, 13, 11, 10,9,8,7);

 void rpm_fun()
 {pinMode(2, INPUT);
    //Update count
      rpmcount++;
 }

void setup()

 {Serial.begin(9600);
 
   attachInterrupt(0, rpm_fun, RISING);
   rpmcount = 0;
   rpm = 0;
   timeold = 0;

 }

 void loop()
 
 {
   delay(200);   // Sample Time
   detachInterrupt(0);

   rpm = (millis() - timeold) / rpmcount;
   rpm = 1000/rpm;
   rpm = (rpm / 4) * 60;  // Six Cyl - 3 PPR  
   timeold = millis();
   rpmcount = 0;
  
 lcd.clear();
 lcd.setCursor(0, 0);
 lcd.print(int(rpm));  // print rpm
  Serial.print(int(rpm));
   //Restart the interrupt processing
   attachInterrupt(0, rpm_fun, RISING);

  }
5  Forum 2005-2010 (read only) / Syntax & Programs / Air motor Tachometer and Speed Control on: January 11, 2011, 12:19:02 pm
New to Adruino. I have no code experince.
Very interested in learning though.

Need to control an air motor speed to a set set speed.
Would like to read rpm and push a button to set the speed.
If the load draws the motor down a certian % of the set speed I need to pull open a solonoid to add air to increase rpm back to set speed.

Have a sqaure wave input for speed reference. 4 Low's=1 revolution.
Will use pin 2 as input reference. and pin 6 as HIGH output to a pwr transistor to send 12vdc to the solinoid.

Ive played with this scetch I found on the forum under search for tachometer: Can't remember who posted it though.
But not experienced enough to figure out how to mod for my use.
Any help would be very much appreciated.
#
Pages: [1]