
A basic understanding of angle encoders is necessary to understand this code. You can find this here: http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/keyes-ky-040-arduino-rotary-encoder-user-manual/
The basic idea is that there are two switches within the angle encoder each with different phases and the code identifies where the switches are and determines which direction the encoder is moving by the change in the two switches, Then, based on the desired input, the code determines the difference in the current angle and the desired angle and tells the motor to move in the correct direction and how far. The code has various outputs so you can observe in real time which direction and what angle the motor is at.
The MatLab code appears to only measure the angle encoder and does not control the motors as is the case with the simulink code. However, I have been unsuccessful thus far in connecting the arduino to simulink. I have been able to connect it to MatLab however and hopefully there are only minor discrepancies in the process.
Based on what Jon has left for me, it should be as simple as connecting the arduino to a laptop with the code, entering a desired angle, and running the program. I aim to test this with a small motor this week.
Once this is complete I can move onto the larger motors for VIPER. However, there have been changes to the control system that I had developed in the summer of 2015 and I will need to relearn how to use it. Once I can confidently power the motors I will attempt to use the motor controlling program with them.
Jon's Elevation Angle Automation Blog
ReplyDeletehttp://sienaviper2016.blogspot.com/