The TA/ULA will ask you to run "moveMotor.py", and for each motor we will assess if the neutral value aligns with the expected output (2000 = barely closed for gripper, 1500 = horizontal elbow, vertical shoulder, forward base). The TA/ULA also may ask you to approach the end positions to verify each calibration.
You will also show that your demo code can work (may take some small tweaks). This can be found in the "MeArm: DemoCode" and should show your arm travels along x, y, z axes + box shape smoothly.
See rubric on the left for details.
p.s. Zero.py helps you fine tune the calibration degrees and saves to a file (mearm_config.json) called upon by Controller.py. This replaces the spreadsheet of manual values from previous years. For fun, you should try to get this working too - it will prepare you well for Design Competition. It is NOT graded for this unit's demo.
Software for the Adafruit Motor Hat library was in stalled in the Motor Lab and you will not need to repeat it.
But you need to activate your python environment.
cd ~/pythonBME210
source env/bin/activate
And you will also need to access the meArm code from my repository: https://github.com/uutzinger/meArmPi which was installed during the Motorlab.
That folder contains
moveMotor.py (moves a single motor to given position)
Zero.py (creates the calibration file)
Controller.py (operates me arm with Gamepad or keyboard)
We have two kinds of Motor Hats. They differ by the address of the Motor Hat which is either 0x6F or 0x60. You can change the address the same way you changed it for the air sensors in our previous lab. The MotorHat requires 5V (better is 5.2V) from an additional power supply to the two input screw in terminals in order to work. You should set the max current to 500mA.
We will first start with moveMotor.py.
Please make sure that you do not drive the motors to the end positions so that they will not collide with the mechanical stops. It is best to test one motor at a time and to adjust the positions until you determined the maximum and minimum for each motor. The pulse signal should be at 50Hz (20mS) and 0.5ms pulse with is full counter clockwise, 1.5ms center location and 2.5ms full clockwise
PLEASE BE CAREFUL WHEN MOTORS ARE PLUGGED INTO THE MOTORHAT. YOU CAN NO LONGER FORCE THE ARM TO MOVE BY HAND OTHERWISE YOU STRIP THE GEARS.
WHEN RUNNING moveMotor.py:
THE END POSITIONS DIFFER FOR EACH SETUP. IF YOUR MOTOR HITS THE END POSITIONS (ARM HITTING WOOD INSIDE YOUR meARM) YOU MIGHT BREAK THE MOTOR GEARS OR YOU MIGHT BREAK YOUR ARM OR YOU HEAT UP THE MOTOR.
WHEN YOU SET A POSITION FOR THE FIRST TIME, YOU SHOULD START AT THE MIDDLE (e.g. 1500)
THEN SLOWLY INCREASE OR DECREASE THE POSITION UNTIL THE MOTOR NO LONGER CREATES A VISIBLE CHANGE.
MINIMUM POSITION IS 500
MAXIMUM POSITION IS 2500
FOR RARE OCCASIONS YOU CAN TRY 400 and 2600
IF YOUR POWER SUPPLY INDICATES MAXIMUM CURRENT, OR THE VOLTAGE DROPS TO LESS THAN 4.9V, YOU HAVE SET A POSITION YOUR MOTOR CAN NOT PHYSICALLY REACH AND YOU NEED TO REMEDI THE ISSUE OTHERWISE YOUR MOTOR OVERHEATS.
Using moveMotor.py you will gently move the motors and test if all motors work.
First test that the screws on joints are not OVER TIGHTENED. Excessive friction will block the motors. Thigthen screws then untighten by half a turn.
Ask TA/ULAs for motor cable extension if you need them.
Start with the base motor. Its the easiest to adjust and orient. The base motor is plugged into motor connector "0". Move the motor to 1500 by changing the code so that it selects motor 0 and provides 1500 (1.5ms) pulses to the motor.
You shall not put excessive force onto the base motors. If the motor is based on plastic gears, you can easily strip them.
Once the arm has settled it should point forward meaning the arm should be more or less aligned with bottom plate. Foreward is where the cut out in the bottom plate is.
If it does not point forward, loosen the axle screw, pull the meArm off the base plate and orient it forward. Then push it back on BUT YOU NEED TO HOLD ON TO THE BASE MOTOR OTHERWISE YOU PUSH THE SCREWS OUT.
If you used the wrong screws for the axle, the gears might not turn properly or the meArm will easily come off the axle and you will need to re-calibrate frequently.
Shoulder motor is attached to "1". This motor can not move as far as your base motor. (CHECK INSTRUCTIONS IN RED ABOVE)
Disconnect any other motors. This will make it easier.
Start with middle position (1500). This should move the first arm segment close to 90 degrees up from horizontal.
If you are off by more than 45 degrees you will need to loosen the axle screw, pop the plastic anchor off the axle, adjust the motor to 1500 and move the shoulder to the intended vertical position and pop the anchor back on to the axle.
It is difficult to loosen the axle screw and you might need a quality screw driver from our central toolbox for that.
Elbow is attached to '14'. Again start with 1500 and gently decrease the number.
At about 2000 the wood piece attached to the motor should be close to the bottom of meArm.
If you are off by more than 45 degrees you will need to disassemble the meArm so you can pop off the plastic anchor from the motor. This is best accomplished by removing the two screws holding the meArm base rectangular shape together.
WHEN YOU POP OFF the plastic anchor, the WOOD PIECE that is attached to it IS FRAGILE around the axle and you need to limit your forces.
Move the motor to 2000. Align the plastic anchor so that the wood piece is close to touching the bottom of the meArm. Once aligned, power off the motor and reassemble.
The gripper should be closed at motor position 2000. Again start at 1500 and slowly increase the number until the gripper is closed. If you are unable to close the gripper completely, loosen to axle screw, pop off the plastic anchor, move the motor to 2000, close the gripper manually and pop it back on.
Run the Zero.py program.
Use the keys displayed on the screen to move your me arm to the requested position: Straight forward, Straight up, and forearm horizontal. Exit the program and it will save the calibration data.
You can borrow a gamepad and connect it with a USB cable to the Raspberry Pi. You should be able to manipulate the meArm with the joystick. There are instructions on what the buttons on the controller do in the text on the screen.
Once the Controller program works with keyboard or joystick you are ready to demo. Demo.py will move your meArm along a line in X or Y or Z direction. Show this to the TA/ULAs.
The demo program in the next section of the assignment attempts to move the mearm along a line horizontally, vertically and forward backward.
If you assembled the meArm correctly, the movements will be straight. Demo to the TA/ULAs and we will grade it.
Motors need to move freely when they are not energized. Do not force their movement when theyr are energized.
When gears are stripped you can hear the cracking noises when the gears pass the severed teeth.
There is a limitted number of motors. We test each motor before handing them out for stripped gears. If you believe you have stripped gears talk with TA/ULAs now as later in the semeser we will be out of motors and you need to order replacements yourself.
The motors work better at Voltage slightly higher than your USB power supply provides. If your motor is studdering you should try to power the motor hat with the laboratory power suypply at 5.4V and give it 1A.
Elbow about -80, -45, -5
Base about +45, zero, -45
Shoulder about +135, +90, +45
Gripper +90, -20, (make sure you put the correct angles from the spread sheet in radians into closeGripper and openGripper function in meArm.py)
In your version of the spreadsheet the order of the numbers needs to match my numbers. For example the number used to move the shoulder backwards is smaller and to move it forward to be parallel to the base is larger. The angles also need to match with their signs.
The middle position of the shoulder is about 1500 +/- 300 and then the first arm element should point upwards. If that is not the case check above if you need to pop off the plastic piece and readjust the meArm. With too much force the wood will brake.
At 1500 +/- 200 for the baseplate motor the arm should point forward. I have seen several base motors where the wrong screw was used to attach the handle to the axle. If you have metal motor you need machined screws.
I have also seen plastic pieces that did not fit onto the motor axle. Unfortunately there are two sizes and two colors of plastic pieces as well as plastic pieces for the larger motors. Most of them will be the correct ones but they should snap onto the motor axle. It is possible to remove the plastic piece and the axle screw without needing to disassemble the meArm.
At approx 1500+/-300 for the elbow the second element of the arm should be horizontal. Redajusting the elbow is difficult because your can not easily reach the axle screw. You would need to remove the plate to which the motor is attached and the screw that attaches the first wood element on the motor to the 4 bar linkage. Its best to ask instructor how to do that.
Please make sure your meArm moves freely when no motors are plugged in. Do not over tighten the screws.
Work on one motor at a time. Do not plug in all the motors at once for calibration.
Make sure motors are not pushing against a solid object otherwise they burn out.
The claw is difficult to calibrate. When viewing like in the image above, the angle of the motor axle is measured in respect to the horizontal. When Its closed, the angle is negative and the axle connector is pointing upwards and when its open its positive and the axle connector points downwards.
The red values in the spreadsheet in the first column should be close to 132 or -132. I would accept 150 and 110 but you might want to remeasure the angles if they are too far off. The other red value will be different for every meArm.
meArm.py needs to be updated to include your calibration values. It is for example the sweepMinBase and sweepMaxBase that you enter into the meArm.py file. Also you need to enter the angles in radians which are the other values in red in the table.
The values you measure for closed and open gripper need to be also entered. The function closeGripper(self): uses self.pwm.setPWM(self.gripper, 0, self.angle2pwm("gripper", 0.0)) where 0.0 is the angle for closed in radians. That is not correct and needs to be changed to -0.79 or similar as taken from the spreadsheet for the angle in radians for a closed gripper. The same applies for openGripper.