Introduction: 'Pizza' the Photokinetic MothBot

Pizza is a photo-kinetic robot and is a biomimicry (and inspired by) of the photoreceptor and photomovement of microorganism.

Many freely mobile microorganism are capable of changing speed based on light intensity in a random direction. Their motor receptors are entwined with the illumination of the environment through photoreceptors.

This is simulated by the robot, 'Pizza' through random directional changes every 100 seconds. Net result is a robot that welcomes light, which can be found by taking the gradient of the overall movement based on lighting levels. In this case, it moves faster as the lighting levels increases, therefore Pizza the robot welcomes light.

For more information about the photomovement of microorganisms, here's an interesting research paper
http://pubs.rsc.org/en/content/articlelanding/2002...

Step 1: Tools and Materials

Hardware

  • Foam board
  • Swivel-Type Castor Wheel

Electronics

  • Arduino
  • Photoresistor
  • 2x DC motors
  • L293DNE Motor Driver
  • Breadboard
  • Battery holder
  • 4x AA batteries

Tools

  • Glue gun and glue sticks
  • X-acto blade

Step 2: Cut the Foam Board

Cut the foam board to a pizza-slice-shaped leaving enough room for the motor, battery, arduino, and breadboard to be mounted.

Step 3: Glue the Motor and Wheels

Glue the motors to the back side of the foam board on both corners of the 'pizza slice.'

Glue the 2" castor wheel at the front of the foam board.

Once dry fit the motor wheels snuggly on to the the shaft.

Step 4: Gluing the Electronics

Glue the battery holder at the very front or tip of the robot, followed by the Arduino, then the breadboard at the rear end. You may glue or tape Arduino or breadboard.

Step 5: Circuit: Connecting the VCC

Connect pin 1, 8, 9, and 16 all to a common voltage source, VCC, on the red power rail of the breadboard.

Step 6: Circuit: Connect the Common Ground

Connect pins 4, 5, 12, and 13 all to a common ground to the blue breadboard rail. Then connect the red rail to 5V and blue rail to GND on the Arduino with jumper wires.

Step 7: Circuit: Connecting the Signal Pins

Connect the first motor to pins 3 and 6. And connect the second motor to pins 11 and 14.

Connect the pins 2, 7, 10, and 15 to pins 3, 5, 6, and 9 on the Arduino board.

Step 8: Circuit: Wiring the Photoresistor

Connect the photoresistor to a female-male jumper wire and glue it to the battery holder upright.

Connect one of the leads to a 10kΩ resistor in series to VCC. Connect this same lead to A0 on the Arduino board.

Connect the other lead of the photoresists to ground.

Step 9: Upload the Code and Test Run

//L293D
//Motor A
const int motorPin1  = 3;  // Pin 14 of L293
const int motorPin2  = 5;  // Pin 10 of L293
//Motor B
const int motorPin3  = 6; // Pin  7 of L293
const int motorPin4  = 7;  // Pin  2 of L293
const int speedPin = 9;
//This will run only one time.
void setup(){
 
    //Set pins as outputs
    pinMode(motorPin1, OUTPUT);
    pinMode(motorPin2, OUTPUT);
    pinMode(motorPin3, OUTPUT);
    pinMode(motorPin4, OUTPUT);
    pinMode (speedPin, OUTPUT);
    pinMode (A0, INPUT);
   
}
void loop(){
  int light = analogRead (A0);
  light = map (light, 0, 1024, 0, 255);
  int num = random (1,4);
  if (num == 1){
    forward(255);
  } else if (num == 2){
    left(255);
  } else if (num == 3){
    right(255);
  } else if (num == 4){
    reverse(255);
  }
  delay(100);
}
void left(int speed1){
    analogWrite (speedPin, speed1);
    
    //This code  will turn Motor A clockwise
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
    //This code will turn Motor B counter-clockwise
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
}
void right (int speed1){
    analogWrite (speedPin, speed1);
    //This code will turn Motor A counter-clockwise 
    digitalWrite(motorPin1, LOW);
    analogWrite(motorPin2, speed1);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
    
    //This code will turn Motor B clockwise 
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    analogWrite(motorPin3, speed1);
    digitalWrite(motorPin4, LOW);
}
void forward (int speed1){
    analogWrite (speedPin, speed1);
    //motor A clockwise
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
    // motor B clockwise
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
}
void reverse (int speed1){
    analogWrite (speedPin, speed1);
    
    //motor a clockwise
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
    //motor b counter clockwise
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
}
Makerspace Contest 2017

Participated in the
Makerspace Contest 2017