 /**************************************/
 void sensorPulseCount(){
 pulseCount++;
-Serial.println(pulseCount);
 // expected two pulse counts per rotation, two sensors 
 }
 
 void calculateRPM(){
-if (millis() - prevMillis == 1000){
+if (millis() - prevMillis >= 5000){
+	Serial.println("CalculatingRPM");
     detachInterrupt(HALLSENSORPIN);              //disable interrupts while running calculate
-    rpm = pulseCount * 60;          //converting frequency to RPM
+    rpm = pulseCount * 6;          //converting frequency to RPM(two magnets on disc x 5 sec)
     pulseCount = 0;                 //reset pulse counter
     prevMillis = millis();          //update prevMillis
     Serial.print("RPM: ");
     Serial.println(rpm);
-    attachInterrupt(digitalPinToInterrupt(HALLSENSORPIN), sensorPulseCount, RISING);
-		}
+    attachInterrupt(digitalPinToInterrupt(HALLSENSORPIN), sensorPulseCount, FALLING);
+    }
   }
 
 void motionControlStart(){
-    Serial.println("Motor Control Start");
     if (restartCount < NUMBEROFRESTARTS){
-        digitalWrite(STARTRELAYPIN, HIGH); // enable start relay if not above fail counter
-        delay(5000); // wait for 2 second for a rotation 
+	    Serial.println("Motor Control Start");
+		digitalWrite(STARTRELAYPIN, HIGH); // enable start relay if not above fail counter
+        delay(3000); // wait for 3 second for a rotation 
         if (pulseCount == 0){               // if no rotation detected in interrupt
             digitalWrite(STARTRELAYPIN, LOW); // turn off motor becuase of no rotation
             restartCount++;
-            delay (3000); // delay 3 seconds before attempting restart
+            delay (10000); // delay 10 seconds before attempting restart
             pulseCount = 0; // reset pulse count 
             motionControlStart();
             }
         if (pulseCount > 1){
         Serial.println("motion started, system running");
-		pulseCount = 0;
         restartCount = 0; // set restart counter to 0, since we're started
         allStopVar = 0; // Set allstop condition to off 
 		Serial.print("AllStopVar ");

#define DESIREDRPM_TABLE    60      //desired RPM on output wheel
//#define DESIREDRPM_MOTOR    600     //desired motor RPM (this may be superfulous) 
#define DISCSLIPCOUNT       250     //How long alarm cond before alarm signal
#define LOCKEDDISCRPM       10      //RPM to consider as "disc stopped"
#define ROTATIONVARIANCE    50      //Variance in RPM before alarm condition 
//#define TRANSMISSIONRATIO   10      //Tranmission drive ratio n:1
#define NUMBEROFRESTARTS    5      //#of restarts attempted after stopped state
#define STARTTIME           10000   //Expected ramp up time, in MS
#define STOPTIME            10000   //Expected ramp down time, in MS
 /////////

uint8_t discSlipPrecond     = 0 ;
uint8_t restartCount        = 0 ;
char msg[50];                   
uint8_t reconnectAttempt 	= 0;

/**************************************/
/*               SETUP                 /
