Brobot
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)
Brobot is a ping pong shooting robot. It shoots ping pong balls through shooting wheels driven by small DC motors with O-rings on the outside. There are two potentiometer knobs that allow the user to change both the pitch and yaw of the robot and the potentiometer knobs link to an LCD Display that gives the user a callout of the pitch and yaw so that they may fine tune their shooting.
For this project you will need:
2- Arduino Unos
https://www.amazon.com/Arduino-Uno-R3-Microcontrol...
1- Dual H Bridge
https://www.amazon.com/Qunqi-Controller-Module-Ste...
2- DC Motors
https://www.amazon.com/15000-16500RPM-Electric-Sci...
2- SG90 Servo Motors
https://www.amazon.com/TowerPro-SG90-Mini-Servo-Ac...
2- O-Rings
1- Electronics Box
2- Potentiometers with knobs
https://www.amazon.com/potentiometer-potential-bla...
1- 2x16 LCD Display
https://www.amazon.com/Arducam-HD44780-Character-B...
And lots of jumper wires.
Attached are videos, pictures, and the 3D models of the components needed for this project.
Rotating Mount Assembly
After purchasing the materials and 3D printing the pieces for this project you will need to start assembling the rotating base. First, you will drop an SG90 Microservo Motor into the base piece. Screw or glue it into this position. Next, attach the yaw tabletop piece that will affix on top of the servo motor arm connector. This should be glued into place. For the third step of assembling this, you will need to add in the pitch control mount on top of the tabletop piece. Screw a servo motor into this then attach the pitch tabletop piece. Screw everything into place.
Launcher Assembly
For the second step of this process, you will need to connect the DC Motor to the shooting wheels. Add the O-Ringe to the Shooting Wheels. Do for both DC Motors. Drop these into the motor cups then put into the Launcher Base.
Attach the Launcher Assembly to the Rotating Base
Glue the launcher assembly on to the rotating base.
Wiring
Wire up the electronics per this diagram.
Code
Upload the following code to the corresponding Arduino. For the servo and LCD Arduino upload the following code:
//Brobot Servo and LCD Control Code
//Servo Library #include
//LCD Library #include #include
//Initialize Servos Servo myservo1; // create yaw servo Servo myservo2; // create pitch servo
//Initialize LCD LiquidCrystal_I2C lcd(0x3F, 16, 2); // set the LCD address to 0x3F
//Callout Pins int potpin1 = A0; // analog pin used to connect the potentiometer that controls yaw int potpin2 = A1; // analog pin used to connect the potentiometer that controls pitch int val1; // variable to read the value for yaw int val2; // variable to read the value for pitch
void setup() { //Setup Servos myservo1.attach(3); // attaches the servo on pin 9 to the servo object myservo2.attach(9); // attaches the servo on pin 9 to the servo object
//Open Serial Monitor Serial.begin(9600);
//Start LCD lcd.init(); lcd.init(); lcd.setCursor(1, 0); lcd.backlight(); }
void loop() { //Yaw Servo val1 = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023) val1 = map(val1, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) myservo1.write(val1); // sets the servo position according to the scaled value delay(15); // waits for the servo to get there
//Pitch Servo val2 = analogRead(potpin2); // reads the value of the potentiometer (value between 0 and 1023) val2 = map(val2, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) myservo2.write(val2); // sets the servo position according to the scaled value delay(15); // waits for the servo to get there
//LCD Display lcd.setCursor(0, 0); lcd.print("Yaw:"); lcd.setCursor(8,0); lcd.print(val1); lcd.setCursor(0, 1); lcd.print("Pitch:"); lcd.setCursor(8, 1); lcd.print(val2); delay(30); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings. }
Upload the following code to the Motor Control Arduino:
//Code for Brobot Motor Controller Arduino Set up
// connect motor controller pins to Arduino digital pins // motor one int enA = 10; int in1 = 9; int in2 = 8;
// motor two int enB = 5; int in3 = 7; int in4 = 6; void setup() { // set all the motor control pins to outputs pinMode(enA, OUTPUT); pinMode(enB, OUTPUT); pinMode(in1, OUTPUT); pinMode(in2, OUTPUT); pinMode(in3, OUTPUT); pinMode(in4, OUTPUT); }
void loop() { digitalWrite(in1, LOW); digitalWrite(in2, HIGH); digitalWrite(in3, LOW); digitalWrite(in4, HIGH); // accelerate from value 0 to 256 analogWrite(enA, 250); analogWrite(enB, 250); }
Controls
Install the LCD Display and the Potentiometers into the controls box you have.
Power Up and Play
Now all that's left to do is to turn everything on and play with your ping pong shooter.