Medida de velocidad de un motor con LPC2129

cancel
Showing results for 
Search instead for 
Did you mean: 

Medida de velocidad de un motor con LPC2129

Jump to solution
276 Views
alessandromelin
Contributor II

Hola.

Estoy desarrollando un proyecto en Keil, usando la placa LPC2129, para medir la velocidad de dos motores cuyos encoders tienen dos canales y 7 pulsos por revolución. 

La única forma que se me ha ocurrido ha sido usar las interrupciones externas (EINT) para cada canal y detectar los flancos de subida y bajada.

Si existe alguna forma mas optimizada y fácil de implementar, que alguien me ayude, por favor.

Muchas gracias de antemano.

Un saludo

1 Solution
190 Views
nxf51211
NXP Employee
NXP Employee

Hi Alessandro,

Knowing that your encoder has an output of two channels, it is very likely that a comparison of the phases between the two signals can tell you the direction of your motor rotation.

Please check the following link where it explains this: https://www.rs-online.com/designspark/quadrature-encoder-basics-part-1-theory. It is important that you also check the specifications of the encoder you are using just to be sure that it will be able to detect speed direction.

If the previous option is not possible, another thing you could try would be that you use ADC to detect the voltage polarity that is controlling the motor (I'm assuming that you are using two voltage inputs to set the direction of the motor with an H-Bridge driver).

Best Regards,

Ricardo Delsordo

View solution in original post

4 Replies
190 Views
nxf51211
NXP Employee
NXP Employee

Hi, 

You can try one of the following options for the reading of the frequencies of your motors:

  1. Use the Counter operations from your LPC2129's Timers so you can calculate the frequencies from the cycles counted during the interruptions caused by the edges of your signals. In the following link there is an example on how to configure an Input Capture for an LPC4337 (the implementation should be similar for your LPC):    https://community.nxp.com/thread/422201.
  2. Another approach could be the implementation of external Frequency-to-Voltage Converters that could be connected to your ADC channels. Depending on the converters you use, you should receive a voltage that is proportional to the frequency delivered by each channel of your motors's encoders.

Best Regards,

Ricardo Delsordo.

190 Views
alessandromelin
Contributor II

Hi, thank you for your quick answer.

I have alredy tried the first option, getting the engine speed quite well, but the problem is that there is not way to get the speed direction, because I need it too, or I do not know how to get the direcction using the Capture function.

Talking about the converter, I discard that option, because we are trying to avoid the most hardware as is possible, but thank you for the idea.

Returning to first, if you know a way to get the direction of the speed using capture it will be very helpful.

Thanks for all,

Alessandro

0 Kudos
191 Views
nxf51211
NXP Employee
NXP Employee

Hi Alessandro,

Knowing that your encoder has an output of two channels, it is very likely that a comparison of the phases between the two signals can tell you the direction of your motor rotation.

Please check the following link where it explains this: https://www.rs-online.com/designspark/quadrature-encoder-basics-part-1-theory. It is important that you also check the specifications of the encoder you are using just to be sure that it will be able to detect speed direction.

If the previous option is not possible, another thing you could try would be that you use ADC to detect the voltage polarity that is controlling the motor (I'm assuming that you are using two voltage inputs to set the direction of the motor with an H-Bridge driver).

Best Regards,

Ricardo Delsordo

View solution in original post

190 Views
alessandromelin
Contributor II

Hello Ricardo.

Yes, they are quadrature encoders, but the problem was that I could not measure the level of the other channel using just EINTs.

Now I am using EINTs (to detect rising or falling edges) and GPIOs (to measure the level of the other channel and know the direction). With this solution I could solve the problem.

Thank you very much for the help.

BR,

Alessandro.

0 Kudos