Kyubu 2.0 is a highly functional top hat wearing robot that will avoid obstacles and go to people he likes. Kyubu 2.0 is the most fearsome Kyubu of all!!
Initially We had an Idea to Have a Flying Kyubu but He is too fat and square to fly so we thought wheels to be an easier method.
Bills of Materials:
- 2 parallax continuous servos
- 2 peanut butter lids(used for the wheels)
- lego pieces(used for third wheel and easy access to kyubu’s organs)
- 2 squared block of wood
- jumper wires
- Arduino UNO
- breadboard
- capacitors
- 9v batteries
- battery snap
- Styrofoam cardboard(to build Kyubu)
- drill
- hot glue gun
- screws
- acrylic paint
- duct tape
- soldering iron
- sensor:Ultrasonic Range Finder (model:MB1043)
some sets for male header pins to put into the servos so you can attach it to the breadboard
Optional third wheel: Legos (We used a Lego wheel and some lego pieces)
We bought 2 Styrofoam boards from the nearest dollar store and began cutting 6 sides. We used 2 so we can have 2 covers, one being brought where ever and the other being the more presentable backup. My partner and I began cutting the pieces. We also needed a permanent bottom so that all we needed to do to change bodies was remove the top. The permanent bottom would contain all the circuits.
This was our nonworking model of Señor Kyubu. We added a mustache and called it Señor Kyubu but then I removed the mustache because it didn’t look right on the final model so we went back to the first name Kyubu 2.0
We then began on the Wheels. We used peanut butter caps and added wood inside the caps so it will be more sturdy. We added screws to insure that the peanut butter cap and the wood is well mended together. Then we used 2 parallax 360 continuous servos and hot glued them to each cap.
We began plugging the 2 servos into the breadboard and Arduino. The Arduino Uno board itself and the wheels were being powered by 2 9V batteries. My partner and I successfully have gotten the wheels to work using the code below
We ran into many problems that we were trying to figure out for more that 24 hrs. Using the sensors and attaching it to the wheels was the hardest part. We were first using the IR sensor but that was getting us nowhere so we changed to the Ultrasonic Range Finder. Even switching to another sensors, we used various methods but sadly we could not get the sensor to work with the wheels. We researched online to see what we could do and saw many examples that other people did too but it did not seem to work. We also went on the Arduino.cc site and checked out the libraries and learning sections, references too but could not find a solution. We also checked ou the Arduino forum but still could not find a clear answer. At this point we did not even know where to look and was hoping that someone divine could help us or lead us to the direction that we will find our answer but we didn’t. We also went to a Professor for help but the most he said is to check the circuit and the problem can lie on the circuit but my partner and I know it wasn’t. The circuit was fine but the sensor was being a jerk.
Final Code (that works!!!):
#include <Servo.h>
const int numReadings = 5;
int readings[numReadings];
int idex = 0;
int total = 0;
int average = 0;
Servo leftMotor;
Servo rightMotor;
const int anPin = A0;
long mm, inches;
void setup ()
{
Serial.begin(9600);
leftMotor.attach(9);
rightMotor.attach(3);
for( int thisReading = 0; thisReading < numReadings; thisReading++)
{
readings[thisReading] = 0;
}
}
void read_sensor (){
average = analogRead(anPin);
mm = average*5; //Takes bit count and converts it to mm
inches = mm/25.4; //Takes mm and converts it to inches
}
void print_range ()
{
Serial.print(“S1”);
Serial.print(“=”);
Serial.print(mm);
Serial.print(” “);
Serial.println(inches);
}
void loop ()
{
read_sensor();
total = total – readings[idex];
readings[idex] = analogRead(anPin);
total = total + readings[idex];
idex = idex + 1;
if (idex >= numReadings)
idex = 0;
average = total / numReadings;
print_range();
delay(200);
if(inches < 15)
{
leftMotor.write(-90);//backwards
rightMotor.write(180);
delay(1000);
leftMotor.write(-10);
rightMotor.write(200);
delay(1000);
}
else
{
leftMotor.write(180); //forward
rightMotor.write(80);
}
}
Recent Comments