How do I code for RPM out put with current and voltage values? I have current, voltage and watts but, I want RPM output from the currents and volts. I am running a 5V DC supply to a little motor and I am connected to a 7-segment 4-digit display that reads out volts, amps and watts. I want the watts to read out in RPM's. Any guidance as to how to approach this problem wi be appreciated!
There is no simple relationship between motor power(watts) and RPM. The motor speed depends partly on voltage but mainly on the load on the motor. So if it is free running with no load the RPM will at a be maximum (close to V * Kv where Kv is a constant for the specific motor) but if it is trying to drive a load too heavy for it the RPM may be 0 (i.e. the motor is stalled).
Since it is a small motor you may have to use an optical sensor. Otherwise a Hall effect sensor works well. You can hook to an input that is attached to an interrupt and count the pulses. This is what I did for a treadmill motor I use on my wood lathe.
Hello, thank you all for your invaluable input! I am interested in what ToddL1962 has for advice. Todd, can you describe any further on how to proceed with the coding portion for something like that? Thank you all for your time and consideration! Have a great day!
Jeremias1342:
Hello, thank you all for your invaluable input! I am interested in what ToddL1962 has for advice. Todd, can you describe any further on how to proceed with the coding portion for something like that? Thank you all for your time and consideration! Have a great day!
Best,
Jeremy Marquart
Hi Jeremy, first you will have to find a sensor that will work with you motor. Can't help you much there since I don't know the type and forma factor of your motor. For my motor I used a hall effect sensor. I epoxied the magnet to the pulley and mounted the sensor detect the magnet. That signal goes into an Arduino input with a pullup. I attached the input to an interrupt to detect the falling edge. I just simply counted the number of pulses every second, averaged 3 seconds of pulses and multiplied that by 60 to get RPM.
void rpmPulseISR(void)
{
// Triggers on falling edge of the pulse from the hall effect sensor
rpmPulseCounter++;
}
// Run rpmCalc() once per second
void rpmCalc(void)
{
const int numRpmSamples = 3;
static int rpmSamples[numRpmSamples];
static int sampleIndex = 0;
static int rpmSum = 0;
// Accumulate this second's pulses into the array
rpmSum -= rpmSamples[sampleIndex];
rpmSamples[sampleIndex] = rpmPulseCounter;
rpmSum += rpmSamples[sampleIndex++];
sampleIndex %= numRpmSamples;
// Average the number of pulses for the last 'numRpmSamples' seconds and convert to RPM
rpmMeasurement = (rpmSum*60)/numRpmSamples; // convert rotations per second to
// rotations per minute
// Reset pulse counter to accumulate for next second.
rpmPulseCounter = 0;
}