The following Arduino program counts pulses from a motor\'s encoder for 100ms. T
ID: 2081943 • Letter: T
Question
The following Arduino program counts pulses from a motor's encoder for 100ms. The count for 100ms: count = 174 The encoder's pulses per revolution rating: PPR = 460 Find the frequency of the encoder's input square wave, f Find the motor's speed assuming units of RPM Arduino sketch int count = 0; float f = 0; float PPR = 500; float RPM= 0; void setup() pinMode(2, INPUT); attachlnterrupt(0, freq, RISING); Serial.begin(9600); void loop() {count=0; delay(100); f=10*count; RPM=f/PPR*60; Serial.print(count); Serial.print(* Pulses/100ms"); Serial.print(" "); Serial.print(f); Serial.println("Hz");} void freq() {count=count++;}Explanation / Answer
According to the code, the formulas and values of frequency and speed is,
Frequency f=10*count=10*174=1740Hz
Speed=f/PPR*60=1740*60/460=226.96RPM