Jump to content

Building a new quad (& arduino based car)


sud0nick
 Share

Recommended Posts

You may remember my last project where I upgraded a few components on my DJI FlameWheel F450. I didn't really know a whole lot about multirotors then as I simply bought pieces to a very common build and followed a video to put them together. Now, after much research, I have a little more knowledge about how all of the components work. For my next build I've decided to go with the HK Alien 560 frame as I want something I can fold up and easily place in a bag. The components I will use are:

APM 2.6+ Autopilot

3DR uBlox GPS with Compass

RX701 7CH Receiver

HK Alien 560 Carbon Fiber Folding

Afro ESC 30A x4

Turnigy Multistar 2814-700kV motors x4

I still don't know which props I will use. I was hoping to use my extra set of Graupner 10x5 eprops but this frame requires 11"-12" props. So far I have purchased the frame, ESCs, and 7CH receiver. Since I have no use for the receiver yet I figured I would use it in another project.

One of my buddies recently bought a small chassis and SainSmart motor shield to build a car that could be controlled through his Arduino Uno. All of my Arduino experience in the past has been on the networking and LED side as you guys may remember this messaging project. So I figured I could learn something about controlling motors with Arduino and helped him build it. After seeing how simple it was I bought my own kit and figured I would try to get it to work with my DEVO7 and the new receiver for my HK Alien 560. This morning I got it to work but it can only use one channel from the transmitter because the motor shield uses digital pin 3 for motor 2. Digital pins 2 and 3 are the only hardware interrupts on the Uno which are used for receiving signals from different channels. I used the following library to receive input from the TX/RX (https://github.com/helscream/RC_Rx_Arduino_Mega/tree/master/RC_Rx_header_example). This library was developed for the Mega which has 6 hardware interrupt pins. I've been thinking about building an incredibly crude quadcopter with an Arduino and now I realize the Mega is the only way to do this properly because you need at least 4 channels for full control (pitch, roll, yaw, throttle).

Oh yeah, for power I'm using my Pineapple Juice 6800, lol. The kit came with a 4 AA battery holder but that only provides 6V causing the car to move way too slow. Once I added the 12V Pineapple Juice pack it started running a lot faster.

Anyway here is my code using the rc_rx and AFMotor libraries:

#include <AFMotor.h>
#include <rc_rx.h>

#define dt 20         // [ms] Task time 

AF_DCMotor motor1(1, MOTOR12_64KHZ);
AF_DCMotor motor2(2, MOTOR12_64KHZ);
AF_DCMotor motor3(3, MOTOR34_64KHZ);
AF_DCMotor motor4(4, MOTOR34_64KHZ);
unsigned long t=0;

void setup()
{
  Serial.begin(115200);
  motor1.setSpeed(255);
  motor2.setSpeed(255);
  motor3.setSpeed(255);
  motor4.setSpeed(255);
  init_rc_rx();
}

void loop()
{ 
  t = micros()/1000;
  read_rc_rx();
  
  Serial.println(CH1);
  //Serial.println(((micros()/1000)- (float)t)*100/dt);
  
  if (CH1 > 52) {
       motor1.run(FORWARD);
       motor2.run(FORWARD);
       motor3.run(FORWARD);
       motor4.run(FORWARD);
    } else if (CH1 < 50) {
       motor1.run(BACKWARD);
       motor2.run(BACKWARD);
       motor3.run(BACKWARD);
       motor4.run(BACKWARD);
    } else {
       motor1.run(RELEASE);
       motor2.run(RELEASE);
       motor3.run(RELEASE);
       motor4.run(RELEASE);
    }
  
  while (dt > (micros()/1000)- t){
    // do nothing
  }
}

And here is a video:

I'll make sure to keep this thread updated as I move forward with my HK Alien 560 build.

Edited by sud0nick
Link to comment
Share on other sites

I was able to steal from digital pin 3 when motor 2 is not in use to add an additional channel. Now I can turn the car while moving forward or backward. It isn't perfect since I can't use motor 2 I can only use motors 1 and 4 for turning. So right turns are natural because 1 and 4 are moving forward but left turns are not as the two are moving backward. I think it's the best that can be done with only 2 hardware interrupts. Here is the new code and video:

#include <AFMotor.h>
#include <rc_rx.h>

#define dt 20         // [ms] Task time 

AF_DCMotor motor1(1, MOTOR12_64KHZ);
AF_DCMotor motor2(2, MOTOR12_64KHZ);
AF_DCMotor motor3(3, MOTOR34_64KHZ);
AF_DCMotor motor4(4, MOTOR34_64KHZ);
unsigned long t=0;

void setup()
{
  Serial.begin(115200);
  motor1.setSpeed(255);
  motor2.setSpeed(255);
  motor3.setSpeed(255);
  motor4.setSpeed(255);
  init_rc_rx();
}

void loop()
{ 
  t = micros()/1000;
  read_rc_rx();
  
  //Serial.print(CH1);
  //Serial.print("\t");
  //Serial.println(CH2);
  //Serial.println(((micros()/1000)- (float)t)*100/dt);

  if (CH1 > 52) {
       motor1.run(FORWARD);
       motor2.run(FORWARD);
       motor3.run(FORWARD);
       motor4.run(FORWARD);
    } else if (CH1 < 50) {
       motor1.run(BACKWARD);
       motor2.run(BACKWARD);
       motor3.run(BACKWARD);
       motor4.run(BACKWARD);
    } else {
       motor1.run(RELEASE);
       motor2.run(RELEASE);
       motor3.run(RELEASE);
       motor4.run(RELEASE);
    }
    if (CH2 > 52) {
       motor1.run(BACKWARD);
       motor4.run(BACKWARD);
    } else if (CH2 < 50) {
       motor1.run(FORWARD);
       motor4.run(FORWARD);
    }
  while (dt > (micros()/1000)- t){
    // do nothing
  }
}

Link to comment
Share on other sites

  • 5 months later...

Wow it's been almost 6 months since I posted in here last. I did end up finishing my Alien 560 build and here are some pics.

Qt9OWKyh.jpg

yRuYs1yh.jpg

m8WDgAxh.jpg

Ao4mo5Ph.jpg

CgkyVEih.jpg

I ended up going with a few different parts than I listed in the first post. Instead of the APM 2.6 flight controller I went with a Pixhawk since it will continue to be supported in the future. I also went with some Turnigy 3508-700kV motors instead of the 2814's. I have flown it a little bit and I have to say I love the Pixhawk, however I am still having a bit of a yaw issue. Most of the time when I fly it wants to spin to the right which throws off all other maneuvers. I haven't been able to figure out the problem yet but the reason I say that I love the Pixhawk is because of it's logging features and the ability to customize it. Every bit of information you could possibly want from the quad is logged every time you fly. You can even project your flight information over a Google Map and see the path your quad took. The most useful logs I've found so far are the desired yaw vs the actual yaw. This helped me determine if my transmitter was too heavily trimmed thus causing the spinning problem.

Here is the final list of parts I used for this build:

3DR Pixhawk

3DR uBlox GPS with Compass

RX701 7CH Receiver

HK Alien 560 Carbon Fiber Folding Frame

Afro ESC 30A x4

Turnigy Multistar 3508-700kV motors

Graupner 10x5 e-props

LOGO 500 Landing Gear

The landing gear is actually off of a LOGO 500 helicopter but happens to fit this frame perfectly. It makes for a great set of low profile landing legs that are much stronger than the tall and cheap legs that come with the frame. As much as I love the look of the frame, and its ability to fold, I probably wouldn't buy it again. The main problem I have with it is there are too many screws of different sizes that I could probably never find at a hardware store. The screws that were made to secure the arms to their joint weren't big enough to eliminate some play in the arms (initially what I thought was causing the yaw problem). Luckily, the screws I bought for the landing gear happened to be the perfect size for the arms and made them fit tightly in the joint. Every time you need to open the frame to fix something inside you have to remove every single screw from the top of the frame. It wouldn't be a big deal, besides being annoying, except that the screws strip pretty easily. Since I can't find the same size screws to replace them I have a handful of stripped screws holding my frame together. It would be nice if HK would provide sets of replacement parts and screws for this frame.

Overall I'm pretty happy with this build. Once I figure out the yaw issue I'll post the fix here. I think my next, and possibly final build, will be a QAV250 so I can have a nice acro quad to play with and crash.

Link to comment
Share on other sites

After my last post this morning I took my Alien 560 out for another test flight/hover to see if I could solve the yaw problem and miraculously it didn't spin. It still turned slightly to the right every now and then so I used the "Save Trim" feature and that seemed to fix it. Still not convinced it was completely fixed I decided to go out to an open field near my house and take this thing on a real test flight. Much to my surprise it flew exceptionally well. It was very smooth and had more power than I thought. A couple of people were driving by and decided to stop to watch me fly. I changed out the battery and put her back up in the air for a few minutes until a prop broke mid-flight! :ohmy: My new quad came tumbling down and hit the ground hard enough to split one of the motor mounts in half! Not only that but the lipo battery was damaged and swollen rendering it useless. So, I brought her home, cleaned her up, and tested all of the components. Luckily, everything still works perfectly. Since HK doesn't sell spare parts for the frame I had to order a whole new Alien 560 frame. At least now I will have spare parts for the future. I also ordered two new sets of props that are 12x4.7 CF so my quad won't be so susceptible to wobbling. Finally I ordered a 4S 5000mah battery to replace my destroyed 3S 5000mah one. This will be my first time flying 4S so hopefully all goes well. Anyway, here are some pictures post-crash.

bbP7otLh.jpg

pmK9iXUh.jpg

TAJYhW0h.jpg

FzXkmqVh.jpg

Link to comment
Share on other sites

It does suck. Mine was about 50ft in the air when it happened. I'm just glad there wasn't more damage.

Looking at my video, I was higher than 20 feet. Thought it was lower. Pretty much all the damage was the prop. I don't think it even bent any of the frame! Skip to 4:20, for some reason the forum software won't take the time offset in the link.

Edited by barry99705
Link to comment
Share on other sites

At least yours didn't start tumbling in the air. Mine did and I have the FC and GPS mounted on top. It hit the ground upside down and I was worried I would have to shell out another $300 for a new set. Hopefully I'll get my new parts in the next couple of days and have her flying again soon.

What kind of quad were you flying in that video? Were you using a gimbal with your camera?

Link to comment
Share on other sites

At least yours didn't start tumbling in the air. Mine did and I have the FC and GPS mounted on top. It hit the ground upside down and I was worried I would have to shell out another $300 for a new set. Hopefully I'll get my new parts in the next couple of days and have her flying again soon.

What kind of quad were you flying in that video? Were you using a gimbal with your camera?

Hahahahahaha!! Gimble, that's funny.... No, it was an UAir(failed kickstarter drone) with a Motorola Atrix hanging off the bottom by some velcro straps! The phone is in a Ballistic HC case.

I'm currently backing this one. Hopefully they don't flake out like the last one I backed did. I don't think they will though. Most of the parts are off the shelf components, so it should be alright.

Edited by barry99705
Link to comment
Share on other sites

I'm not into drones by any stretch of the imagination, but that Sprite thing looks pretty amazing.

I really love how they completely rethought the concept of a drone, ending up with what looks like a surprisingly sturdy design that might not be as manoeuvrable, but sufficiently so for 90% of people who like to fly these things.

Link to comment
Share on other sites

I'm not into drones by any stretch of the imagination, but that Sprite thing looks pretty amazing.

I really love how they completely rethought the concept of a drone, ending up with what looks like a surprisingly sturdy design that might not be as manoeuvrable, but sufficiently so for 90% of people who like to fly these things.

Yea, they put out a weekly progress report to the backers. They've got it 90% to their liking, just have to redesign the camera module for the bottom. The decided to go with the gopro as the standard camera they will all come with, so the original housing is too small. After that they're going to ship a half dozen to some beta testers to shake out any bugs that haven't been found yet.

Link to comment
Share on other sites

  • 3 weeks later...

I took the Alien out to fly a little today. Still flying ultra-conservative and really low to get a good feel for everything and it flew better than ever before. It was like a dream. The only problem I'm having now is the props are coming loose every now and then because the adapters aren't self tightening. For this reason I bought self-tightening adapters for my motors before I even built the quad but they don't fit even though they were advertised to fit. I won't feel comfortable flying any higher or faster until I find some self tightening prop adapters.

Edited by sud0nick
Link to comment
Share on other sites

That's a good idea. I'll have to get some and see how it goes.

Edit:

So I got some nylock nuts and they work great. I feel like it's more difficult to put them on and take them off because I have to use a wrench but they definitely keep the props on. The quad is flying well and I'm currently looking for a large open field to fly in so I can really test this thing. My next build will be a small quad for acro but I'm not sure what parts I will use yet. I want to keep it under 250g for obvious reasons :happy:.

Edited by sud0nick
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...