Week (26)
Description
This weeks session has been spent rigging up a new lip system because the fishing line kept braking when used for long periods of time and also installing a new audio cut off system for the jaw servo. An on going issue is that when the robot is left for long periods of time (over a week) without oiling and testing the servos the mechanisms seem to brake or cease up. This is because the build is mainly made up of metal, aluminium and brass which all need a lot of maintenance to keep them running smoothly.
New Lip Wire
Equipment
Thin chord.
Milliput.
To start with i removed the old fishing line from the mechanism and threaded the thin chord through the hoops on the upper lip frame. I used Milliput to keep this in place and to reduce the strain on the chord. Hopefully with system will last a lot longer and be more durable than the fishing line. 1.1
Audio Trigger
To make the audio trigger I took an extension lead off a set of old headphones and stripped back the wires twisted the two stereo wires together and twisted the copper ground around wire so that it could be insterted into analog 3 and the ground, into the ground port of the Arduino board. .The premiss of this framework is that when the value of the signal is equal to 0 the mouth closes, then if there has been a 'pause' or a 0 value for longer than the count of 5 seconds then the code restarts over again. I had help getting this to work from my lecturer, I was not sure how to fully implement this system into the original code. After a few hours of explaining how these functions work I feel confident enough to fix any errors on the audio trigger myself.
New Power Shield
The old power shield (v4), was not capable of powering servos from and external power source, this has not really been an issue since this stage as groups of micro servos and individual power servos have been tested using the usb power source from the pc. However now these systems require more voltage to work simultaneously. That is why i have purchased a sensor shield (v5), (1.2) which has an external power supply block that runs separately from the analog ports. This means that the external power supply only powers the digital pins, putting less stress on the arduino board to power servos allows for the allocation of more transmission to be passed through the boards buffers which will be important as the project develops.
Arduino code example//
#include <Servo.h>
int c=0;
int talkmode=0;
int oldtalkmode=0;
long rfac;
long mpos;
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
Servo myservo2;
Servo myservo3;
Servo myservo4;
int talkcount=255; ///eventually use audio stop trigger
int doclosemouth=0;
int wcount;
int pcount;
int mystart=1;
void setup(){
Serial.begin(9600);
wcount=0;
pcount=0;
pinMode(A0,OUTPUT);
pinMode(A2,OUTPUT);
// pinMode(A3,OUTPUT);
// pinMode(A4,OUTPUT);
myservo.attach(A0); // attaches the servo
myservo2.attach(A2);
int oldtalkmode=0;
// myservo3.attach(A3);
// myservo4.attach(A4);
}
void loop(){
while(Serial.available()>0){
if(talkmode<9) oldtalkmode=talkmode; // this is the reset for the loop, if talk mode is is less than 9 then old talk mode = new talk mode
talkmode=Serial.read();
Serial.print("TM="+talkmode);
}
if(talkmode==1){
//wait for start of talking
if(mystart==1){
while(analogRead(3)==0){
}
mystart=0;
// Serial.println("hello");
};
//count pauses
if(mystart==0){
int v=analogRead(3);
// Serial.print("v:");
// Serial.print(v);
// Serial.print(" ");
if(v==0){
pcount++;
if(pcount>10){
mystart=1;
}
}else{
doclosemouth=0;
if(pcount>5){
pcount=0;
wcount++;
doclosemouth=1;
// Serial.println(wcount);
pcount=0;
// mystart=1;
}
} //?
} //?
//talking
rfac=random(100);
if(rfac<45){
// mpos=random(130);
mpos=99+random(50);
delay(28+random(30));
}else{
//core bit
if(doclosemouth==1){
mpos=130;
}
}
int r=analogRead(5);
if(r<1000){
mpos=133;
talkmode=0;
}
}
if(talkmode==0){
mpos=130; // close mouth
}
if(talkmode>9){
//left/ right
myservo2.write(talkmode);
talkmode=oldtalkmode;
}
myservo.write(mpos);
}
1.1

No comments:
Post a Comment