Thursday, March 24, 2016

Crescent Rose QOL changes #1

Crescent Rose did a number on my arms when I carried it around during Otakon. Here I attached some duct tape shoulder straps so I can distribute some the weight on my shoulders. My arms will appreciate this.







The strap was made out of duct tape and another drawer slider was attached to prevent the head from bending down too much.









Lastly, there is a servo motor attached to the top of claw to move the hinge back an forth. This piece below.



This part currently does not operate and was put in early as a future feature if I ever get that far. Considering I have, it was time to work on it. Since this is a servo motor, I can't just feed it voltage to make it move, these motors require square wave pulses of electricity to move. To produce this wave, I will use a microcontroller. Yes, you can control servo motors just with circuit components but it's easier and more compact to do it with a microcontroller. I will be scrapping the old parallax board and be using the more modern Arduino Uno.

Image from: https://www.arduino.cc/en/uploads/Main/ArduinoUno_R3_Front_450px.jpg

The plan is to have the servo move one way when one button is pressed and the other way when the other button is pressed.



The code and servo schematic connection to the arduino are below. My port connections are different than the diagram below. The resistors I used are 10kohms and the ports are different (I used digital port 7 and 4 for the switches. The servo used digital port 2).

Image from: http://1.bp.blogspot.com/-eVvXjzQEXoY/VaPTbCBS7mI/AAAAAAAAA4Y/TcpPlA37c1Q/s1600/Control%2Bservo%2Bwith%2Bpush%2Bbutton%2Bswitch%2Bbreadboard%2Bview.jpg

Code:

#include <Servo.h>

Servo claw;
int state1=0;
int state2=0;
int pin1=7;//digital port 7
int pin2=4;// digital port 4

void setup() {
  // put your setup code here, to run once:
  claw.attach(2); // digital port 2.
  pinMode(pin1,INPUT);
  pinMode(pin2,INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  state1=digitalRead(pin1);
  state2=digitalRead(pin2);
 
  if(state1==HIGH){
    claw.write(180);
  }
  if(state2==HIGH){
    claw.write(0);
  }
  else{
    claw.write(90);// vex servo stop
  }

}


Attachment to Crescent Rose.





No comments:

Post a Comment