Making Things Interactive

February 24, 2008

Assignment 6: Making more motion (actuation)

Filed under: 6: More Motion, Siddartha Butalia — sbutalia @ 2:28 pm

So i tried to build on my DC motors from last week. I simplified the sensors to a switch to focus on building other components. I aimed to slow down the DC motor by using a rubber band setup. This was not as seccesfull, but i learned how hard it was to prototype details with foam core. the code is a simple algorithm which takes a switch input, and drives a motor

 here are some photos & the code:

Free Image Hosting at www.ImageShack.us Free Image Hosting at www.ImageShack.us


int ledPin = 13;    // defines the check pin
int inputPin = 2;   // defines input for sensor A
int motorPin = 9;   // defines output for motor A

void setup() {

  pinMode(ledPin, OUTPUT);      // declare check LED Pin
  pinMode(motorPin,OUTPUT);     // declare Motor PinA
  pinMode(inputPin, INPUT);     // declare SensorA input Pin

  Serial.begin(9600);
 }

void loop(){

  while (digitalRead(inputPin) == HIGH) {        // check if the input is on
    digitalWrite(ledPin, HIGH);   // turn check LED On
    digitalWrite(motorPin,HIGH);  // turn Motor A On
  } 

    digitalWrite(ledPin, LOW);  // turn check LED Off
    digitalWrite(motorPin,LOW); // turn Motor A Off

}

 


Godzilla Puncher v3 (servo no work proper)

Filed under: 5: Making Motion, Gaku Sato — ponkotsu @ 3:43 am

So as it turns out, the first set of transistors I tried were inadequate in handling the current load required to activate a solenoid, as they’re only rated for low-power use like logic circuitry.  After being advised to try a power transistor, those were replaced with a 90W TIP3055, apparently used in applications like audio amplification.  This could handle the current loads and the solenoid would make a semi-audible clicking sound, but no activation.  After much confusion and some mysterious smoky smell (which was later identified as Jet’s wristwatch), we found that the transistor/solenoid circuit worked with either the TIP120 transistor or with no resistance on the input signal (to base).  It was determined that the solenoid input voltage was less than the required trip voltage due to the characteristics of the “better” TIP3055.  Since it is used for highly sensitive applications, the input-to-output voltage relation is more linear, thus resulting in an insufficient output voltage with the 1K resistor on the transistor input signal (to base).  This also explains why it worked when we piped 5V straight to base, and why even with the resistor, it worked with the TIP120, which has a more steep non-linear input-to-output curve.  Once we figured that out, the rig was tested with Godzilla in place, who was, alas, punched square in the face.

Radioshack seems to be completely out of TIP120s so my new wiring’s just waiting on that piece.  That is, at least for the solenoid portion…

My other problem was servo control.  I was only succeeding at making an unreliably twitchy speed-controlled rig.  Chris told me he was able to get position control by using the 5V power from the Arduino and sending analogWrites to the control pin.  So I thought perhaps the 9V input was excessive?  Anyways I tried that technique, but still nothing.  I tried Servo.write(angle) with <Servo.h> as well as analogWrite(various 0~255) and it’s always speed control.  I’ve yet been able to get the servo (Tower Hobbies TS-53) to go to any position and stop before it pins itself one way or the other.

At this point, I’m just going to move onto assignment 6 and hope I can get the servo to respond well in that rig.  Then hopefully I’ll successfully be able to even have a midterm project proposal, since otherwise without proper servo control, my small-scale accurate actuation is limited.  LIMITED!  And my project would require this.  I’m afraid even if I went with a linear actuator that I’d have the same problem.

Anyways more debugging Tuesday…

#include <Servo.h>

int PotPin = 2;     // input pin - potentiometer
int PhotoPin = 3;   // input pin - photoresistor
int ServoPin = 11;  // output pin - servo
int SolePin = 5;    // output pin - solenoid

Servo Ultraman;     // set servo
long angle = 0;     // 95 to stop...

int punch = 0;
int msecond = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(PotPin, INPUT);         // 0~1005
  pinMode(PhotoPin, INPUT);       // 750+
  pinMode(ServoPin, OUTPUT);
  pinMode(SolePin, OUTPUT);
  analogWrite(ServoPin, 0);
  digitalWrite(SolePin, LOW);

  Ultraman.attach(ServoPin);
  Ultraman.setMaximumPulse(2400); // 2400 default
  Ultraman.setMinimumPulse(544);  //  544 default

  Ultraman.write(0);
}

void loop()
{
  angle = analogRead(PotPin);
  angle = angle*180/1005;
  Ultraman.write(angle);
  msecond = millis()/1000;
  if(millis()-msecond*1000 == 0)  // display every second
  {
    Serial.print("pot");
    Serial.print(analogRead(PotPin));     // potentiometer reading
    Serial.print(":angle");
    Serial.print(angle);                  // calculated angle
    Serial.print(" photo");
    Serial.println(analogRead(PhotoPin)); // photoresistor reading
  }
  if(analogRead(PhotoPin) > 750 && punch == 0)
  {
    Serial.print("punch!");
    punch = 1;
    digitalWrite(SolePin, HIGH);
    delay(500);
    digitalWrite(SolePin, LOW);
  }
  if(analogRead(PhotoPin) < 750) {punch = 0;}
  Servo::refresh();
}

Blog at WordPress.com.