Monday 26 November 2012

Show: LEGO Tire Flipper (video)

Here's something I did a few years ago in school. We were put into a group that had to research (patents, literature), design, build, and program a robot using a LEGO Mindstorms RCX kit that would grab tires in one orientation and then stack them in another orientation. My job in the group was to design, build, and program the robot.




The robot had to grab a tire (varying sizes) standing up from a certain height and then reorient it and place stack it laying flat at another height.


We were limited to using what was included in the LEGO Mindstorms RCX kit, which was a bunch of standard LEGO pieces, 2 motors, 2 touch sensors, a light sensor, and the RCX microcontroller. This was a challenge as we had 2 motors to perform 3 different movements (grabbing the tire, reorienting it, and changing heights)

Here is a sketch of the design I came up with.


The design used one motor to controlling the claw to grab the tires, and another motor to reorient the tire and to change height. The robot then had 2 touch sensors to know when to grab and release the tires.

For the programming, I used NQC (Not Quite C) which is a programming language that is similar to C that is used for the RCX microcontroller. The programming was very basic, moving the arm until it hits a touch sensor, where it then opens or closes the claw depending on which sensor is touched.

Code:

task main()
{
SetSensor(SENSOR_1,SENSOR_TOUCH);
SetSensor(SENSOR_3,SENSOR_TOUCH);
/* Sets the sensor in slot 1 and 3 to be touch sensors */
repeat (2)
/* Repeats the program twice to pick up two tires */
{
/* Robot starts off at the output conveyor */
  OnRev(OUT_A);
  until (SENSOR_1 == 1);
  Off(OUT_A);
/* Arm driven by motor A is raised until it reaches its vertical
position at the input conveyor and activates the touch sensor in slot 1 */
  Wait (100);
  OnFwd(OUT_C);
/* Motor powering the claw is activated, clamping onto the wheel */
  Wait (200);
  OnFwd(OUT_A);
  until (SENSOR_3 == 1);
  Off(OUT_A);
/* Motor A is then activated, lowering the arm back to its horizontal position
and fliping the claw to the output conveyor */
  OnRev (OUT_C);
  Wait (100);
  Off(OUT_C);
  Wait (100);
/* Motor C is then activated, opening the claw and releasing the tire */
}
PlaySound (SOUND_DOUBLE_BEEP);
/* Plays a sound to inform that the program has completed */
}

Here are more pictures of the robot:









No comments:

Post a Comment