Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
I need to know the actual rpm the motor is running at.How can I get the actual rpm of the motor?From the motor spec, I know that the resolution of the motor is 12 counts per revolution.,with gear ration of 20:1.How to calculate or compute the rpm of the motor? Do I need pulse per revolution of motor to compute the rpm? There is only count per revolution written in data sheet.
Please refer to the above link, it provides some details of the motor(SPG-30E-20K).
[...] can I know what is it 5
and pulse per revolution.
second means?
12 counts per revolution is the output of the shaft, main shaft is 240 counts per revolution.Sorry, I'm kind of confused. Please advise and thank you for the time.
Measuring just one of the encoder output channels looks to change things slightly. From the diagram in the datasheet it looks like a 'count' is a binary state change on either of two channels so 'count' is not the same as pulses per channel (where a pulse is a cycle of the waveform measured from (either) one of the encoder output channels - which you are measuring with your 'scope). Fortunately the diagram also suggests that there should be three pulses per revolution on either of the channels.
N.B. This is based on my interpretation of the datasheet and it's non-definition of exactly what a 'count' is.
The data sheet says 12 pulses per rotation and so does the source code!
I guess you're misreading the quadrature output curve to get to your conclusion?
countAB=0; //reset the counterlcd_clr(); //clear lcd screenwhile(countAB < limit) //while counter is in the limit{ //motor will overshoot because it can not sudden stop initA = A; //get current A value //overshoot depends on load and speed of the motor initB = B; //get current B value do { run_cw(speed); //run motor in clockwise direction with user defined speed }while(initA ==A && initB ==B); //continue run until state change countAB++; //increment counter for each state change}
Oh, the data sheet is quite clear on that IMO...
The the datasheet actually says 12 'counts' per revolution and makes no mention of pulses. To me a logic pulse would be a 0>1 transition followed by a 1>0 (or 1 cycle of a square wave).The quadrature output curve suggested to me that a 'count' was effectively a logic state transition on either channel A OR B and thus the 12 'count' is the result of 3 complete square wave cycles (pulses) output on BOTH channels.
Code: [Select]countAB=0; //reset the counter[...]
countAB=0; //reset the counter[...]
//convert the desired agle to the total angle at the rear shaft (multiply gear ratio) smalldegree = desire_angle *gear_ratio; //12 count per revolution at the rear shaft //meaning each count represent 30 degree //to calculate how many counts needed for the desire angle //we divide total angle at the rear shaft with 30 degree limit = smalldegree/30;
QuoteOh, the data sheet is quite clear on that IMO...And in my opinion it isn't clear enough. The fact it leaves scope for opinion suggests it is incomplete!
12 counts, on that we agree
counts equals pulses and periods - just different ways to wiev it.Each count has got 4 logic states (eg. 00, 01, 11 and 10) when you are doing quadrature on the two 90° offset pulse trains. If you looked at just a single signal, each count would have just two logic states, "0" and "1".Perhaps that clears it up for you?
You missed...
void motor_run(unsigned char speed, unsigned long degree){ desire_angle = degree; //in this case gear ratio is 1:20 gear_ratio = 20; //convert the desired agle to the total angle at the rear shaft (multiply gear ratio) smalldegree = desire_angle *gear_ratio; //12 count per revolution at the rear shaft //meaning each count represent 30 degree //to calculate how many counts needed for the desire angle //we divide total angle at the rear shaft with 30 degree limit = smalldegree/30; countAB=0; //reset the counter lcd_clr(); //clear lcd screen while(countAB < limit) //while counter is in the limit { //motor will overshoot because it can not sudden stop initA = A; //get current A value //overshoot depends on load and speed of the motor initB = B; //get current B value do { run_cw(speed); //run motor in clockwise direction with user defined speed }while(initA ==A && initB ==B); //continue run until state change countAB++; //increment counter for each state change } //once program exit the previous while loop //meaning that the motor has reached the desired angle stop(1000); }
Unless you're a certified electronics engineer, or have the equivalent knowledge on the subject, your opinion is not a valid argument!
So by YOUR definition of a count above, they should count (limit * 4) state transitions on lines A&B.The code shows they count only limit transitions NOT (limit * 4) ie their definition of a 'count' is different to yours (yours being correct for quadrature encoders). By your definition this encoder has just 3 'counts' per revolution according to the code... Hence my argument that IMO the data sheet should be explicit on exactly what the manufacturer means by a 'count'.