Misty Lessons
  • Misty Lessons
    • 📖Welcome to Misty Lessons
    • 📚Get to know your Misty
    • 📲Connect to Misty
    • 👩‍💻Misty Studio
    • 🖥️Desktop Environment
    • ⬆️Update your Misty
    • 👥Projects
  • Blockly
    • 🧩Blockly Lessons
      • 🤸Lesson 1: Movement
      • 🎶Lesson 2: Voice and Sound
      • 🎭Lesson 3: Expressions
      • 🎥Lesson 4: Robot Cinema
      • 🛠️Lesson 5: Events
      • ☺️Lesson 6: Face recognition
      • 🔢Lesson 7: Variables and Functions
      • 💬Lesson 8: NLP
    • 🏫Blockly projects
  • Blockly Elements
    • ⚛️Misty Blocks
      • Movement
      • Speech
      • Audio
      • Vision
      • Events
      • Miscellaneous
      • NLP
      • System
    • 🔁Basic Blocks
      • Logic
      • Loops
      • Math
      • Text
      • Lists
    • 🅰️Advanced Blocks
      • Variables
      • Functions
  • Python
    • 🐍Python Lessons
      • 🦿Lesson 1: Loco-motion
      • 🤖Lesson 2 : Build a character
      • 🧠Lesson 3: Create memories
      • ⚒️Lesson 4: Event skills
      • 👀Lesson 5: Expand awareness
      • 🔗Lesson 6: Compact code
      • 🗣️Lesson 7: Start a conversation
  • Python Elements
    • 🐸Misty Python API
      • Motion and Mobility
      • Display and LED
      • Record Assets
      • Change/Remove Assets
      • Stream Assets
      • Get Assets
      • Events
      • Sensor Events
      • Speech and NLP
      • Arduino Backpack
      • System
      • Slam
    • 📗Python Definitions
  • Python Projects
    • 🔮MistyGPT
    • 🚨Misty Intruder Alert
    • 📺Conference Assistant
    • 🏷️QR code detector
    • 🕵️‍♂️Misty follow human
    • 👋Misty wave back
    • 🖲️Misty OA
    • 🌐Get weather
    • 🚚Misty Delivery
    • 🫂Motivational Misty
    • 🖼️Misty Museum Guide
    • 🎃Who for Halloween
  • ARDUINO
    • ♾️Arduino Backpack
    • 🦎Arduino
    • 🔧Arduino Lessons
      • 🔌Arduino to Misty
      • ➕Misty to Arduino
  • ARDUINO PROJECTS
    • 🛠️Misty Tracker
    • 🦾Misty Arm
  • Community Projects
    • 🌤️Misty weather forecaster
  • HARDWARE EXTENSION
    • ⚙️Arduino breadboard support
    • 🦾Misty arm
    • 🥤Tin holder
  • Resource Database
    • 📁Image files
    • 📁Audio files
    • 📁Languages
    • 📁Known objects
    • 📁NLP Actions
    • 📁Action Commands
    • 📁ChatGPT PDF files
    • 📁AR Tag Dictionary
    • ⚙️Technical Specifications
Powered by GitBook
On this page
  • Materials
  • Circuit
  • MIT app inventor
  • Arduino code
  • Misty code
  • Comments:
  1. ARDUINO PROJECTS

Misty Arm

The Misty telescopic robotic arm is finally here. Find the front part that best suits your needs and share it!

Last updated 7 months ago

Misty's telescopic arm opens a whole new world of applications. Misty can help you solve many tasks like grabbing and bringing objects around!

Materials

  • Breadboard

  • Some wires of different lengths

  • One resistance 1kΩ and one 2 kΩ

  • Powerbank

  • Alligator pins

For testing the signal between Arduino and Misty

  • One LED and one button

  • One resistance of 330 Ω and one of 10kΩ

Circuit

Three points have to be clarified in the circuit because the software that creates the circuits doesn't have some elements:

Misty Serial connections

Power supplies

In the real circuit, those pins are not connected to the necessary power bank because otherwise the Bluetooth module and the motors couldn't work simultaneously.

For this reason, we need to connect the 5V to the plus and the GND to the ground of the power bank to give power to the circuit.

Arduino Bluetooth module HC-05

Of course what we have there it's not a LED but it's the Arduino Bluetooth Module HC-05. The pins of the LED represent the central four pins of the HC-05.

The VCC is connected to the 5V The GND is connected to the ground/minus The TXD is connected to pin 4 The RXD is connected to two resistances. Connect the 1kΩ to the pin 3 and the 2kΩ to the ground.

MIT app inventor

App file:

Your app will be ready! You can download MIT app inventor from the app store of your phone. Once you have the app on your phone you can click on Build>Android app and scan the QR code with your phone. Download the app and use your arm!

If you're interested in building or designing your app you can drag and drop the elements that you need from the left side to the screen and set them in the position you prefer. Don't forget to insert the Bluetooth client (connectivity) and the clock (sensors) as well. Once you have the screen done you can build the code by clicking on Blocks.

At the top, we have two buttons for connecting the smartphone to the Arduino Bluetooth HC-05.

Then, with a very simple design you can find three sliders each controlling one motor.

Moving the slider will change the position of the motors. It's better to tap the position we want the motor to be rather than sliding it because it has a higher chance of straight success.

Arduino code

#include <SoftwareSerial.h>
#include <Servo.h>

Servo servo01;
Servo servo02;

SoftwareSerial Bluetooth(3, 4); // Arduino(RX, TX) - HC-05 Bluetooth (TX, RX)

int servo1Pos, servo2Pos, MaPos; // current position
String dataIn = "";

void setup() {
  Serial.begin(9600);
  servo01.attach(10);
  servo02.attach(11);
  Bluetooth.begin(9600); // Default baud rate of the Bluetooth module
  Bluetooth.setTimeout(1);
  delay(20);
  pinMode(9, OUTPUT);      	//pin green LED
  pinMode(7, INPUT_PULLUP); 	//pin green button
}

void loop() {
  // Check for incoming data
  int pushedg = digitalRead(7); //green button
  if (pushedg == LOW){		// green button pressed condition
    digitalWrite(9, HIGH);	// green LED on
    Serial.println("green");	// write "green" in the serial
  } else {
    digitalWrite(9, LOW);	// green LED off
  }
  if (Bluetooth.available() > 0) {
    dataIn = Bluetooth.readString();  // Read the data as string
    if (dataIn.startsWith("s1")) {
      String dataInS = dataIn.substring(2, dataIn.length()); // Extract only the number. E.g. from "s1120" to "120"
      servo1Pos = dataInS.toInt();  // Convert the string into integer
      servo01.write(servo1Pos);
    }
    
    // Move Servo 2
    if (dataIn.startsWith("s2")) {
      String dataInS = dataIn.substring(2, dataIn.length());
      servo2Pos = dataInS.toInt();
      servo02.write(servo2Pos);
    }

    //Move Misty arm
    if (dataIn.startsWith("ma")) {
      String dataInS = dataIn.substring(2, dataIn.length());
      MaPos = dataInS.toInt();
      Serial.println(MaPos);
    }
  }
}

On the top, we define the libraries and the components that we will use in the code such as the servo library, the two servos, the Arduino Bluetooth module HC-05 and some variables.

Misty code

from mistyPy.Robot import Robot
from mistyPy.Events import Events

misty = Robot()
misty.change_led(255, 0, 0)

def msg(data):
    print(data)
    if data["message"]["message"] == "green":
        misty.change_led(0, 255, 0)
        print("green")
    else:
        misty.change_led(0, 255, 255)
        string = data["message"]["message"]
        arm_value = int(string)
        misty.move_arm("right", arm_value)
        print("moving arm")

misty.register_event(event_name="serial_message_event", event_type=Events.SerialMessage, callback_function=msg, keep_alive=True)
misty.keep_alive()

In this code, we only set a Serial message read event. In the event, if Misty receives the serial message "green", it means that the Arduino button is pushed so Misty will change her chest LED to green, otherwise it's the position to which the right arm has to go so we convert that string to an int variable. You can use this code in the Misty Studio as well, if you want to get the output when this is released you can use this code in your Desktop Environment and don't forget to add Misty's IP address in misty = Robot().

Comments:

Arduino Bluetooth module HC-05

Once you plug-in your HC-05 go into the settings of your device and connect it with your phone. It will ask you to insert a password and you can use either 1234 or 0000. Once your module is connected to your phone it will appear in the list of available devices when you open your app and click on the button connect to connect with your HC-05 module.

Button and LED

It's not necessary to have the button and the LED in the circuit and so in the project but I used it to check if the communication with Misty was working so it may be helpful for your project too.

Credits

Arm Motors

The slider of the Misty arm has been set in the range of -29 to 25 to prevent the new and longer arm from damaging the original motor that controls the arm movement. If the arm is accidentally triggered to go in a lower position then 25 shuts immediately Misty from the button in the back (the same one that you use to turn her on).

In the real circuit, , it's necessary to create these connections to allow communication between Misty and Arduino.

Connect the pins as explained

In order to comfortably move the arm from a smartphone application we will create a mobile app with . Once you open an account you can click on Projects>Import project(.aia) from your computer and select the file above.

In the setup it's important to set the serial begin to 9600 (this is the bound rate for the communication between Misty and Arduino) and to set also the Arduino Bluetooth module HC-05 on the same bound rate. In the loop, before if (Bluetooth.available() > 0) we check if Misty can receive commands from the Arduino by clicking the button as in . Later we just detect the message and and assign it to each motor. If the message starts with s1 or s2 the servos will move, if the message starts with ma (Misty arm) then Arduino will send a message to Misty to move the arm in that position.

To build this project I took inspiration from. You can click on it and get more information about your new Misty arm.

🦾
Arduino UNO
Bluetooth Arduino module HC-05
Servo SG90
Arduino breadboard support
Misty arm
USB to open-cable adaptor
as explained in this section
MIT app inventor
this lesson
this project
here
98KB
Misty_robotic_arm_app.aia
Arduino circuit
Picture of the real circuit
Arduino-Misty serial connection
Insert the USB-open wires in the powerbank
Use alligator clips to connect the open wires to the breadboard + and -. Use the 5V from the arduino in the + and the ground in the -
Arduino Bluetooth Module HC-05 board
Real circuit
Designer area
Blocks area