Industrial robots have been around for a long time. In many cases, industrial robots are not the humanoid-looking robots we imagine when thinking of robots. Instead, many are robot claws that can do a wide variety of tasks: surgery, welding, assembly, painting, and more. In this chapter, you are going to build a robotic claw pick up a red ball that comes with the kit, to better understand how these claws work and operate. In the following screenshot, you can see what you will be building:
In this chapter, we will break down the build and program, as follows:
For the building of the robot, all you will need is the Robot Inventor Kit. For programming, you will need the LEGO MINDSTORMS app/software.
Access to the code can be found here: https://github.com/PacktPublishing/Smart-Robotics-with-LEGO-MINDSTORMS-Robot-Inventor/blob/main/Chapter%203%20Claw%20Code.lms.
If you would like a more detailed photo-by-photo build process of the robot, please head here: https://bit.ly/2NkkypN
Before we build the claw, let's explore the strategy being used for these claws. There are many LEGO robotic claws to be found online. This one tries to do some things differently, as follows:
We are going to start this build using a large teal 11x19 base plate as the main building foundation for this robotic claw. Ensuring that we have a solid foundation is key, and the teal 11x19 base plate shown in the following screenshot is perfect for building on top of when designing an claw:
Let's build the robotic claw now, starting with the frame for the Intelligent Hub!
One part of this kit that is different from previous Mindstorms kits is that the wires for all sensors and motors are set to a specific length. In previous kits, we could attach various cable sizes as we built our bigger structures.
Because all wires are a set length that we cannot adjust, we must consider this creative constraint in the build design. With that being said, we need to build a frame to place the Intelligent Hub at a certain height to allow the motors to be able to reach the Intelligent Hub while in motion.
You will need the following pieces:
The required pieces are shown in the following image:
Start by adding the two black 11x15 open frames to the side of the teal base plate. Use the gray connector pins to hold them in place by inserting them through the pinholes into the sides of the teal base plate.
Using two black connector pins on each side, secure the black 7x11 plate to the top of the black 11x15 open frames, as illustrated in the following image:
Using two large open frames and one medium-sized open frame, we will assemble a standing desk for the Intelligent Hub. We will attach the Intelligent Hub to the top, where it will sit one row off the back of the base plate. The final step of this part of the build is to add the Intelligent Hub to the top of the frame.
This section sets the foundation to the entire robotic claw. You will start by building a strong base for the claw to establish the motor that will allow the claw to move right and left.
You will need the following pieces:
Start by adding four black connector pins to the four corners of the bottom side of the Intelligent Hub, as illustrated in the following image:
Go ahead and connect the Intelligent Hub to the top of the base you just assembled. It should lock into the 7x11 open frame, as illustrated in the following image:
Using one motor, two gray perpendicular connectors, and two pins, we can secure the motor to the base, as illustrated in the following image:
Make sure your motor is properly secured to the base. To do this, add the gray connector pins to the sides of the motor, along with the black connector pins in the middle pinhole of the motor on both ends, as illustrated in the following image:
When you connect the motor, we will place it three rows back from the front of the base plate. Place the black pins on the underside of the motor to really secure it to the base, as illustrated in the following image:
Next, it is time to build a solid frame for the motor and turntable, for the claw to properly move. You will craft a table using the following pieces:
The required pieces are shown in the following image:
To begin this part of the build process, start by sliding the 3x3 teal Technic piece in the middle of the turntable, on the gray side. Ensure the pinholes align with the gray pinholes of the turntable. Secure the teal 3x3 piece to the turntable using two blue connector pins on either side, as illustrated in the following image:
Locate the following parts to go along with this turntable piece:
The next screenshot provides a basic layout on how to attach all these pieces together, with a step-by-step description to follow:
The following steps align with the preceding image, starting from the top and working down:
This is what it should look like on the underside, to ensure you have things properly placed. The turntable should spin freely:
If all is good, then find four black connector pins and add them to the black beams in the pinholes one hole from the end
Now that this piece is assembled, we will attach this to another open frame.
You will need the following pieces:
Add two black connector pins on both 11L sides of the open frame, as illustrated in the following image:
Next, you will stack the turntable piece on top of this open frame, as illustrated in the following image:
After these two build pieces are stacked, then go ahead and use the 2x4 L beams and connect the turntable piece to the open frame, as illustrated in the following image:
Go ahead and find the following pieces:
The required pieces are shown in the following image:
Insert the white connector piece to the end of one side of the yellow axle. Insert the yellow axle through the middle of the turntable, securing it to the middle pinhole of the motor that is placed on the main teal base plate, as illustrated in the following image:
The following image shows the elements you should now have left:
Using your 5x7 open frames, gray connector pins, and black connector pins, you are going to add these parts to the sides of the turntable piece to secure and mount it to the main base plate, as illustrated in the following image:
The next step is to lock the motor to the turntable to allow the entire claw to move right and left. These parts will connect the top of the claw to the turntable.
You will need the following pieces:
To build these parts you will connect the T pieces to each of the black 7L beams, using two blue connector pins. Both parts will be built with the T piece being on the outside of the black beam. You will build two of these parts with the T teal piece on the outside, as illustrated in the following image:
You will then add each of these parts to either side of the turntable, locking them into place. This is illustrated in the following image:
Find the 12L axle and two gray bushings. These are illustrated in the following image:
Slide the 12L axle through the middle pinhole of the T pieces and through the white pin connector in the middle of the turntable. Secure the axle using the two gray bush stops on the ends of the axle, as illustrated in the following image:
The final step in this build part is to now attach the final two teal T Technic pieces to the end of the black beams that are now on the turntable. Use two black connector pins on each one to attach, as illustrated in the following image:
Your next step in this build is to build up the frame for the other motors, for the claw to be built upon.
To get started, you will need the following pieces:
To begin, locate two white panels, and on each of them add two black connector pins, as illustrated in the following image:
Using the black connector pins, attach the white panels to the teal T parts that are currently on the turntable, as illustrated in the following image:
This is how the build will look from the side now:
With the build facing you, where the turntable is to the front and the Intelligent Hub is to the back, add a black connector pin and a blue axle connector pin to both white panels, as illustrated in the following image:
The last step to complete on this part of the build is to add two more panels, to complete the main structure of the claw. Note the parts to secure the two panels, using the L-shaped Technic pieces in the following image. One white panel will use the four teal 3x5 L beams, and the other will use the four black 3x5 L beams.
This is how it would look from the front after adding the panels:
This is how it would look from the other side of the panel:
Here is how the build should look at this point in time:
Let's finish up this part with the final pieces. You will need the following pieces:
Begin by adding four black connector pins to the corners of the white panels on the top of the build, as illustrated in the following image:
Using the two blue connector pins, insert them in two corners of one of the open frames, as illustrated in the following image:
Stack the three open frames together, using six of the black connector pins. Placement is not essential, but you just want to make sure they are securely held together. The last two black connector pins will be added to the top, between the two blue connector pins, as illustrated in the following image:
Now that we have set up the motor frame to move left and right, let's see how to set it up to move up and down.
You are now ready to add the two motors that will control the claw's upward and downward movements.
You will need the following parts:
Grab two motors and connect them with a 3L axle, as illustrated in the following image:
Add them on top of the four connector pins, on top of the three open frames, as illustrated in the following image:
Using the two teal 5L beams and four of the black connector pins, secure the motors together, as illustrated in the following image:
At this point, you need to fold up and hide the wires. We will close off the wire and secure these 1x5 beams using one 3x3 teal Technic piece and two black connector pins, as illustrated in the following image:
You can now plug these motors into ports B and F. If you have not already done so, you can also add the motor at the bottom of the base to port C. After you have connected the motors, let's keep building from the motors. Next, you will need to add a gray 3L axle to the middle of each of these motors. After that, add a gray perpendicular connector pin to each motor. The result is shown in the following image:
This would be a great time before you continue building to run a test code, to ensure your claw can move from right to left and to tweak any adjustments that need to be made. Write a simple program moving the motor just to make sure it moves.
You are now down to your final motor that will control the claw being able to open and close.
For this section of the build, you will need the following parts:
Start this build part by adding two black connector pins and the gray 3L axle to the pin holes on the motor, as illustrated in the following image:
Attach the teal 5L beam to the connector pins that you just added to the motor in the previous step, as illustrated in the following image:
You are going to continue to build out the claw on this motor. To do so, you will need the following parts:
Start by adding the two black connector pins to the ends of the 5L beam, as illustrated in the following image:
Using the first pinhole of the black 45-degree beams, add one pin to each end. On the 45-degree beam that is on your right side, insert the 3L axle in the second pinhole and secure it using the black pin and axle connector piece, as illustrated in the following image:
Now, locate the following parts:
You will connect the axle and pin connector to the motor using a 1x2 beam, as illustrated in the following mage:
Take the second tan axle pin connector and add it to the other 45-degree beam using the axle hole, as illustrated in the following image:
Additionally, you will hold everything in place while allowing movement of the claws by layering on the H-Shape Technic element. Again, check the placement of the connector pins to allow the claw to move properly. The result should look like this:
Let's get this claw all put together. You will need these pieces next:
The required pieces are shown in the following image:
Insert a brown 3L axle through the end of each of the 45-degree beams in the axle hole. Be sure the 45-degree beams are bent to face inward as these are part of your claw mechanism.
Insert a blue axle pin connector into the end of the 45-degree beams that are already attached to the motors.
Connect the 45-degree beams that have the brown 3L axle to the 45-degree beams that are attached to the motors. You will start to see the formation of a claw. The next image provides a visual of what your build will look like after this series of steps:
Find two more 45-degree black beams and attach them to the underside, where the brown 3L axle is still showing. Connect by using the axle hole of the 45-degree beams, as illustrated in the following image:
Let's keep building this claw to ensure it can grip the red ball that comes with the kit. You will need the following pieces:
To start this part of the claw, begin by attaching a 45-degree beam to the right side of the claw. Use the black connector pin and the blue axle pin connector to secure it into place. Note how the beam will stick out from the inside. The black connector pin is inserted in the pinhole to the right of the brown axle. The blue connector pin is used to the right of the black connector pin, as illustrated in the following image:
Let's move to the left side of the claw. For this side, you will need the following parts:
The required parts are shown in the following image:
Start by attaching the 3L beam to the 45-degree beam. Use the dark-gray connector pin on the end of the 45-degree beam using the axle hole. Add the 1L side of the blue connector pin to the pinhole next to the axle hole, as illustrated in the following image:
This part will connect to the underside of the left side of the claw, as illustrated in the following image:
Secure all the parts of the claw together using the yellow 5L axle pieces. Insert each axle onto the end of the claw, as illustrated in the following image:
The last part to this claw is to attach the two black rubber axle parts to the ends. These parts help with gripping the red ball upon pickup and are shown in the following image:
When the robot claw rises to its full extent and brings the ball straight up, the claw cannot contain the red ball without the rubber attachments. Using the rubber elements and an extra holding mechanism that does not get in the way of the claw moving, we can finish up the claw to better stabilize the red ball while in motion. Note that you can adjust and modify the claw to your own needs if you want to grab other items besides the red ball.
Keep in mind that you can create the claw to your liking at this point in time. This claw was designed to pick up and move the red ball in the kit. You might need to adjust the claw if you wanted to grab different items or objects.
The final step of the claw is to attach this claw mechanism to the rest of the robot body. You will need the following parts:
In the following image, you will see what the build looks like on the right side, with the elements needed on the left side:
You will build two of these parts so that you have one for each side of the claw motor, to be attached to the main base of the robot.
Start with the white 13L beam. Insert two blue connector pins in pinholes 3 and 7, as illustrated in the following image:
Attach the teal and black 5L beams to the blue connector pins. Add two black connector pins to the black beam, as illustrated in the following image:
Next, add the bent 9L beam, with the bent piece facing up. Add the dark-gray connector pin into the axle hole of the bent beam and the blue connector pin to the base of the bent part of the beam. Finally, slide the black 3L beam over these pins, as illustrated in the following image:
Repeat this process for the second piece, and just be sure that both pieces have the white beam on the outside of the build, as illustrated in the following image:
Once you have checked to make sure they are built properly, then go ahead and connect to the claw on the back of the motor. Just to double-check, you should have the following two parts built at this point in time, as seen in the next image:
The final step of this build is to add the claw attachment to the main frame. Connect the claw to the motors at the top of the robot claw on the base. You can adjust the claw on the 1x13 Technic beam, but I have found this setup to be most effective when the motor is not slipping and is moving properly. The result is shown in the following image:
A key detail here is the wire of the claw motor. It needs to be run between the two B and F motors to reach the Intelligent Hub properly, to allow for proper movement. You will connect the claw motor to port D. Check your wires by moving the claw to the right and left, checking for snags with the wire.
Here is what the robotic claw should look like from the left when completely assembled:
This is how it should look from the front:
This is how it should look from behind:
And this is how it should look from the right:
Now that your claw is complete, it is time to move into the coding to bring the robot claw into use.
For this build, we are going to focus on the remote app coding only. This will be a program that will allow you to control the robot using the remote-control feature of the app to move the claw right, left, up, and down, and to open and close the claw.
Overall, this program is fairly simple to develop and is created to be easily adaptable for you to remix to meet your needs. Use this sample code to make sure everything works, and then begin to tweak the code to make it work to your needs. Make sure you have the proper ports plugged in, and then move into the code.
If you have not plugged in your motors yet, then let's get them plugged in to the proper ports. You will plug the motor that moves the claw to the right and left to motor port C. The motor that controls the opening and closing of the claw will plug into port D. The two motors that control the arm of the claw to go up and down will use ports B and F. Once you have the motors plugged in, then double-check that the motors are plugged in correctly.
You can check that your motors are properly plugged in by checking the Port View in the software, as seen in the following screenshot:
It is time to write the program so that you can control the claw.
To get started with this program, let's go ahead with the following steps to make the robot come to life:
This is what you will need for your controller layout:
Be sure to select the teal check to save your design, as shown in the bottom-right corner of the following screenshot:
You can also move widgets around the grid to place them where you would like for your remote controller. Each person has preferences, so adjust to your needs. Figure 3.73 shows the controller layout I prefer to give an example of what the controls can look like on the remote control.
Test your code and make sure the claw moves to your liking. You might need to tweak the numbers a bit to make it work the way you want. I prefer a code layout that mimics the controls, as you can see in the following screenshot:
The speed is low, and we can duplicate the code and change the direction of the motor when the slider is high compared to low. The code blocks in the following screenshot showcase the low speed of 5% to move the claw:
In the end, your code will look something like this:
And that is it! You did it. You built a nice-looking and working robot claw. Now comes the fun part, which is to remix the claw to make it your own. Let's look at some ideas.
This is the part I love, and I hope you do too. This robot is just the beginning of the fun. It is now time for you to take this framework of the robot build and sample code, to make it unique to your talents and imagination.
Here are a couple of ideas to consider applying to this robot:
In summary, we explored the concept of industrial robots by building a robotic claw that can pick up a red ball and transport it to another location. Industry continues to rely on robotics to achieve production goals. Additionally, we explored how to have several motors working together to create an actual working claw. This is a classic build that must be done with any new robotic kit!
Let's now head to the next chapter and explore a whole different world of robotics by building a guitar!
18.223.107.149