PonsiDanilomomograma
Published © GPL3+

Otto Diy with Ir remote

Otto Diy is a bipedal robot, driven by microcontrollers and controlled by a remote, able to walk and turn around.

IntermediateFull instructions provided3,003
Otto Diy with Ir remote

Things used in this project

Hardware components

Arduino Nano 33 IoT
Arduino Nano 33 IoT
×1
Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×4
IR receiver (generic)
×1
Modulo Joystick
Modulo Joystick
×1
Resistor 100 ohm
Resistor 100 ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1
IR transmitter (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

3D Printed parts

The parts we used to assembly the robot.

Schematics

Circuit Robot

This is the robot circuit, made on Tinkercad

Circuit Remote

this is the Remote circuit, made on Tinkercad

Code

Code Robot

C#
This code is the Robot code, made on Arduino
#include <IRremote.h>
#include <Otto9.h>


Otto9 Otto; //this is the name of our robot :)

IRrecv ir(12); //name and pin of the IR sensor
decode_results results; //this variable will assume the values of the recieved signals

#define PIN_LLEG 3 //YL - left leg pin
#define PIN_RLEG 4 //YR - right leg pin
#define PIN_LFOOT 2 //RL - left foot pin
#define PIN_RFOOT 5 //RR - right foot pin

#define PIN_Trigger  8 //US send pin
#define PIN_Echo     10 //US return pin
#define PIN_Buzzer  13 //buzzer pin

void setup() {

  //initialisation of the robot by defining: YL, YR, RL, RR, load calibration (true or false), Noise sensor, Buzzer, Trigger, Echo
  Otto.init(PIN_LLEG, PIN_RLEG, PIN_LFOOT, PIN_RFOOT, false, A6, PIN_Buzzer, PIN_Trigger, PIN_Echo);
  Otto.home(); //set all the servos to 90

  delay(500);
  Serial.begin(9600);
  ir.enableIRIn(); //start to read the IR sensor values
}

void loop() {

  if (ir.decode(&results)) { 

    if (results.value == 24) { //if the code sent by the remote is 24:
      Otto.walk(8, 600, 1); //walk: 8=steps, 600=period (time per step), 1=direction (forward)
      Serial.println("forward");
    }
    
    if (results.value == 32) { //if the code sent by the remote is 32:
      Otto.walk(8, 600, -1); //walk: 8=steps, 600=period (time per step), -1=direction (backwards)
      Serial.println("backwards");
    }
    if (results.value == 8) { //if the code sent by the remote is 8:
      Otto.turn(8, 800, 1); //turn: 8=steps, 600=period (time per step), -1=direction (right)
      Serial.println("right");
    }
    if (results.value == 16) { //if the code sent by the remote is 16:
      Otto.turn(8, 800, -1); //turn: 8=steps, 600=period (time per step), -1=direction (left)
      Serial.println("left");
    }
    ir.resume(); //start reading the sensor values again
  }
  else { //if the robot doesn't recieve any signal
    Otto.home();
  }
  results.value = 0;
}

Code Remote

C#
This code is the Remote code, used for driving the Robot, made on Arduino.
#include<IRremote.h>


IRsend emitter; //this is the name of the IR LED

//the following variables are necessary for the remote to understand the position of the joystick
int x = 0;
int y = 0;
int xPos = 0; //right side of the X axis
int xNeg = 0; //left side of the X axis
int yPos = 0; //right side of the Y axis
int yNeg = 0; //left side of the Y axis

void setup()
{
  Serial.begin(9600);
}

void loop()
{

  //read the joystick's X axis & Y axis values
  x = analogRead(A0);
  y = analogRead(A1);


  //these are the operations to calculate Xpos & Xneg
  if (x > 524) {
    xPos = (x - 512) / 2;
    xNeg = 0;
  }
  else if (x < 500) {
    xPos = 0;
    xNeg = (511 - x) / 2 ;
  }
  else {
    xPos = 0;
    xNeg = 0;
  }

  //these are the operations to calculate Ypos & Yneg
  if (y > 524) {
    yPos = (y - 512) / 2;
    yNeg = 0;
  }
  else if (y < 500) {
    yPos = 0;
    yNeg = (511 - y) / 2;
  }
  else {
    yPos = 0;
    yNeg = 0;
  }


  //tell otto to turn right
  if ((xPos - xNeg - yPos - yNeg) > 0) {
    emitter.sendSony(0x8, 32);
    Serial.println("right");
    delay(40);
    //tell otto to turn left
  }
  if ((xNeg - yPos - yNeg - xPos) > 0) {
    emitter.sendSony(0x10, 32);
    Serial.println("left");
    delay(40);
  }
  //tell otto to walk forward
  if ((yPos - yNeg - xPos - xNeg) > 0) {
    emitter.sendSony(0x18, 32);
    Serial.println("forward");
    delay(40);
    //tell otto to walk backwards
  }
  if ((yNeg - xPos - xNeg - yPos) > 0) {
    emitter.sendSony(0x20, 32);
    Serial.println("backwards");
    delay(40);
  }

}

Credits

PonsiDanilo
0 projects • 0 followers
momograma
2 projects • 1 follower

Comments