Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
CoolRobotsAndStuff
Published © GPL3+

Super Mario Odyssey IRL

Isn't it cool when Mario throws Cappy in Odyssey? Well, I made it in real life.

BeginnerShowcase (no instructions)1,557
Super Mario Odyssey IRL

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
Any arduino is good
×1
9V battery (generic)
9V battery (generic)
Better if rechargeable
×1
AA Batteries
AA Batteries
Better if rechargeables
×2
DC Motor, 12 V
DC Motor, 12 V
×1
9V Battery Clip
9V Battery Clip
×1
Battery Holder, AA x 2
Battery Holder, AA x 2
×1
SparkFun RedBot Sensor - Line Follower
SparkFun RedBot Sensor - Line Follower
×1
L298n Motor Driver
It's a very common component
×1
Slide Switch
Slide Switch
×1
Wheels for the motors
If you dont have them, you can probably find a replacement.
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3d pen (optional)
This is my method for adding stuff, but you can use wathever you want

Story

Read more

Schematics

Circuit layout

This is the entire circuit. If you have the specified driver you wont have to do all the mess with two drivers. You might have to make some changes if you use 1.5v batteries instead of 1.2v, couse the driver only supports up to 12v before you have to power it with aditional 5v for the inner circuitry, but you can probably figure that out.

Code

Main code

C/C++
This is the entire code, if you want to make this project by yourself.
//Defines the pin variables for the motors
int posSpinn = 6;
int negSpinn = 5;
int negPulley = 10;
int posPulley = 9;

//Spinn expansion and retraction speed parameters
int expSpeed = 20;
int retSpeed = 110;

//Defines state machine variable
int flag = 0;

//Defines the light sensor variable
int sensor;

void setup() {
  //Motor pin variables in OUTPUT mode
  pinMode(negSpinn,OUTPUT);
  pinMode(posSpinn,OUTPUT);
  pinMode(negPulley,OUTPUT);
  pinMode(posPulley,OUTPUT);

  //Initial pulley extenction
      delay(1500);
      analogWrite(negPulley,60);
      delay(3800);
      analogWrite(negPulley,0);
}

void loop() {
  //Reads the sensor value and stores it in the "sensor" variable
  sensor = analogRead(A0);

  //First state
  if (flag == 0){
    if (sensor > 500){
      //Next state
      flag = 1;
    }
  }

  //Second state
  else if (flag == 1){
    if (sensor < 500){
      //Throwing signal
      delay(3000);
      analogWrite(posPulley,150);
      delay(100);
      analogWrite(posPulley,0);

      //Pulley retraction
      delay(400);
      digitalWrite(posPulley,1);
      delay(1500);
      digitalWrite(posPulley,0);

      //Next state
      flag = 2;
    }
  }

  //Third state
  else if (flag == 2){
    if (sensor > 500){

      //Next state
      flag = 3;
      }
    }
    
  //Fourth state
  else if (flag == 3){
    if (sensor < 500){
      //Starts spinning
      delay(2000);
       digitalWrite(posSpinn,0);
      analogWrite(negSpinn, 220);
      delay(1000);
      digitalWrite(negSpinn,1);
      delay(1000);

      //Spinn expansion
      digitalWrite(posPulley,0);
      analogWrite(negPulley,60);
      delay(100);
      analogWrite(negPulley,expSpeed);
      delay(3000);
      digitalWrite(negPulley,0);
      delay(1600);

      //Spinn retraction
      analogWrite(posPulley,retSpeed);
      delay(2000);

      //Spinn finalization
      digitalWrite(posPulley, 0);
      digitalWrite(negSpinn,0);

      //pulley extenction
      delay(1500);
      analogWrite(negPulley,60);
      delay(3800);
      analogWrite(negPulley,0);
      
      //Next state
      flag = 0;
    }   
  }
  delay(4000);

}

Credits

CoolRobotsAndStuff
1 project • 1 follower

Comments