Monitor DC motor velocity using arduino and simulink

3 次查看(过去 30 天)
I'm trying to measure the rotation of a DC Motor connected to an arduino mega 2560 by means of an encoder wheel and an optointerrupter. I devised a model based on a Simulink example called arduino_external_interrupt. The idea was to connect the optointerrupter out port to an external interrupter pin in the arduino board, and get the number of changes in the pulsating signal (i.e., 1 to 0 or 0 to 1, from which I expect to estimate the rotation angle). I'm using an L293D H bridge to control de motor. I also include part of the model created for more details. The problem I'm having is that when I run the model on the arduino board in external mode, the signal has weird jumps, that is to say the increments in the pulse counting are not 1, even in some times it is as high as 10 from one cycle to other. But when I run the model as a normal simulink model, the signal appears consistent, but the number of counts remains unaffected by the size of the duty cicle of the PWM Modulation. I seems otherwise ok, though. Why does this happen? Is there a better way to control the motion of a DC motor using an L293D H bridge, an encoder wheel and an optointerrupter? Thanks in advance
Captura de Pantalla 2019-10-06 a la(s) 2.00.41 p. m..png
The electronics I'm trying to control are somewhat like this, but the connections may vary from this picture to the conections used in the simulink model. The optointerrupters and encoder wheels are used to measure the rotation of the wheels, but are not shown. They are connected to the external hardware interrupter pins of the arduino mega 2560 board.

回答(1 个)

Nadir Altinbas
Nadir Altinbas 2019-10-25
single mode relay module connection for DC Motor usege should to persist problem

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by