In this page, we would like to talk about the problems and challenges we had to face in order to make our project work:
- Motors break-down:
Unfortunately our estimation of the torque needed for our servomotors wasn't so precise, so three servomotors out of five broke during the first working test of our assembled device; after that, by replacing the broken gears in each motor and adjusting the rotation's limits and positions we were able to have a working product anyways.
- Abnormal Vibrations:
One of the first problems that appeared in our hand was the vibration of the servomotors in an abnormal way. We first thought it was because we didn't have enough power, but the problem still occured with an appropriate power source. The explanation was in fact that when an interrupt occurs, a flag disables the other interrupts. The servo library uses a timer interrupt to make the step of tension for the servo. Indeed, the command signal looks like the figure below:
So the servo library must wait for the end of the "writing" interrupt to change the signal; it means that the length of the roof is perturbed. As the command only lasts 1 ms, we can imagine that even a small variation has great effects on the movement. We solve that problem authorizing the interruption of the interrupt by setting the appropriate flag to 1. In this way, the interrupt of servo can always occur at the good time.
SREG=SREG | B10000000;             // set bit 7 to 1 (global interrupt disabled)
Then, when the user was changing the parameters we had some trouble because the interruption used simultaneously the same variables (time and delay). But we could not use NoInterrupts() because it disables all the interrupts (also for servo). So we figured to use a boolean flag disabling the reset of the interrupt of timer2 if Change_data is running. The interrupt is reset at the end of Change_data function.