SUMBA - a sumo robot and my first project

Posted on 10/04/2013 by sir_pumpkinhead
Modified on: 13/09/2018
Project
Press to mark as completed
Introduction
This is an automatic import from our previous community platform. Some things can look imperfect.

If you are the original author, please access your User Control Panel and update it.

Hi everybody, as some people allready know i am new to LMR and robots all together, meaning this is my first robot. It was originally going to be a holiday project but when my science teacher gave us a holiday assignment that had rather open criteria, the bot for fun got given 4 weeks to be finished, so now with a bit over 2 weeks left I almost have the entire bot assembeled. The chasses dimensions are 15cm wide X 15cm long X 5cm high   At the moment all i have is the unfinished chasse asembled ...


SUMBA - a sumo robot and my first project

Hi everybody, as some people allready know i am new to LMR and robots all together, meaning this is my first robot.

It was originally going to be a holiday project but when my science teacher gave us a holiday assignment that had rather open criteria, the bot for fun got given 4 weeks to be finished, so now with a bit over 2 weeks left I almost have the entire bot assembeled.

The chasses dimensions are 15cm wide X 15cm long X 5cm high

 

At the moment all i have is the unfinished chasse asembled (I still need to add holes for the wheels and skrew down the motor), and the code that i believe is finished, it may need some editing once i hook up the senors and test the whole thing out. 

here is a fritz of the wiring it will be more compact when actually put together, those are 1K resistors.

here 

also with the code im using PWM to control the motors because I have an NPN transistor between the motors and the batterys and i dont want to burn out the motors.

Here is the code:

(EDITED CODE) changed after seeing the comment by bdk6

CHANGE LOG: when one motor is running the other is set to off

 

 

#define RIGHTDC 5

#define LEFTDC 6

#define MIDDLEIR A0

#define LEFTIR A1

#define RIGHTIR A2

 

#define DANGER 1000

 

#define HALFSPEED 127

#define STOP 0

 

void setup() {

  pinMode(RIGHTDC, OUTPUT);

  pinMode(LEFTDC, OUTPUT);

}

 

void loop() {

  if (analogRead(MIDDLEIR) < DANGER) {

    analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

  } else if (analogRead(RIGHTIR) < DANGER) {

    analogWrite (LEFTDC, HALFSPEED);

    analogWrite (RIGHTDC, STOP);

  } else if (analogRead(LEFTIR) < DANGER) {

    analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, STOP);

  } else if ((analogRead(LEFTIR) < DANGER) &&

             (analogRead(MIDDLEIR) < DANGER)) {

               analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

 

  } else if ((analogRead(RIGHTIR) < DANGER) && 

             (analogRead(MIDDLEIR) < DANGER)) {

               analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

  } else if ((analogRead(LEFTIR) < DANGER) && 

             (analogRead(MIDDLEIR) < DANGER) && 

             (analogRead(RIGHTIR) < DANGER)) {

    analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

  } else if ((analogRead(LEFTIR) < DANGER) && 

             (analogRead(RIGHTIR) < DANGER)) {

    analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

  } else {

    analogWrite(LEFTDC, STOP);

    analogWrite(RIGHTDC, HALFSPEED);

  }

}

 

 

(OLD CODE)

#define RIGHTDC 5

#define LEFTDC 6

#define MIDDLEIR A0

#define LEFTIR A1

#define RIGHTIR A2

#define DANGER 1000

#define HALFSPEED 127

 

void setup() {

  pinMode(RIGHTDC, OUTPUT);

  pinMode(LEFTDC, OUTPUT);

}

 

void loop() {

  if (analogRead(MIDDLEIR) < DANGER) {

    analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

  } else if (analogRead(RIGHTIR) < DANGER) {

    analogWrite (LEFTDC, HALFSPEED);

  } else if (analogRead(LEFTIR) < DANGER) {

    analogWrite(RIGHTDC, HALFSPEED);

  } else if ((analogRead(LEFTIR) < DANGER) &&

             (analogRead(MIDDLEIR) < DANGER)) {

               analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

 

  } else if ((analogRead(RIGHTIR) < DANGER) && 

             (analogRead(MIDDLEIR) < DANGER)) {

               analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

  } else if ((analogRead(LEFTIR) < DANGER) && 

             (analogRead(MIDDLEIR) < DANGER) && 

             (analogRead(RIGHTIR) < DANGER)) {

    analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

  } else if ((analogRead(LEFTIR) < DANGER) && 

             (analogRead(RIGHTIR) < DANGER)) {

    analogWrite(RIGHTDC, HALFSPEED);

    analogWrite(LEFTDC, HALFSPEED);

  } else {

    analogWrite(LEFTDC, 0);

  }

}

 

If you see anything that you think i could improve on please tell me, as i said i am a beginner and i would love any help that can be supplyed to me.

 

 

 

(MAJOR EDIT!!!)

i haven't updated this in a while so here is what has happened with my bot.

First off, the gear box that i was going to use had shafts that were  3 ml in diameter and they did not fit my wheels, so i looked for new wheels and coudnt find any to the right size so instead i got new motors, this leads to my next problem.

i looked for the motor on the website of the place that my sister works at and got her to buy them for me, i stuffed up and didnt look at the dimensions and i got motors that were much larger than i originally thought.

to combat this problen i got rid of three walls and the roof to make room for the new motors and battery pack.

i also edited the front of the bot so that the sensors had somewere to be placed seeing as they were originally going to be attatched to the roof.

finally, when i was about to finish the robot i found the the cable ties i had bought to hold the motors down weren't long enough.

 

by tommorow i should have the robot done and be ironing out the bugs so expect videos and pictures soon.

 there will also be updated code as i do not need to use PWM any more

pushes other bots out of the arena

  • Actuators / output devices: 2 3 volt dc motors attatched to a dual gearbox
  • Control method: autonomous
  • CPU: Arduino Uno R3
  • Power source: 9 volt battery for the arduino, 4 AA batterys for the motors
  • Programming language: Arduino
  • Sensors / input devices: sharp GP2Y0A21YK infrared sensor
  • Target environment: inside on a sumo bot ring
Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post