Show Posts
Pages: 1 ... 5 6 [7] 8 9 ... 18
91  Community / Exhibition / Gallery / Re: Phobos - gameboy style hand held game on: October 05, 2013, 04:39:44 am
Great work mate! Looking good with the red'ish design smiley! I had a similar idea once upon a time (not the game, but the actual method of using the PC to code/debug a whole game and then just simply port over the code by copy, pasting and filling in the gaps of course)! You didn't post your code, so I'm going have to bother you with a couple of questions =P! How will this run on an UNO? Will it fit and how will the performance be?

92  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: October 05, 2013, 04:00:15 am
About your old method of rate-PID tuning:
What is your speed setpoint/reference ? I guess 0 deg/s and before your have manually put your quad at 0 deg for roll and pitch angle?

I have trouble understanding what you mean.. But I'll give it a shot.. When the quadcopter is in rate-mode, the set-point is determined by the RC-reciever.. Meaning you change the setpoint directly with the transmitter/Remote control.. For example, if you roll left then the setpoint will be something <0deg/s (negative angular rate), and the opposite if you roll right, >0deg/s (positive angular rate)..

If you're in angle mode, the reciever controls the setpoint of the angle-PID, and the angle-PID will in turn decide the setpoint for the rate-PID...

I know well Matlab and I have got it on my laptop. (My dream would have been to use Simulink  smiley). Anyway what do you do with your Matlab script? Transfer function?

Simulink is slow and not optimal for something you run and optimize in real time.. Sure, you got the Real-Time toolbox, but if you ask me it sucks!

No it's not transfer functions, that would be optimal in-case i modeled the system.. But instead I did the following:

Arduino side: Wrote a whole new sketch that only handles inputs, outputs and gyro, acc calculations.. Meaning all the PID calculations are done in matlab..

Matlab side: I implemented some known PID tuning methods, like Ziegler-Nichols, SIMC, IMC etc.. They are easy to calculate.. It was just a matter of iterating and testing the results I got from the different methods..  The method that gave the best result for my quad. was the SIMC.. Still the results were not perfect, but it got me pretty close to something acceptable.. I know your going to ask why it didn't give me the optimal magical numbers =P! The reason is lag/delay in the system.. Matlab runs fast, a little too fast for the Serial-communication on the arduino.. So by the time arduino sends the data, the quadcopter would have changed its state drastically (not for the human eye maybe, but you can see it if you look at the data).. This kind of lag/delay can lead to early oscillations in the PID-tuning..

The optimal way to run this type of tuning is on the arduino itself.. So maybe write a PID optimizer for the arduino??

93  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: October 04, 2013, 05:16:05 pm
Thanks for the nice explanation!

Still one question though:
You have to tune the rate-PID before the angle-PID
I agree with this but how do you practically tune it? I mean with the angle-PID, it's easy to tune,  you can look at the angles values or even look at your quad to see if it's stable but with the rate-PID, I have no idea how to tune it.

ya, I get what you're saying.. The method I'm using today is pretty advanced and requires some expensive software.. I basically made a Matlab script that sends data back and forth to the quadcopter and optimize the PID values..  Before that I did it by hand, this is my old method:

1 ) Put the quadcopter in rate mode
2 ) Increase the throttle until the quadcopter starts to hover on its own..
3 ) Increase the P-term until you observe oscillations..  Now subtract 10% of the value and set it as your P-term ..
4 ) Increase the D-term until you observe oscillations..  Now subtract 10-20% of the value (this is your D-term now)..
5 ) Now go back and increase the P-term with small steps until you observe oscillations.. Then subtract a couple of steps..
6 ) Increase the I-term until you observe oscillations.. These oscillations will have a lower frequency, so step up the I-term slowly.. And be careful when it starts to oscillate.. Because the P- and D-term will kick in, and increase the frequency of the oscillations.. So be careful! After that, substract approx. 10-15% of the value...
7 ) If you are satisfied with the results, then go out and take it for a spin, and observe how it flies and reacts to the wind etc.. Then go back and fine tune your copter if you observed any types of oscillations/control problems..
8 ) Buy me a beer!!!!!  smiley

94  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: October 01, 2013, 02:11:59 pm
So I looked at your code, and if I think right you have got 2 modes (depending on the value of rateAngleSwitch).
One mode is a position control loop.
The other one is a rate control loop.

That is correct my friend =)!

Which mode is the easiest to tune for a first time?

Now this question made me sad.. Because it means that you didn't read through my code correctly.. Let me explain how my closed-loop works..
I got 2 loops, yes, one is as you called it position loop (angle loop) and the other one is the rate loop.. But I like to also call them the slow/outer loop (angle) and the fast/inner loop (rate)..
I just drew a "map" in paint (MsPaint > PhotoShop =P) to make the process clear.. As you can see in the map, PID-rate is part of the inner loop which in turn controls the motors directly.. The reason for this is because of the update rate (400Hz) which is close to the motors PWM refresh rate (~480 to 500Hz)..
The PID-angle is part of the outer loop (because it's slow approx. 50Hz), which corresponds to the receiver refresh rate which in fact is 50Hz also! So PID-angle is like an auto-pilot for the position of the copter.. So to answer your question: You have to tune the rate-PID before the angle-PID!.. If the rate-PID isn't stable you won't get a stable copter with the angle-PID!

Note: I didn't read or see your code (something wrong with github, keep getting errors when I try to open your files).. My answer above assumes that you have one inner loop and one outer loop! Two separate inner loops will only lead to a slow response from the quadcopter which in turn will lead to bad PID values, which in turn will make the quadcopter uncontrollable in harsh environments!
How did you actually do your tuning? Did you put your quad on some sort of ball joint ? Or did you hold it in your hand ?

A ball joint would be the safest way.. But because I don't have a ball joint, I used a FAN-stand, like the one on this:  And tied the copter to the stand top.. When I got the copter pretty stable, I took it out of the stand and held it in my hand during fine tuning (DON'T RECOMMEND THIS, I still got a bunch of scars all over my arms!)


95  International / Scandinavia / Re: Easy Arduino project preferable in Stockholm on: September 30, 2013, 12:40:22 am
Im trying to make a arduino-project for controlling a timer and a scoreboard for different type of sports.
Im interested in finding a person in Stockholm, Sweden.
My contact info :
Gunnar Petersen Jr -
0735 366 000


Låter intressant.. Snackar vi om en anställning eller vägledning? Om det är vägledning det handlar om så går det bra att presentera vad du har gjort eller planerar att göra så kan vi hjälpa dig så gott vi kan!

96  International / Scandinavia / Re: World Maker Faire on: September 24, 2013, 02:45:38 pm
Reste du?

Jag åker til Rom for den Euro-version.

Nej, blev tyvärr ingen resa.. Låter hur najs som helst.. Har du redan bokat? I så fall vart reser du ifrån och hur länge hade du tänkt stanna..?
97  Using Arduino / Microcontrollers / Re: Attiny2313 minimum and maximum voltage? on: September 19, 2013, 05:28:38 am

Whats the minimum voltage for attiny 2313?  I read in the datasheet it can go as low as 2.7v.. But how come when i use 3v power supply it doesnt work?

What's the clock frequency, 1Mhz, 8Mhz.. etc..??? Can you post a schematic of how you connected everything maybe?? Would be a lot easier to help..
Also how can i use 4 aa battery as the supply power? It doesnt seem to work too.. I guess, beacuse 4 aa battery is 6v while the maximum voltage is 5.5v?
Well, why not use 3 AA batteries (~4.5V)??  Anyway, to be able to drop 6V to 5V you need a low dropout regulator.. Here is an example:

98  Using Arduino / Microcontrollers / Re: Newbie here, hoping for some help with a standalone ATMEGA328. on: September 18, 2013, 07:50:24 am
Put a 10K resistor between VCC and reset and try again..
99  Using Arduino / Microcontrollers / Re: Differance between Sparkfun Arduino Pro Micro and Arduino Micro (Serial Ports) on: September 18, 2013, 03:21:46 am
Since the arduino pro micro is smaller (no pins) i would like to use it but i need 2 serial ports and so i would like to know if it is capable of connecting to an XBee through RX TX and computer through USB for serial communication,

Yes, it can! You have TX, RX and USB broken out.. The rest is only software =)..

100  International / Scandinavia / World Maker Faire on: September 17, 2013, 03:20:28 pm
Tjenare! Jag undrar ifall det finns någon som skall/sugen på att åka till World Maker Faire i New York?? Själv är jag väldigt sugen på att åka dit men har tyvärr inga kompisar som delar mitt intresse.. World Maker Faire börjar den 21-22 sep och biljetten kostar 40 dollar.. Om någon kan tänka sig haka på så säg till så fort som möjligt!

101  Community / Exhibition / Gallery / Re: Arduino Laser Target Game on: September 16, 2013, 08:07:12 am
Good job.. it looks like fun..!! smiley
102  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: September 15, 2013, 05:33:24 am
For those following this:  I've updated the code.. Made the sketch run more efficiently and reduced code size.. With this change I managed to find better PID values and thus get better/faster stabilization.. For those interested I've added pictures of the main board and hardware setup (see first post)..
103  Using Arduino / LEDs and Multiplexing / Re: Control Led Strip (not-RGB) on: September 11, 2013, 04:14:46 pm
You can't.. These strips don't have any control chip on them.. It's just a bunch of leds connected in parallel..
104  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: September 08, 2013, 02:30:17 pm
yummmyyyyyy it seem work fine in the scope .... its late here and i cant start esc's bbeeping in home smiley-grin tomorrow morning i will test it ..... if it works fine i will start study arduino tommorow hardly .... .... <3 <3

Glad to hear that.. Alright! Good luck with your project =)

105  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: September 08, 2013, 01:39:51 pm
i tired your code this happend .... befor i connect receiver to pin1(tx) it has signal and after i connect signal it has change unormally and brushless motor dont work

i upload video of process ...
befor and after i connect receiver to arduino uno

Looking at the video I see that the duty cycle is changing from zero to 100%.. That means that it was hooked right the first time..
Did you read what I wrote in the previous post? Why did you connect the receiver to pin 1????? The code is calling for interrupt 1.. And interrupt 1 is on PIN 3.. Forget about the brushless motor for a second.. Connect the output (pin 11) to the oscilloscope and connect the receiver signal to PIN 3 on the UNO.. Dont change anything in the code, and reupload and test it again.. If you get the same results as in the video, then connect the output (PIN 11) to the ESC input signal and try again.. (Dont forget to connect the GND of the ESC to the GND on arduino)..

When you first start up the ESC remember to put the throttle on 0% (stick all the way down) for at least 3-5 seconds before fiddling with it..

Edit: If you got propellers on then remove them.. We don't want you to lose a finger now do we..?
Pages: 1 ... 5 6 [7] 8 9 ... 18