Monitor DC motor velocity using arduino and simulink
7 views (last 30 days)
Show older comments
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/244922/Captura%20de%20Pantalla%202019-10-06%20a%20la(s)%202.00.41%20p.%20m..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.
0 Comments
Answers (1)
Nadir Altinbas
on 25 Oct 2019
single mode relay module connection for DC Motor usege should to persist problem
0 Comments
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!