#11: Arduino Code
The open source robot that I laser cutted, also provides with Arduino code; http://www.meped.io/sites/default/files/2017-06/mePed_IR_Starter_Program_0.ino but as you can see they use an IR Remote which in my case is not applicable, so before I could start testing my robot and his servos I needed to transform this code.
Also they do not use a Servo Shield like I use, they connect the servos directly into the Arduino board and then use the Servo library, provided by Arduino. In my case this is a huge difference, they can just say Servo.attach(PIN) to connect them and then use myServo.write(ANGLE) to set the angle of the servo. In my case I need to set the PWM of the servos and then give the servo a pulse width to define the angle.
After getting to know the code, understanding what it does and modifying it to my application I started testing it on my robot. I quickly noticed that the robot was not doing what I wanted and what I had asked of him.
Soon I had found the problem, it was not within the code or the modification of the code but it was with the hard ware. A few screws and bolts had not hold the position they needed, they just fell out because of too much movement. So my dad and I decided to replace all the little screws with a bit bigger ones, soon there was another problem again a hard ware one. Some of the servo motors where not moving a bit, which was strange. And others did do the movement but not to the right angles. The problem here was that the servo's where not calibrated right, I had done this in the beginning but apparently a few where not done right. Another servo was calibrated right but there was a fault of the fabric, he was just stuck and you needed to push very hard till he moved. So that one we switched out with one of my reserves.

While we calibrated the servo's again, we tested each one of them directly after montaging them again, so that when there was another wrong calibration we could fix it right away.
Here is the test code for the servo's;

So after calibrating the servo's right this time and modifying the screws and bolts, I tested my transformed Arduino code again. When I ask him things like wave, bow, dance he performs it almost perfect. But as soon as I ask him to walk he does the movements but the code needs some tuning to find the right movement. Also because I levelled my robot the point of gravity has changed, resulting in the robot falling.








Opmerkingen