Monday 23 September 2013

Updating the Code and a progress video

A number of major changes have been made in the code. These have been necessary in order to fix the issue of interference. Shielded cable did nothing, neither did wire management so with the code updates, routines have been altered to fix interference.

The first fix was quite simple. Since the relays were the source of interference, when one axis moved, its caused false signals to be fed to the other photo interrupter. As a result the movement of one axis, would slightly change the coordinate of the other axis. Thus the update routine was given the command to not update whilst the other axis was running.

The second fix was more complex. I myself did not write this part but got help from others at the workshop. After probing the photo interrupter signal on an oscilloscope, we were able to see the signal wave and see how often it peaked abruptly. This was approximately 30 milliseconds, hence a debounce routine was run every 30 milliseconds in order to essentially reverse whatever abrupt false signal was read.

The code below reflects these changes which occurred in the first tab of my major code. There were other very tiny changes for example in the values of the servo for the up and down routines but I won't include these.

Finally the long awaited video can be seen below. From it the difference from V1 to V2 is clear, particularly that this one actually works. Still there is much to fix and add. I'm thinking about a PCB to counter messy circuit boards and interference, buttons to make for a less repetitive and more efficient design, and a new mechanism for the Z axis that drops straight down rather than side on.