Air motor Tachometer and Speed Control


new adruino. have no code experince.
very interested in learning though.

need control air motor speed set set speed.
would read rpm , push button set speed.
if load draws motor down certian % of set speed need pull open solonoid add air increase rpm set speed.

have sqaure wave input speed reference. 4 low's=1 revolution.
will use pin 2 input reference. , pin 6 high output pwr transistor send 12vdc solinoid.

ive played scetch found on forum under search tachometer: can't remember posted though.
but not experienced enough figure out how mod use.
any appreciated.
#

#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;  // 6 cyl - 3 ppr  
  timeold = millis();
  rpmcount = 0;
 
lcd.clear();
lcd.setcursor(0, 0);
lcd.print(int(rpm));  // print rpm
 serial.print(int(rpm));
  //restart interrupt processing
  attachinterrupt(0, rpm_fun, rising);

 }


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Air motor Tachometer and Speed Control


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums