Thursday, November 21, 2013

Code Similar to what we will be using(this code has an led output rather than dual servo motor outputs):


//define pins. I used pins 4 and 5
#define irLedPin 4          // IR Led on this pin
#define irSensorPin 5       // IR sensor on this pin

int irRead(int readPin, int triggerPin); //function prototype

void setup()
{
  pinMode(irSensorPin, INPUT);
  pinMode(irLedPin, OUTPUT);
  Serial.begin(9600); 
  // prints title with ending line break 
  Serial.println("Program Starting"); 
  // wait for the long string to be sent 
  delay(100); 
}

void loop()
{  
  Serial.println(irRead(irSensorPin, irLedPin)); //display the results
  delay(10); //wait for the string to be sent
}

/******************************************************************************
 * This function can be used with a panasonic pna4602m ir sensor
 * it returns a zero if something is detected by the sensor, and a 1 otherwise
 * The function bit bangs a 38.5khZ waveform to an IR led connected to the
 * triggerPin for 1 millisecond, and then reads the IR sensor pin to see if
 * the reflected IR has been detected
 ******************************************************************************/
int irRead(int readPin, int triggerPin)
{
  int halfPeriod = 13; //one period at 38.5khZ is aproximately 26 microseconds
  int cycles = 38; //26 microseconds * 38 is more or less 1 millisecond
  int i;
  for (i=0; i <=cycles; i++)
  {
    digitalWrite(triggerPin, HIGH); 
    delayMicroseconds(halfPeriod);
    digitalWrite(triggerPin, LOW); 
    delayMicroseconds(halfPeriod - 1);     // - 1 to make up for digitaWrite overhead    
  }
  return digitalRead(readPin);
}
http://playground.arduino.cc/Main/PanasonicIrSensor
Arduino code for including and utilizing an IR sensor/IR controller

/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}
Credit given to Ken Shirriff for creating the code.
Progress as of 11/21/13
 
 
 
Tank frame with spot for arduino board in the center.
 
Built by Brendan McGonagle using Kinects.
 
 
 Goals determined by Brendan McGonagle and Kevin Cerritelli
 
Immediate goals now that that tank frame has been built:
 
-Buying servo motors, optimally with required voltage of 4.5-6 V, since the battery voltage will be brought to 5 V using the arduino board
-Mounting the servo motors along with front driving gears and the back driven gear
-Design tank treads or buy tank treads

Thursday, November 14, 2013

Drawing by Brendan McGonagle
Top view drawing of our proposed tank design.

A is where the arduino board and breadboard will sit.
M marks the location of the two servo motors powering the treads.
On either side, the diagonal lines mark where the treads will be located.
The battery pack is shown on the opposite end of the tank structure.
The entire length of the tank is estimated to be about 10-12 in.
Current Objectives:

  • Establishing an initial structure design for:
    • the tank's frame
    • placement of breadboard/arduino board on the tank
  • Purchasing two relatively cheap motors and measuring dimensions needed for design
  • Designing mounts for the motors on either side of the vehicle
  • Generating ideas for use of 4 cubic inches of abs plastic using the 3D printer

Outline

The main goals of our project are as follows:

  • Provide controlled power to the tank treads on either side of an assembled vehicle
  • Remotely control speed, turning, and forward/backward motion using an IR sensor
In order to acheive these goals, the following challenges/design steps are expected to take place:

  • Mounting two motors on either side of the vehicle to power the treads
  • Designing/using tank treads with proper motor-driven gears to allow the vehicle to move over obstacles
  • Coding the IR sensor to receive the transmitted signals from the remote control and then causing each tread of the tank to have three states, possibly mapped over a range of values with a potentiometer.
    • Three states include: Clockwise motion, Counterclockwise motion, and no motion.
  • The middle of a range of potentiometer values mapped to motor rotation may be coded to be 0 rpm, and either end of the range of potentiometer values will be the positive and negative maximum angular velocity of the motors.