Handling Robot

Description

Among many industrial robots, handling robots are undoubtedly effective, applied in industrial manufacturing, warehousing and logistics, tobacco, medicine, food, chemical and other industries, or in post offices, libraries, ports and parking lots. In this experiment, we will use LEGO blocks to build a handling robot to carry things.

How to build up a handling robot

Step 1 Dismantle the ultrasonic sensor  6


Required components 6_2


6_3


6_4


Step 2 Required components 6_5


6_6


6_7


Step 3 Required components 6_8


6_9


6_10


Step 4 Required components 6_11


6_12


6_13


Step 5 Required components 6_14


6_15


6_16


Step 6 Required components 6_17


6_18


6_19


Step 7 Required components 6_20


6_21


6_22


Step 8 Required components 6_23


6_24


6_25


Step 9 Required components 6_26


Set the angle of the servo to 180 degree

Wire servo up Servo

PCB Board

Brown

G

Red

5V

Orange

S2(A0)

Upload the code of the servo to the main board of the Beetlebot car, as shown below

#include <Servo.h>
Servo lgservo;  // create servo object to control a servo

void setup() {
lgservo.attach(3);  // attaches the servo on pin 3 to the servo object
}

void loop() {
lgservo.write(180); // tell servo to go to position
}

6_27


6_28


Step 10

Required components

6_29


6_30


3


3_1


6_31


6_32


Wire up servo

8c76722a8e1b9678784637c950ad597


Test Code:

#include <Servo.h>
Servo lgservo;
#define ML 15
#define ML_PWM 17
#define MR 14
#define MR_PWM 16
#define servo2 3

char val;
char wifiData;

void setup() {
Serial1.begin(9600);
pinMode(ML, OUTPUT);
pinMode(ML_PWM, OUTPUT);
pinMode(MR, OUTPUT);
pinMode(MR_PWM, OUTPUT);

lgservo.attach(3);
lgservo.write(180);
}

void loop() {
if(Serial1.available() > 0)
{
    val = Serial1.read();
    Serial.print(val);
}
switch(val)
{
    case 'F': car_forward(); break;
    case 'B': car_back(); break;
    case 'L': car_left(); break;
    case 'R': car_right(); break;
    case 'S': car_stop(); break;
    case 'p': lgservo.write(110); break;
    case 'x': lgservo.write(180); break;
}
}


void car_forward()
{
digitalWrite(ML,LOW);
analogWrite(ML_PWM,127);
digitalWrite(MR,LOW);
analogWrite(MR_PWM,127);
}

void car_back()
{
digitalWrite(ML,HIGH);
analogWrite(ML_PWM,127);
digitalWrite(MR,HIGH);
analogWrite(MR_PWM,127);
}

void car_left()
{
digitalWrite(ML,HIGH);
analogWrite(ML_PWM,150);
digitalWrite(MR,LOW);
analogWrite(MR_PWM,105);
}

void car_right()
{
digitalWrite(ML,LOW);
analogWrite(ML_PWM,105);
digitalWrite(MR,HIGH);
analogWrite(MR_PWM,150);
}

void car_stop()
{
digitalWrite(ML,LOW);
analogWrite(ML_PWM,0);
digitalWrite(MR,LOW);
analogWrite(MR_PWM,0);
}

Connect Wifi, click buttons to make the car to move toward building blocks and put some building blocks on the robot.

Then press to drive the robot to move.

Hold down the button to drive the robot to drop building blocks, then building blocks can be conveyed