Moving Claw Robot
This project presents the Moving Claw Robot, designed to assist immobile kids at BC Campus School with handling small items with ease. It serves a dual purpose: as a fun tool for transferring materials across the classroom or as a helper for clearing small trash bags, aiding older students who are learning to complete household chores. Students can control the robot effortlessly using an Adafruit IO dashboard, with buttons to move it forward, backward, left, and right. The integrated pulley system lets them raise and lower the claw to grab and release objects, making the robot both accessible and interactive. This project aims to combine practicality with enjoyment, enhancing the students' daily routines while fostering a sense of independence and playfulness.
Supplies
x1 Pico W
x1 Breadboard
x2 Tower Pro MG90S Micro Servo Metal Gear
x2 Continuous Rotation Micro Servo - FS90R
x3 Premium Female/Male 'Extension' Jumper Wires
x12 Premium Male/Male Jumper Wires
x1 Competition Power Power Bank Mini
2x Wheels
2x DC Motors in MicroServo shape
1x Metal Chasis
x4 M3 Nuts and Bolts
x6 M2x20 Nuts and Bolts
x6 Small Velcros
x2 Big Velcros
Tape
Lasercut Prints
3d Prints
Laser Cut and Assemble Boxes
To start this project, you'll need to laser cut three wooden boxes that will serve as the base and top for the robot. The base will sit securely on top of the red metal frame, while the top will sit on top of the base, creating a raised platform to provide ample space for the claw mechanism to grab onto a plastic bag.
Bottom/Base Box:
- Download the Design File:
- Get the file named bottom_box.ai attached below to access the box's outline.
- Understand the Design:
- The piece with the carved-out center (least amount of wood) is designed to hold the breadboard and Pico W.
- Smaller cuts around this piece are intended for wire connections, which will be added later.
Top Box:
- Download the Design File:
- Get both the files named top_box.ai and top_box(1).ai attached below to access the box's outline.
- Understand the Design
- The two prints should be aligned vertically with the prints from the top_box.ai going on the bottom and the prints from the top_box(1).ai going on the top.
- The box should be put together with the opened part of the box facing up.
Once the pieces are laser cut, assemble the box with wood glue, and double-check the fit with the red metal base before moving to the next step. On a side note, when putting together the two pieces for the top part, although wood glue could be used, because they don't stick very fast and strong, using a hot glue gun is another option.
3D Prints
- Download the STL Files: Use the attached STL files (pulley.stl and claw.stl) to print the necessary parts.
- Understand the Prints:
- The yellow parts are the claws for the robot’s design, and the gray part is to hold the servo and the claws to fit in nicely.
- The purple and semi-transparent parts make up the pulley mechanism. The purple parts are for holding up the servos and the semi-transparent parts serve as the driver pulley wheel.
- Design Features:
- Both prints include small holes that will later be used to attach servos securely with screws.
- Assembly Preview: You’ll discover how these components fit together in the upcoming steps to create a fully operational design.
Make sure the prints are clean and accurate, as precise fitting is essential for smooth functionality.
Downloads
Make the Robot
Now it’s time to assemble the robot; however, you have the liberty to do this after the two following steps. The assembly process is straightforward, but it’s essential to follow the instructions carefully.
- Attach the Continuous Servos:
- Mount the continuous servos at the ends of both sides of the red metal chasis.
- Use four M2 nuts and bolts to secure each servo firmly. Be sure to attach it as firmly as possible as if it isn't the robot will not function optimally.
- Attach the wheels and put on the wheel rubber bands.
- Screw on the provided screws on the wheels to the servos.
- Install the Supporting Wheel:
- Position the supporting wheel at the front of the robot.
- Secure it with four M3 nuts and bolts.
- Prepare the Wooden Base:
- Use the small Velcro strips to support and stabilize the wooden base part.
- Attach the base securely to the red metal frame.
Again, once assembled, double-check all screws and connections to ensure everything is tightly secured before moving forward. If you're still stuck, check this guide.
Assemble the Pulley Mechanism
In this step, you’ll use the 3D-printed parts to assemble the pulley mechanism, ensuring it operates smoothly and integrates well with the servo.
Support Part Assembly
- Prepare the Transparent Cylinder:
- Grab the taller transparent cylinder printout.
- Attach the Purple Part:
- Place the purple printout with the protruded circle in the middle of the transparent cylinder.
- This purple part is smaller than the cylinder's hole but taller than its height. When assembled, it acts as a support, ensuring smooth rotation without obstructing the pulley roll.
- Secure the Connection:
- Attach the small purple block printout on top to hold the two parts together.
- A small gap should be visible due to the purple piece’s greater height, confirming proper assembly.
Servo Part Assembly
- Attach the Servo Arm Fitting:
- Locate the part with four small protruding rectangles designed to fit the servo arm.
- Superglue the servo arm to this fitting for enhanced stability.
- Connect Transparent Pieces:
- Take the two transparent 3D-printed parts and fit them together.
- Since the design ensures a snug fit, no glue or tape is necessary. Push the parts firmly to eliminate any gaps.
Servo Integration
- Insert the Servo:
- Use the purple 3D-printed support piece to hold the servo in place.
- Align the servo with the small hole on the left side of the support.
- Secure it using an M2 nut and bolt.
- Reinforce with Tape:
- For additional stability, tape the back of the servo to the support piece.
This completes the pulley assembly, leaving you with a functional mechanism ready to integrate into the robot. Make sure all parts are secure and test the pulley for smooth movement before proceeding to the next step.
Assemble the Claw Design
- Prepare the Gray Printout
- Take the gray 3D-printed piece. This serves as the mounting base for the claw printouts and holds the servo securely in place.
- Grab the yellow 3D-printed piece with the smaller hole, which acts as a support for the claw's movement.
- Mount the Claw Printout
- Use an M2x20 nut and bolt to attach the first claw printout (yellow) to the servo.
- Align the small holes in both printouts and secure them together.
- Ensure the connection is tight enough to hold but loose enough for the servo to move the claw freely without resistance.
- Insert the Servo
- Carefully place the servo into the gray printout.
- Ensure that the M2x20 bolt from the claw assembly goes into the servo hole as well.
- For extra stability, tape the back of the servo to the gray printout.
- Attach the Remaining Pieces
- Take the second yellow claw printout (the one with the larger hole) and mount it onto the servo arm.
- Use a servo arm to secure this piece into its correct position.
- Test the movement by rotating the servo slightly to ensure the claw opens and closes smoothly.
- Tie with a String
- Use a flexible wire strip or any sturdy string to tie the claw mechanism together.
- Wrap the string securely around the gray printout, using the holes on the sides to anchor it.
- Opt for a flexible wire strip with a rubber coating to add friction, preventing the string from slipping.
- Balance the Center of Mass
- As you tie everything, ensure the center of mass is balanced. When the claw is held dangling, it should not tilt. Adjust the string positioning if necessary to achieve this balance.
With these steps, your claw mechanism should be fully assembled and ready for integration into the robot. Test it thoroughly to confirm smooth operation.
Assemble the Pulley and Claw Mechanisms to the Robot
Now, you’ll attach the pulley mechanism and integrate it with the claw system to complete the assembly.
- Attach the Pulley Mechanism
- Position the pulley mechanism onto the top box. Ensure it is centered and stable.
- Use a hot glue gun to securely attach the pulley to the top box.
- Ensure the glue sets firmly to prevent any wobbling during operation.
- Attach the Bottom Box Lid
- Place the lid of the bottom box/base box in position and attach it to the top box.
- Use the hot glue gun again to connect the pieces. Confirm all edges are aligned and stable.
- Wrap the Pulley with Claw Mechanism Wires
- Take the wires from the claw mechanism and wrap them around the pulley system.
- Ensure the wires are taut but not overly tight to allow smooth operation of both the pulley and claw.
- Test for Stability and Functionality
- Check the stability of the 3D-printed parts after gluing. They need to be firm for the pulley system to function effectively.
- Test the pulley and claw movement together, ensuring there is no slack or hindrance.
With these steps, your pulley system and claw mechanism should be fully attached and operational, ready to interact with the rest of the robot's functionality.
Set Up Your Adafruit IO Dashboard
To control the robot, you’ll create an Adafruit IO dashboard with momentary buttons. Follow these steps to set it up:
1. Sign in to Adafruit IO
- Go to adafruit.com and log in to your account.
- If you don’t have an account, create one and sign in.
2. Access Your Dashboard
- Navigate to the IO section in the site header.
- Click Dashboards and then open Dashboard Settings (on the right side).
- Select Create New Block to start adding controls.
3. Create Movement Buttons
- Select Block Type: Choose Momentary Button as the block type.
- Enter Feed Name: Create a new feed called move_feed.
- Set Button Titles and Values:
- Add buttons with the titles Forward, Backward, Left, and Right.
- For each button:
- Set the Button Text and Press Value to match the title (e.g., "forward," "backward").
- Ensure the Press Value is written in lowercase to align with the code.
4. Create Pulley Buttons
- Repeat the steps to create additional momentary buttons for the pulley system:
- Feed Names: Create feeds called down_feed and up_feed.
- Button Titles: Name the buttons Pulley Reach Down and Pulley Up.
- Set the Press Value to 1 (default).
5. Create the Claw Button
- Create another momentary button for the claw mechanism:
- Feed Name: Create a feed called claw_feed.
- Button Title: Name the button Claw.
- Leave the Press Value as 1 (default).
6. Save Your Dashboard
- Once all buttons are added, save the dashboard.
- Test the buttons to ensure they are functional and correspond correctly to the feed names and press values in your code.
With this dashboard, you’ll have full control over the robot's movement, pulley, and claw systems.
Code!
To connect your robot to Wi-Fi and control it through the Adafruit IO dashboard, follow these steps:
- Locate Your Adafruit IO Credentials
- Open your Adafruit IO dashboard.
- Click the yellow key icon in the top-right corner.
- Note down your AIO_USERNAME and AIO_KEY.
- Create a settings.toml File
- On your Pico W, navigate to the CIRCUITPYTHON drive.
- Create a new file named settings.toml.
- Ensure there are no typos in the filename—it must be spelled exactly as settings.toml.
- Configure the settings.toml File
- Edit the file to include your Wi-Fi credentials and Adafruit IO settings. Copy and paste the following template, replacing the placeholders with your actual details:
- Replace PLACE THE NAME OF YOUR WIFI with your Wi-Fi network name (SSID).
- Replace PLACE THE PASSWORD OF YOUR WIFI with your Wi-Fi password.
- Replace PLACE YOUR AIO USERNAME and PLACE YOUR AIO KEY with the credentials from the yellow key icon on the dashboard.
- Copy the code.py File
- Download or create the provided code.py file.
- Copy it to the root directory of your Pico W's CIRCUITPYTHON drive.
Code Runthrough
- Importing Libraries
- These libraries are essential for hardware control (e.g., servos), network communication, and time management.
- Setting Up Servos
- Initializes two standard servos connected to GPIO pins. You can change the min_pulse and max_pulse according to your servo, but the minimum and maximum it can go to is 750 and 2250, respectively.
- servo_1 controls the claw mechanism.
- servo_2 controls the pulley system for up/down movement.
- min_pulse and max_pulse define the signal range for servo angles.
- Servo Control Functions
- Define servo movements with gradual angle adjustments for smooth motion. You can change the time.sleep(0.05), but it should be slow enough to not make it break.
- claw_servo: Opens and closes the claw.
- down_servo and up_servo: Move the pulley down and up respectively.
- Continuous Servo Functions
- Set up continuous rotation servos for the robot’s movement.
- servo_left and servo_right: Control left and right wheels.
- move_servo: Adjusts throttle to move the robot in different directions (e.g., forward, backward, left, right).
- Adafruit IO Setup
- Retrieve Adafruit IO credentials and define MQTT feeds.
- aio_username and aio_key: Authenticate with Adafruit IO. The os.getenv is used to get the respective variables from the settings.toml.
- Feed paths (move_feed, claw_feed, etc.) correspond to specific actions we set up before in the Adafruit IO dashboard.
- MQTT Event Handlers
- Define callback functions for MQTT events.
- connected: Subscribes to all action feeds upon connection.
- disconnected: Notifies disconnection from Adafruit IO.
- message: Executes actions based on the topic and message received (the press value).
- WiFi and MQTT Client Setup
- Connect to Wi-Fi and configure the MQTT client to communicate with Adafruit IO.
- wifi.radio.connect: Connects to the specified Wi-Fi network.
- mqtt_client: Handles MQTT publishing and subscribing.
- Main Loop
- Keeps the robot responsive to MQTT messages in real-time.
- servo_2 starts at its topmost position (180°).
- servo_1 begins in a closed position (0°).
- mqtt_client.loop(2): Checks for new MQTT messages every 2 seconds.
This structure allows your robot to listen for commands and execute corresponding movements seamlessly!
Downloads
Wire Everything Together!
To do the final step of putting everything together, wire all the servos together!
- Power the Pico W
- Connect the Pico W with the attached battery on the robot to make it start working.
- Pico W GPIO Pin Connections
- Servo 1 (Claw Servo):
- GPIO Pin: GP12
- PWM Output Pin: Controls the claw servo.
- Servo 2 (Pulley Servo):
- GPIO Pin: GP11
- PWM Output Pin: Controls the pulley servo (up and down movement).
- Continuous Servo (Left Wheel):
- GPIO Pin: GP15
- PWM Output Pin: Controls the left continuous servo for movement.
- Continuous Servo (Right Wheel):
- GPIO Pin: GP14
- PWM Output Pin: Controls the right continuous servo for movement.
- Power Connections:
- 3V Pin:
- Connect the 3V pin of the Pico W to the + rail of the breadboard to power the servos.
- GND Pin:
- Connect the GND pin of the Pico W to the - rail of the breadboard to complete the circuit for all components.
This should set up your Pico W with all necessary GPIO pins connected to the servos and power sources to make your robot start working!