I have 4 motors and I want to calculate rpm of all 4 motors on a single tm4c123gh6pm launchpad. Each motor has an encoder mounted on its shaft.
What are different ways to calculate rpm other than QEI.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I have 4 motors and I want to calculate rpm of all 4 motors on a single tm4c123gh6pm launchpad. Each motor has an encoder mounted on its shaft.
What are different ways to calculate rpm other than QEI.
ISHAN PATEL said:I have 4 motors and I want to calculate rpm of all 4 motors
Firm/I believe that you'd benefit by (temporarily) eliminating ALL FOUR motors - and instead make a serious study of the MCU's Timers. Along with - and helpful to that end - you should review use of MCU's GPIO to generate a pulse train - which will (again temporarily) take the place of the (more complex) encoders.
Eliminating the motors greatly speeds, eases & enhances your development of a solution. Only add the motors (after) you've tested & verified the basic Timer & Pulse Generation and resulting, "Input Frequency vs. Elapsed Time" MCU processing.
You can "save" MCU pins by the (clever & timely) examination of each motor's encoder output (earlier poster Robert has past described such a method - right here) - one at a time. (this is so as motor direction - in many/most applications - is unlikely to be rapidly changing!)
Small - highly focused - measurable steps (i.e. KISS) are your best, "foot-steps" to a good solution.
And - you present us w/FOUR Motors - ALWAYS - YES ALWAYS BEST to start with ONE Single motor - add others ONLY after that first one achieves full/complete Success! (KISS dictum - part deux.)
My friend - while firm/I are in the "BLDC Control & Display Biz" - never/ever have we found the need to employ ONE MCU versus FOUR Motors!
You must determine the timing requirements & resources - forced upon your (single) MCU - by such usage. As small biz owner - I'd consider, "KISS-based, Divide & Conquer" perhaps employing two MCUs - one charged w/motor control - second w/Timing - and both inter-communicating.
By my read - the precise failure mode has not yet been clearly presented - and (really) is required for you to encourage further, "helper digging." I'd switch to two MCUs - make that work - and only later - as/if justified - resume the, "One MCU and ONLY one MCU" quest! (i.e. Anti-KISS approach)
I am calculating rpm in timer interrupt and using it to feed in-code PID loop. If I want to send timer calculated values to other MCU and I've to use a plethora of UARTs. I can use each TIVA for two motors but Timer Interrupt has to be present in each TIVA .
PLUS I am sending rpm values from a PS2 controller which is received in UART Interrupt to set desired rpm to my motor.
What is KISS approach?
Google very well defines "KISS." I've provided detail (here) many times - even w/in the "Tag Block" - one post up. Your understanding of KISS will greatly assist you - I guarantee that...
I don't believe that I can "improve upon" my earlier writing: "You must determine the timing requirements & resources - forced upon your (single) MCU - by the demands of 4 motors."
Only when those are clearly known - and presented here for review - can anyone properly guide further. You are asking for, "Hard, precise factual guidance - yet not providing the necessary input data to enable such..."