Wednesday 16 April 2014

The Window is finished! (Well, kinda)

On Friday night of last week, I came home to a nice box of goodies sitting on the table, my KK2.1.5 board, some connectors and a small prop balance stand, and after working a little bit on Saturday, Sunday and Monday, I ended up with a functioning octocopter. Here are a couple of pictures of it complete:
 Upside down:
 A closeup of the center:
 And a closeup of the camera mount:
I soldered up a big nasty wiring harness out of 14 gauge wire running up the arms to supply power to the two motors per arm, and some 12 gauge wire running to two XT60 connecters each to allow for a total of 4 batteries to be plugged in at any time. I mounted the electronics and batteries in an old Tupperware container which is screwed to the middle of the frame and which has a bunch of holes drilled thru it for running all the wires, and I mounted the KK board in its foam packaging as recommended by the hobbyking manual; this serves to protect the board, and isolate it from vibrations transfered thru the frame. I also had to extend the ESC wires using a bunch of extentions, splitters and ugly hacking, but it all connects up and works well. As you can see, at the moment I only have two batteries mounted, owing to the fact that I only have 3 un-bulgy LiPo batteries that I trust not to catch fire or explode, but there is room for two more in the container, I only need to drill some more holes for the wires to exit. To fly properly, this thing actually needs four 20C 2.2Ah batteries, not the two that I am currently running because each motor can draw a maximum of 18A of current, and I have 8 of them, roughly equaling 160A total current draw with all the motors maxed out, and right now with my two batteries, they can only deliver 2.2Ah times 20C, a little over 80A of current. Nonetheless, it still does fly, but the flight time is a disapointing 5 or so minutes, and I am not getting full lift (which I calculated to be 9kg with the motors running full out) While I am on the subject of lift and weight, the copter with no batteries weighs approximately 2.6kg, and four of the batteries I am using weigh together about .7kg, so once I get enough to actually fly with 4, the total weight of the octocopter will be less than 3.5kg, leaving quite a bit of payload capacity.
The camera is an Oregon Scientific "ATC mini" action cam that I got on amazon.com for $40; I used its "tripod adapter"mount and threaded a 1/4in bolt thru some pipe and a tee with half cut off, hose clamped to the frame as a mount. Its simple and sturdy, but transfers a lot of vibration to the camera, and that makes the footage, well, less than perfect. Lastly, I used some red, green, and black electrical tape to indicate orientation, the black stripes is the back side, green is right (starboard) and red is left (port). I have not yet played with the PI values that are tuneable on the KK board, and so while usable, the octocopter is not quite as stable as it should be. Still, the fact that it flies pretty good with stock settings is pretty awesome. I expect it to get much more stable when I properly tweak the PI settings and perhaps the altitude dampining.

So on to what everyone really cares about, the videos of it in action! The first two are good if you get bored quickly, they are short and you see it reletavely close up and doing cool stuff. The middle two are if you want to see a bit of a longer video, and were actually taken first, but they get a little boring. The last two are also slightly boring, they are the footage shot by the ATC mini mounted on the octocopter. Enjoy.
So that is all for now, next up will be getting some more batteries so it can actually get some decent flight time, and an underslung pan/tilt bracket for the camera with some landing gear to keep it out of the ground, and video feed back to the ground as well as a seperate tx/rx combo for someone else to film while I fly, and perhaps after that, AN AIRBORNE PAINTBALL GUN! awwwww yeahhhhhhh. A project is never really finished, but at least the beginning is finished :)

Tuesday 8 April 2014

PKP (it's alive again)

In my last post about PK, I had completed the motor controller, but had not yet tested it, so I started off by getting out my UNO and writing some test control code for the motor controller:
I got the code all written up, and gave it a test with two multimeters hooked up to the outputs (Unfortunately this video is really dark, it looked lighter when I was taking it)
And hooked it all up and gave it a try (The motor directions are reversed in this video, I fixed that shortly after)
The code running on the UNO during all of these videos is as follows:

#define in1 3
#define pwm1 9
#define f1 5
#define b1 7
#define in2 4
#define pwm2 10
#define f2 6
#define b2 8
void setup()
{
  // Channel 1:
  pinMode(in1,INPUT);
  pinMode(pwm1,OUTPUT);
  pinMode(f1,OUTPUT);
  pinMode(b1,OUTPUT);
  // Channel 2:
  pinMode(in2,INPUT);
  pinMode(pwm2,OUTPUT);
  pinMode(f2,OUTPUT);
  pinMode(b2,OUTPUT);
  Serial.begin(9600);
}

void loop()
{
 int p1=pulseIn(in1,HIGH);
 int p2=pulseIn(in2,HIGH);
 int p3=p1+p2-1500;
 int p4=p1-p2+1500;
 p1 = constrain(p3, 1200, 1800);
 p2 = constrain(p4, 1200, 1800);
//============= Channel 1 =============
 if(p1 > 1530)
 {
   int s1=map(p1, 1530, 1800, 255, 0);
   analogWrite(pwm1,s1);
   digitalWrite(b1,LOW);
   digitalWrite(f1,HIGH);
 }
 else if(p1 < 1470)
 {
  int s1=map(p1, 1470, 1200, 255, 0);
  analogWrite(pwm1,s1);
  digitalWrite(f1,LOW);
  digitalWrite(b1,HIGH);
 }
 else
 {
  analogWrite(pwm1,255);
  digitalWrite(b1,LOW);
  digitalWrite(f1,LOW);
 }
//============ Channel 2 ==============
 if(p2 > 1530)
 {
   int s2=map(p2, 1530, 1800, 255, 0);
   analogWrite(pwm2,s2);
   digitalWrite(b2,LOW);
   digitalWrite(f2,HIGH);
 }
 else if(p2 < 1470)
 {
  int s2=map(p2, 1470, 1200, 255, 0);
  analogWrite(pwm2,s2);
  digitalWrite(f2,LOW);
  digitalWrite(b2,HIGH);
 }
 else
 {
  analogWrite(pwm2,255);
  digitalWrite(b2,LOW);
  digitalWrite(f2,LOW);
 }
//====================================
delay(15);
}

For my actual outdoor run, in order to get some footage, I made up a quick little camera bracket for my transmitter, I call it the "forever alone camera mount"


And I also made a little mount for my action cam to mount on PK in place of the paintball gun, since I do not yet have the necessary parts to make it opperational yet.
And with all that set up and working, I went out and drove it around my driveway for a bit (woohoo, my first legitimate run :)) The first video is me filming, and the second is from PK's camera
Well, it works. After I finished driving it around, I stuck it in an outdoor shead, here are a couple op pics of the various parts, and the whole thing as it sits:
Motor controller:
 Arduino:
 The whole backside:
 And from the front,
 Top,
 And side:
Anyway, it runs, which brings a smile to my face :) Onward and upward!!