Project 4 – Owl

Build an owl that will fly as soon as something comes near. Don’t suffer, it will only move the wings, you won’t have to chase it!

Inside your kit box you will find all material needed to build this activity. Anyway you can download the templates hereso you can cut and personalize your owl as many times as you want.

 

DIFFICULTY LEVEL: Intermediate.

EXERCISE DURATION: 45 min.

MATERIALS:

  • Maker Inventor Kit
    • 4in1 main board
    • Ultrasound Porximity Sensor
    • DC Motor
    • Owl template
    • Colored sticks
    • Velcro
    • Flanges
    • Fasteners
    • 20cm Wires
    • Battery holder
    • USB wire
  • Adhesive
  • 6 AA Cells
  • Computer

 

CONSTRUCTION:

Follow video steps to build your flying owl:

 

SCHEMATIC:

Electronic components should be connected according this diagram:


PROGRAM:

You can load your program to 4in1 main board using block programming or text code. If it’s your first time with 4in1 board or you have any problem connecting it to your computer you can view our first steps document.

Here you find basic blocks program using MBlock software.

In our video you can see how to upload this program to 4in1 board.

 

If you prefer use text code, you can use our basic code for Arduino IDE. Feel free to modify and test.

//sensor ultrasonido
const int EchoPin = 12;
const int TriggerPin = 13;

//MOTORES
int PinSpeedMA = 5; // PIN DIGITAL PARA LA VELOCIDAD DEL MOTOR
int PinTurnMA = 4; // PIN DIGITAL PARA SENTIDO DE GIRO DEL MOTOR

int SpeedR = 175; // velocidad Dcha

//VARIABLES ULTRASONIDO
int   cm = 0;

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

  // sensor ultirasonido
  pinMode(TriggerPin, OUTPUT);
  pinMode(EchoPin, INPUT);

  // motores
  pinMode(PinSpeedMA, OUTPUT);
  pinMode(PinTurnMA, OUTPUT);
}

void loop()
{
  cm = ping(TriggerPin, EchoPin);
  
  if (cm < 45) // SI LA DISTANCIA ES ENTRE 1 Y 30cm
  {
    digitalWrite(PinTurnMA, HIGH); //subir
    analogWrite(PinSpeedMA,SpeedR);
  }
  else
  {
    digitalWrite(PinTurnMA, HIGH); //subir
    analogWrite(PinSpeedMA, 0);
  }
}

int ping(int TriggerPin, int EchoPin) {
  long duration, distanceCm;

  digitalWrite(TriggerPin, LOW);  //para generar un pulso limpio ponemos a LOW 4us
  delayMicroseconds(4);
  digitalWrite(TriggerPin, HIGH);  //generamos Trigger (disparo) de 10us
  delayMicroseconds(10);
  digitalWrite(TriggerPin, LOW);

  duration = pulseIn(EchoPin, HIGH);  //medimos el tiempo entre pulsos, en microsegundos
  distanceCm = duration * 10 / 292 / 2;  //convertimos a distancia, en cm
  return distanceCm;
}

And our video showing you how to upload this code uisng Arduino IDE

You can download files for MBlock 5 and ArduinoIDE

FINAL RESULT:
See this project finished and working:

0 0

0