Move a Robot Arm over WiFi

Move a Robot Arm over WiFi

Are you interested in controlling your robotic arm using your phone or computer from anywhere in the world? In this 3 step beginner-friendly tutorial, we will show you how to build a virtual remote control, choose how fast you want to move your robot arm, and record and playback custom movements!


MATERIALS

HARDWARE: 

SOFTWARE:

Tools:

  • Soldering Iron (optional)
  • Multimeter (optional)

Step 1: Connecting your servos 

Robotic arms come in many different shapes and sizes. In order to complete this build, it is critical to determine how many servos are used on your model. Each servo TinyShield was designed to support up to 4 servos. If your robotic arm uses more than 4 servos, you can always stack a second servo TinyShield to control up to 8 total. 

Secondly, the servo TinyShield accepts JST connectors with a 1mm pitch. The pitch of a connector refers to the distance between the center of each pin, shown below: 

If your connector looks like this, you are good to skip to the next step!

If not, never fear! The good news is that all servos use the same three-wire configuration: red (VCC), black (ground), and orange/yellow (signal line.) 

Thus, all you need to do is cut off each servo's connector and replace it with 1 JST-SH Pigtail.

  • In order to confirm that your polarity is correct, we recommend connecting one of the JST pigtails and the 1100 mAh battery to the servo TinyShield and measuring the voltage across the VCC (red) and Ground (black) leads of the JST pigtail.
  • If you get a negative voltage, dismiss your inner electrical intuition as you connect the red lead of the pigtail to the brown lead of the servo and the black lead of the pigtail to the red lead of the servo. Otherwise, connect the red lead of the pigtail to the red lead of the servo and the black lead of the pigtail to the brown lead of the servo. 

    Step 2: Installing and using Blynk

    Blynk is available on iOS, Android, or PC (via BlueStacks). This is one of the most popular and easy to use IoT apps. 

    • Once installed, open the app and create a new account.
    • Then, create a new project and name it whatever you like.
    • Regardless of whether you are using the TinyZero or TinyScreen+, select the Arduino Zero as your device and WiFi as your connection type.
    • Your project will be granted a unique authentication token, which will be sent to your email. We will be using this token in Step 3.
    • Next, tap or click anywhere on the black background to add a widget to your project. The widgets you are looking to add the Joystick and button widgets. Each joystick widget can be used to control two servos, while you will need 4 button widgets regardless of how many servos you are controlling. In our project, we needed to control 4 servos, so we used 2 of the joystick widgets.
    • Finally, we need to edit the properties of each widget by tapping on them.
    • Within each of the two joystick widgets, switch to the merge output type and set both minimums to -300 and both maximums to 300. Then, assign the first joystick virtual pin V0 and the second joystick virtual pin V1 by tapping on the green PIN selector. 

    • Finally, assign virtual pins V2-V5 to the button widgets. The buttons will be used to trigger different aspects of the recording functionality, as shown below:
    Pin Function
    V2 Start
    V3 Save
    V4 Stop
    V5 Shutdown

    Step 3: Uploading the code to your processor

    • If this is your first time using TinyCircuits products, refer to the TinyZero Setup Tutorial or the TinyScreen+ Setup Tutorial to configure the Arduino IDE correctly.
    • Install the Blynk library for Arduino.
    • Then, download the zip archive provided in the software section.
    • Open the BlynkRobot.ino file and insert your authentication ID from Step 2 as well as your WiFi information in lines 29-36. Note that the SSID is the name of your WiFi network (case sensitive.) 

    • If you are interested in adjusting the speed of your robot arm, try adjusting the DELAY_BETWEEN_MOVEMENTS constant on line 55.

    • When you are ready to rumble, connect the WiFi TinyShield and servo TinyShield to your processor. Then, connect your processor via the micro USB cable. 

    • Make sure that you have the correct port selected. The correct port number will vary, but your processor should appear to the right:

    • Then, upload the code!

    • After uploading the code, a message should briefly appear in the Blynk app, indicating a successful connection. 
    • The final step is to press the play button on the Blynk app! At this point, the robot arm should move as you adjust the joysticks.

    If you are interested in recording a movement for playback, press the start button from any position. Then, move the arm and press the save button to save that movement into a new step. It is important to create your steps according to the following rules:

    1. Only one servo may be used for a given step. 
    2. A step can only contain movement in one direction.

    When you press the save button, a snapshot is created that contains the location information of whichever servo was moved. Therefore, if you open the claw, close the claw, and then save the step (breaking rule 2), the snapshot will show that the claw is closed, but will not record the moment that you opened it. The solution would be to take a snapshot after opening the claw, and then a second snapshot after closing it.

    Once you have recorded your final step, press the stop button to stop the recording. The arm will return to the position it was in when you started the recording and will then execute the recording until you press and hold the shutdown button.

    That's all there is to it! We hope you learned a little bit more about the internet of things (IoT), robot arms, and servos in this 3 step tutorial! 


    CONTACT US

    As always, if you have any questions or feedback, feel free to email us at info@tinycircuits.com. We would love to hear any ideas for improvement or new IoT projects you were inspired to work on! 

    Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it!

    Thanks for making with us!!