Programming Encoders in MATLAB with motorsrv.pde

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
motorman12
 
Posts: 18
Joined: Mon Oct 31, 2011 4:03 pm

Programming Encoders in MATLAB with motorsrv.pde

Post by motorman12 »

Hello,

So right now I have a very effective rig built that controls two stepper motors. I have a GUI that allows me to input the number of degrees I want it to move, and then it converts that number to move the appropriate amount of steps (full steps only). Obviously this isn't 100% accurate because it does not account for missed steps and such, and herein lies my issue.

I was wondering if anyone had any experience programming encoders in MATLAB using the motorsrv.pde arduino code (included in the MATLAB arduino bundle off their website). I've read the rotary encoder playground guide which sheds some light on the scenario but I am still not quite sure how to go about it. I am using US digital E3 encoders with an index pin included. I have set up my encoders so that I can easily switch the cords to any of the Arduino pins so that I could easily move things around and test out different assemblies. I have one Arduino UNO with an attached motor shield, and I'd be reading information from 2 encoders. I'd like to add some buttons to my GUI that "begin" the encoder count and store the index position. Then I'd either like a read-out that displays the real time encoder information (as the counter increases), or just a button to press after everything is done moving that would output the position data. I know how to program buttons and all of that, but I have no idea how to setup the counters and such for the encoders.

Ideally I'd like to include a button "return to index position" that would automatically used the stored index position to reset everything back to the initial position. Does this sound like something that would be possible?

If nobody is very familiar I understand, I'll just have a lot more research to do to get this project at 100% effectiveness :P.

I can provide any information that is necessary to make assessing my situation easier, so let me know if there is anything more I need to provide.

Thanks for any help you can offer me,
motorman12

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”