If single channel, 3 pulses per rear shaft revolution. Assumed 4x quadrature encoder is used, so 3 x 4 = 12 counts per rear shaft revolution. Since you are using SPG-30E-30K (Gear ratio, 30:1), so 12 x 30 = 360 counts (quadrature encoder) per main shaft revolution.
You might need a internal timer to measure the speed of rotation. Let say the timer count the quadrature encoder every 0.1 second (10Hz), RPM = (Count/360)/0.1 x 60 (1 minute = 60 seconds)
Dear sir, I am using SPG30E-20K. The user manual stated that there are 60 counts per revolution of main shaft. I was using Channel A of the encoder for capturing pulse. PIC16F877A used, RA4 as input for the captured encoder pulses with TMR0 as counter. But I get almost 240 counts per revolution of main shaft. Therefore, I hv to change the OPTION_REG from 28 to 21 in order to get the correct counts.
How is the quadarature encoder count? It should give 60 counts per revolution right? But how can it count 240 per revolution? What is the reason behind? Pls advice.
I never use that motor from Cytron, but I did read the tutorial from them, let me search it..... Here is it, Quadrature Encoder.
Not really sure why you get 240 instead of 60, I din check the user's manual and the product, but based on your description, I can make assumption is: 1. The encoder is giving 12 pulses per motor rotation if the gear ratio is 20. 2. The gear ratio is 80 instead of 20.
Anyway, how do you know there is 240 in the timer0?
I have a motor speed controller project using Cytron SPG-E30-30k DC Gear Motor with Hall Effect Quadrature Encoder.
How can I calculate the actual rpm of the motor using PIC 18f4550 and display the rpm value at lcd?
From the motor spec, I know that the resolution of the motor is 90 counts per main shaft revolution for 1:30 geared motor
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.
I used TMR0 as counter. Initially set OPTION_REG = 0x28. Tested in Proteus get a good result. That means that 1 pulse captured will increment 1 on TMR0. Total amount pulses captured in 1 second is equal to the value in TMR0. But when tested actual motor spg30-20k, the main shaft turn faster. Some isolation were done and when I tried to change OPTION_REG = 0x21, the motor shaft speed match with the display speed.
Re-tested OPTION_REG = 0x21 on Proteus, it displayed 1/4 of the motor speed. So, I wonder the accuracy of the ratio given in the motor user manual.
Hi Hitayah, I am using TMR0 as counter, RA4 as input port of the encoder pulse. Then, used isr() to make 1 sec interrupt to capture the encoder pulse in every 1 sec. Can refer to the website below to hv a clear pic. http://electricallabs.lakeheadu.ca/proj ... /speed.pdf But I am not sure the compatibility of PIC18F4550. Can compare the data sheet.
i understand the idea that u use the timer0.. but i'm do not understand the programming.. can u explain to me how to do simple programming to move the motor to 0,90,180,360 degree first.. and display the degree at lcd..
Hi Hidayah, Its quite hard to control the motor angle using encoder DC motor compared to servo motor. Maybe you can try to do a simple program to count the encoder pulse first. If still hard, you need to control the motor movement first: forward, reverse, stop and control the PWM.
Cytron Technologies invest time and resources providing tutorial, training and support for STEM education and maker movement. We need your support by purchasing products from Cytron Technologies. Thanks. http://www.cytron.com.my
rain6271, Channel A will generates 3 pulse per channel if the motor rear shaft is rotated one round. Channel B also will generates 3 pulse per channel if the motor rear shaft is rotated one round, but this pulses are lag or lead channel A for 90 degree phase different.
Let say SPG30E-20K, 20:1 gear ratio is used. If you are using 4x quadrature encoder (which process the both channel A and channel B pulses), 12 counts at motor rear shaft, so 240 counts (12x20) per rotation for main shaft. Since you just monitor one of the channel (let say channel A), only 3 pulses at motor rear shaft you can get, that's why 60 counts (3x20) per rotation for main shaft.