Friday, January 9, 2009

Day One!

As Professor Mason would say "Hot diggity! Physics works!" Not that we didn't have any faith in physics, but it's nice when we get things to work. Like our blimp! First, how the day played out, then some pictures, and then what we need to figure out. There will eventually be video, however, I need to do some video editing before I can upload it.

Setting up the blimp took about an hour on its own. Helium had to be put in; unfortunately I put a little too much helium in and the blimp took off even with the board attached (which was about 80 grams) We added about another 15 grams to the back of the blimp and 10 to the front of the blimp, which balanced it out nicely.






We were able to attach the thrusters and chips to the middle of the blimp using a combination of styrofoam and Velcro. The styrofoam was used to put some space between the blimp and the rotor for the vector thruster
s





So, after plugging everything in, did it work? Well, we didn't have an RC receiver handy, so we booted it up in autonomous mode. Short answer is yes! it works great! Long answer: it works, but it got itself stuck in a corner and couldn't get out.

Allow me to explain. Upon booting it up, it did exactly as programmed. With the IR beacon off, it hovered about 4 feet off the ground, give or take. There was some slight drifting, but with the air conditioning on it was expected. We then placed the blimp about 8 feet away near the ceiling and activated the IR beacon about waist high on a table. The blimp servos went into self check and then proceeded forward...to the left, away from the receiver. When it was perpendicular to the receiver, it turned right, and head towards the beacon, but also towards the ceiling. It passed over the beacon and tried to turn itself around, and then got stuck in a corner.

After we did the test of the pre-installed BlimpDuino software, we tried to put in our own code. We hooked it up to my laptop and started the IDE and got a bunch of garbage on the serial monitor. We had hooked it up backwards...go figure. We first attempted to make the right motor spin and then turn off. Our code looked something like this

int rightmotor1 = 2;
int rightmotor2 = 3;
int leftmotor1 = 4;
int leftmotor2 = 5;

void setup() // run once, when the sketch starts
{
pinMode(rightmotor1, OUTPUT); // sets the digital pin as output
pinMode(rightmotor2, OUTPUT); // sets the digital pin as output
pinMode(rightmotor1, OUTPUT); // sets the digital pin as output
pinMode(rightmotor2, OUTPUT); // sets the digital pin as output
digitalWrite(rightmotor1, LOW); // Turns right motor off
digitalWrite(rightmotor2, LOW); // Turns right motor off
digitalWrite(leftmotor1, LOW); // turns left motor off
digitalWrite(leftmotor2, LOW); // turns left motor off
}

void loop() // run over and over again
{
digitalWrite(rightmotor1, HIGH); // sets the right motor on high speed
delay(1000); // waits for a second
digitalWrite(righttmotor1, LOW); // sets the right motor off
delay(100);//delays for 1/10 of a second
digitalWrite(righttmotor2,HIGH);//turns the right motor on but in the opposite direction
delay(1000); // waits for a second
digitalWrite(rightmotor1, LOW); // sets the right motor off
digitalWrite(rightmotor2, LOW); // sets the right motor off
digitalWrite(leftmotor1, LOW); // sets the left motor off
digitalWrite(leftmotor2, LOW); // sets the left motor off
delay(1000);
}

The code worked perfectly fine. At this point, to conserve the battery, we hooked it up to a 5v power regulator that was plugged in to the socket. The fans spun, but not very strongly. Then, we modified the code a little bit to alternate between the two.

int rightmotor1 = 2;
int rightmotor2 = 3;
int leftmotor1 = 4;
int leftmotor2 = 5;

void setup() // run once, when the sketch starts
{
pinMode(rightmotor1, OUTPUT); // sets the digital pin as output
pinMode(rightmotor2, OUTPUT); // sets the digital pin as output
pinMode(rightmotor1, OUTPUT); // sets the digital pin as output
pinMode(rightmotor2, OUTPUT); // sets the digital pin as output
digitalWrite(rightmotor1, LOW); // Turns right motor off
digitalWrite(rightmotor2, LOW); // Turns right motor off
digitalWrite(leftmotor1, LOW); // turns left motor off
digitalWrite(leftmotor2, LOW); // turns left motor off
}

void loop() // run over and over again
{
digitalWrite(rightmotor1, HIGH); // sets the right motor on high speed
delay(1000); // waits for a second
digitalWrite(rightmotor1, LOW); // sets the right motor off
delay(100);//delays for 1/10 of a second
digitalWrite(leftmotor1,HIGH);//turns the left motor on
delay(1000); // waits for a second
digitalWrite(rightmotor1, LOW); // sets the right motor off
digitalWrite(rightmotor2, LOW); // sets the right motor off
digitalWrite(leftmotor1, LOW); // sets the left motor off
digitalWrite(leftmotor2, LOW); // sets the left motor off
delay(1000);
}

Right motor turns on, and then silence. And more silence. then right motor turns on, and then silence. The left motor wasn't working for some reason. We noticed that the fans were spinning a little slow, so we thought maybe there wasn't enough current to power the board. So we switched out the 5v for a 12v and tried it again. Same results. We uploaded the original code to test it and it worked just fine. Vector servos fired off, then each of the fans tested themselves. So at this point, we've been pondering it until about 1730 and we called it a day.

So, things to think about until our next meeting.
- What is causing the right motor to spin correctly, but not the left?
- RC receiver: how to build and build
- I noticed that the blimp likes to bump into the ceiling a lot during autonomous mode. I know that the US sensor can detect how far from the ground it is, but is the blimp programmed to know how much top clearance it has?
- Other forms of navigation (I'm personally thinking visual recognition, but we'll see how far along in coding we get)

Notes
- The helium seems to leak at a rate much faster than a week. In about four hours the blimp went from stretch taut to a little squishy.
- Prof Mason, if you didn't get my email, I think I did not upload the autonomous software back in before I left for the day. Right now I think it will make right turns only. =\

**Edit: I just noticed as I was inspecting our code, we never specified pinmode(leftmotor1,output) in the void setup section. It reads as right and right for each. I wonder if that has something to do with it.....**

No comments:

Post a Comment