Shop our Airplanes Products Drone Products Sales
Thread Tools
Apr 20, 2009, 10:35 AM
Fpv flyer
Quote:
Originally Posted by Mikro
Karol, I just realized that you are using the Walkera sensor board. Another factor in the stability of your quad is how well you setup your analog input to take advantage of the analog output range of your sensors. Since the sensors I use have a max output of 3V, I wire the 3.3V output to my AREF pin.
So mikro what you suggest? I should change my ARef voltage? For now i have connected to Aref 3.3v
Sign up now
to remove ads between posts
Apr 20, 2009, 02:50 PM
Registered User
Quote:
Originally Posted by karol adam
So mikro what you suggest? I should change my ARef voltage? For now i have connected to Aref 3.3v
I remember looking at the 3.3V pin on the FT232RL chip, it is very noisy and it can't supply enough current, I suggest using a 3.3V regulator.
Apr 20, 2009, 04:15 PM
Registered User
RCvertt's Avatar
Quote:
Originally Posted by frank26080115
I remember looking at the 3.3V pin on the FT232RL chip, it is very noisy and it can't supply enough current, I suggest using a 3.3V regulator.
Thanks for the info.

I'm going to try this or this 3.3v regulator from Dimension Engineering. I'm assuming that one amp will be enough since it's only used for the Walkera sensor board? I haven't been able to find any other 3 or 3.3v switching regulator at this size or price. Please post if any one else has some other souces for similar switching regulators.



Quote:
Originally Posted by pipsqueak
...Using Mikro's excellent Mikroplot, visually I'm getting a better resolution and less noise via the external ADC, (with the op-amp buffered gyro signal)...
Sounds great.
If anyone is able to make a wiring diagram for how to set up this op-amp I would be much obliged.

Were you ever able to fly it without the op-amp mod?
Apr 20, 2009, 04:51 PM
Registered User
Quote:
Originally Posted by RCvertt
Thanks for the info.

I'm going to try this or this 3.3v regulator from Dimension Engineering. I'm assuming that one amp will be enough since it's only used for the Walkera sensor board? I haven't been able to find any other 3 or 3.3v switching regulator at this size or price. Please post if any one else has some other souces for similar switching regulators.
Why do you need a switching regulator? A linear LDO regulator should be just fine.
Save yourself the money, free sample TPS77833, in my experience, TI will get the shipment to your door within 3 days.
http://focus.ti.com/docs/prod/folder.../tps77833.html
Apr 21, 2009, 12:00 AM
Quad Crash Test Pilot
Mikro's Avatar
Quote:
Originally Posted by frank26080115
I remember looking at the 3.3V pin on the FT232RL chip, it is very noisy and it can't supply enough current, I suggest using a 3.3V regulator.
The 3.3V sourced from the FT232 comes from an integrated LDO regulator (http://www.ftdichip.com/Documents/Da...DS_FT232R.pdf). It can source 50mA of current, but I don't believe it matters. We are simply using it as a voltage reference for the ADC.

I've used the 3.3V pin as my AREF fine, BUT it's better to get it as close to the max analog input voltage used to take advantage of the 1024 bits of ADC, like what Pipsqueak is doing (or at least has future capability to do so).

Has anyone figured out why the VREF out from some sensors are half of the max output of the sensor? Do they assume we use an Op Amp with x2 gain to feed an ADC voltage reference?
Apr 21, 2009, 12:19 AM
Quad Crash Test Pilot
Mikro's Avatar
Quote:
Originally Posted by karol adam
So mikro what you suggest? I should change my ARef voltage? For now i have connected to Aref 3.3v
I dug up this post from Pipsqueak: https://www.rcgroups.com/forums/show...&postcount=918

It says he gets a max amplitude of 54 bits of ADC for his yaw gyro. If he sets his AREF to 3.3V and the ADC has 10 bits of resolution (2^10 = 1024), this means you get 3.3 / 1024 = 0.00322 or about 3 mV per ADC bit. So to measure the gyros only, you should set your AREF to 54 * 0.00322 = 0.174 or 174 mV.

Hmmm... that's very little voltage and is a good bet why you are having difficulty getting stable flight. For the Walkera setup, looks like you should amplify your gyro output like what Pipsqueak is doing with his op amp circuit. Maybe Pip has another alternative up his sleeve?
Apr 21, 2009, 12:29 AM
Registered User
RCvertt's Avatar
Dry beans!
Even my Plush10amp ESCs don't like me. I get the same random beeping and partial musical tones I got with the SuperSimple30aProgrammable ESCs The Quaduino gods must be angry with me.

On the plus side I'm certain it isn't a faulty ESC issue any more. All of the Plush10s work as they should if I plug them in and opperate them one at a time by them selves.

If I power my receiver with a standard 4.5v RX battery and power my Arduino with the FTDI breakout I can read the transmitter and walkera sensors just fine. As soon as I power it all with the flight battery, yes it's fully charged, I get no Joy.

Quote:
Originally Posted by frank26080115
Why do you need a switching regulator?...
I'm under the impression that a linear regulator like the one you mentioned is only about 65 percent efficient as apposed to the 85 percent efficiency posible with some switching regulators. I'm guessing it'll be a good idea to save as much battery juice as possible since my ultimate goal is to build a Quad Tilt Duino which will end up a bit heavier than the standard quadcopter. That is if I can ever get my ESCs to work.
Last edited by RCvertt; Apr 21, 2009 at 12:35 AM.
Apr 21, 2009, 01:15 AM
Quad Crash Test Pilot
Mikro's Avatar
Quote:
Originally Posted by RCvertt
Dry beans!
Even my Plush10amp ESCs don't like me. I get the same random beeping and partial musical tones I got with the SuperSimple30aProgrammable ESCs
Are you using the Arduino Duemilanove with 328P? The one I bought from Lady Ada boots up a bit slow and I noticed it sometimes causes my ESC's to not arm properly. My work around is to put in an automotive DC switch (I got a nice one that turns on an LED when switched on) between the the battery and ESC's. It's nice because I can plug my batteries in and it powers up the Ardunino. When I'm ready to really fly the quad, I flip the switch and the ESC's all arm properly. I haven't noticed this problem with the Mega.
Apr 21, 2009, 02:01 AM
Registered User
RCvertt's Avatar
Quote:
Originally Posted by Mikro
Are you using the Arduino Duemilanove with 328P? The one I bought from Lady Ada boots up a bit slow...
I'm still using the old ProMini3.3v

That info is going to come in handy though since I'm about to try setting up my Duemilanove 328p as I'm running out of things to try. I'm probably making this more difficult on myself messing with the ProMini Thanks again.

/////Edit

Going to try the Duemilanove now.
With everything powered by the flight pack, I tried the switch mod Mikro mentioned on my ProMini and the ESCs still act up. The Walkera board and Transmitter are being read correctly by the configurator though.

I'll also try to scope my RX to see if there is something different about the DX7se and AR6100 combination.
Last edited by RCvertt; Apr 22, 2009 at 12:21 AM.
Apr 21, 2009, 04:27 PM
Registered User
Quote:
Originally Posted by Mikro
I dug up this post from Pipsqueak: https://www.rcgroups.com/forums/show...&postcount=918

It says he gets a max amplitude of 54 bits of ADC for his yaw gyro. If he sets his AREF to 3.3V and the ADC has 10 bits of resolution (2^10 = 1024), this means you get 3.3 / 1024 = 0.00322 or about 3 mV per ADC bit. So to measure the gyros only, you should set your AREF to 54 * 0.00322 = 0.174 or 174 mV.
Looking back at that post - when I said max amplitude was 54 bits that didn't mean the yaw gyro output went from 0v to 0.174v, as there's the DC offset to take into account - (as the non-waggle DC output from each gyro pin was something like 2V).

That was for the simplest & cheapest possible setup - just an arduino clone, a walkera sensor board, and 2x 100nF capacitors to smooth the 5v and 3.3v supply into the sensor board - So no op amp, and only slightly tweaked MikroQuad Aero2.1 firmware.

This setup is what I was using for those flight test videos a few weeks ago - so even though it was quite tricky to fly, there was still a sufficiently good signal from the gyro direct into the arduino adc inputs to get reasonable flight.

I had to crank the P in the PID up quite high - something between -9 and -14 seemed to work Ok - again because the gyro signal is weaker (and in my case in the 'wrong' direction - hence negative) than what others typically get from a Sparkfun IMU gyro.

I've not yet flown my V2 - with the quad op amp to buffer and increase the gain (slightly) of the gyro signal, and the higher resolution ADC - it may be it's no better than the simple configuration - but I was keen to have a play with some different configurations.

However, for others out there using nothing more than an Arduino and Walkera board, my advice is to keep it simple for starters - use the Arduino's 3.3v as Aref, ensure you've got some capacitors to keep the 5v and 3.3v supply lines clean (I didn't use any special 3.3v regulators), and then follow Mikro's set up advice to tune the Quad - keep gradually increasing the P value (either +ve or -ve) until the it feels 'right' as you hold it in your hand - when it starts to oscillate, you've gone too far.

Once you've got the simple version in the air, you'll know you've got the basics Ok - and then can tweak the Aref, or use an Op Amp to make better use of the ADC's 10 bit range, and improve the signal-to-noise ratio.

Pip
Last edited by pipsqueak; Apr 22, 2009 at 01:41 AM.
Apr 22, 2009, 12:18 AM
Registered User

2nd order comp filter - finally


Mikro,

Here is the code for the second order implementation of the complementary filter, as promised long ago :=(

The reason it took me so long is because I was trying to figure out the best way to handle the inconvenient truth that Fredjikrang discovered - that the accelerometers only register in the z-axis in flight (other than drag and other relatively small forces). I think the way to handle this is to have a three dimensional solution (direction cosine matrix, quaternions, etc. See http://diydrones.com/forum/topics/ro...timator-of-the for more details). But I haven't worked through the math sufficiently yet (the blog I linked to describes a fixed-wing UAV, so the code may not work for a quad. The Mahoney paper he refers to I believe does work for a quad).

So here's the compromise I've come up with for now. The filter itself has been simulated, but the 3D accelerometer stuff has not. Use at your own risk. The code snippet assumes the accelerometer bias has been taken care of. On the ground at power-up, we know the accelerometer can be used as an inclinometer, and we know the gyro rate should be zero, so whatever we are reading from the gyro is just bias. The first integrator of the filter can take care of this automatically (another advantage of the second order). In flight, as long as the quad is not maneuvering too aggressively, then we use the nominal filter. If it is doing loops and spins, then we want to ignore the accelerometer (that is set the accel input equal to the filter output so it doesn't perturb the results). Due to the nature of the complementary filer, and the fact that the quad can't spend too much time out of 1-g level flight, I think this scheme will work.

This calculation must be repeated for the y axis

Code:
///////////////////////
// constants or parameters:
// k - bandwidth of filter (1/sec). Need to tune this to match sensor performance.
// T - iteration rate of the filter (sec)
///////////////////////
// variables:
// int_x1 - input to the first integrator (deg/sec/sec)
// int_x2 - input to the second integrator (deg/sec)
// int_y1 - output of the first integrator (deg/sec). This needs to be saved each iteration
//////////////////////
// inputs:
// gyro - gyro output (deg/sec)
// accel - accelerometer input to filter (deg)
// x_accel - accelerometer output in x-axis (g)
// z_accel - accelerometer output in z-axis (g)
// accel_ang - derived angle based on arctan(x_accel,z_accel), (deg)
//////////////////////
// outputs:
// filter - complementary filter output (and output of second integrator), (deg)
//            This also needs to be saved each iteration.

///////////////////////
// initialization (when on ground after initial power-up)
filter = accel;
int_y1 = -gyro;//account for gyro bias
///////////////////////


///////////////////////
// while flying - do this every iteration through the control loop

// if quad is in free-fall, or if attitude is too large, accel can't be used to determine angle
//	so just integrate the gyro in this case. Actual numbers are just guesses at this point
if (z_accel < 0.5 || filter > 30 || filter < 30.)
	accel = filter;
else
	accel = atan(x_accel,z_accel);
endif;

// here's the filter itself
int_x1 = (accel - filter)*k*k;
int_y1 = T*(int_x1) + int_y1;
int_x2 = int_y1 + (accel - filter)*2*k + gyro;
filter = T*(int_x2) + filter;
// repeat for the other axis (pitch & roll)
The first page of the attached PDF file shows a diagram of the continuous time version of the filter which is discretized in the code above. The second shows how close the filter is to the truth data, despite how noisy the inputs are. The last page shows that the second order filter is less noisy than the first order one. The setup is basically the same as the one shown in this post (which shows the details of the first order filter):

https://www.rcgroups.com/forums/show...9#post11643539

In the figures here I used:
k = 1.1 (1/sec)
T = 0.02 (sec) (= 50Hz)

Hope this makes sense to somebody :-)

- Roy
Last edited by RoyLB; Apr 25, 2009 at 08:44 AM.
Apr 22, 2009, 01:59 AM
Quad Crash Test Pilot
Mikro's Avatar
Quote:
Originally Posted by RoyLB
Here is the code for the second order implementation of the complementary filter, as promised long ago :=(
Excellent! Actually the timing is impeccable as I'm basically ready to release my new AeroQuad v1.0 code and can start focusing on flight algorithm improvement. Some of the new software features I've put in is to segment the transmitter code, filter code, and control law code into separate sketches. The idea is that I can swap out my existing complementary filter code for something like yours for experimentation. Also, I've put in separate PID loops for roll/pitch/yaw. The Configurator has grown accordingly.

I still have auto leveling and user defined receiver channel order as "experimental". I'll just work those as I go into the future.

Another improvement I've made to my quad is to locate sensors that take better advantage of the A/D range I'm using (3.3V for AREF). I've seen a very nice improvement in the absolute roll/pitch angles reported from the current complementary filter.

Thanks also for the analysis, I'll read through and ask questions as I go!
Apr 22, 2009, 12:36 PM
Registered User
Mikro,

Quote:
Originally Posted by Mikro
So a question to pose to the group. My next objective is to integrate GPS and further pursue autoleveling and explore different control algorithms like integral backstepping. Would you guys think it's better to start a new thread, as I think I'm exceeding the original bounds of this thread?
My suggestion is you start a new thread, if not more than one. It would be nice to have the first post be a guide to all the components and discussions of the Mikro/Aero Quad(*-duino, sensors, frame, video, etc), ala Old Man Mike (as others have suggested). Of course, if you do this, I would hope you'd at least check in here from time to time, as your help has been invaluable to a good number of folks here. I might also suggest you open a new thread for advanced control discussions, integral backstepping, Kalman filtering, and the like. I think it may help to keep things better organized and focused. Just my $0.02

- Roy
Apr 23, 2009, 11:11 AM
Fpv flyer
whose of this bluetooth modules should be OK to my arduino ??
http://www.tme.eu/en/katalog/?&searc...ch%3DBluetooth
regars
Apr 23, 2009, 04:41 PM
Registered User
hello everyone, i have recently changed over my TowerPro 2410-09 brushless motors for 2410-09 with mount, and now when i power on the quad the ESCs just keep beeping.

I have checked all wiring, and also checked ESC settings, I have also configured full throttle. All motors seem to work fine when connected alone to the throttle channel but when connected through the Ardunio it begins to beep in very quick intervals not normal beeps, and wont stop until disconnected.

Any ideas?
Last edited by quaddy; Apr 23, 2009 at 05:32 PM.


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Build Log New Project - YF-23 GlasairAllen Electric Ducted Fan Jet Talk 525 Dec 13, 2008 10:59 AM
New project DBlum Parkflyers 42 Feb 27, 2004 11:43 PM
Idea blue foam new project reznikvova Parkflyers 4 Jan 23, 2002 07:34 PM
new project from foam please look reznikvova Foamies (Kits) 3 Dec 21, 2001 05:29 PM
New Project Flys! Dr. Jet Sport Planes 9 Sep 20, 2001 06:09 PM