| Arduino Forum ::  Members :: davidbrowne
 Show Posts Pages: [1] 2
 1 Community / Exhibition / Gallery / Re: RC helicopter UAS on: April 16, 2011, 12:32:23 pm Fully implemented control system preview:
 2 Community / Exhibition / Gallery / Re: RC helicopter UAS on: March 19, 2011, 04:32:39 pm In my case, I am creating a controller to make a rotor turn at ~ 300rad/s which is approximately 50rev/s or 1 rev per 20ms. For my control system it was desirable to have a high resolution reading, and a fast reading rate. Using an interval of one revolution I got a fast reading rate, but a low resolution. With a rolling average over 10 laps I got the same reading rate, but with a higher resolution.The same reasoning applies to why I didn't use the fixed time interval; If I used a small time interval I would get a fast reading rate, low resolution. If I used a long time interval I would get a slow reading rate but high resolution.
 3 Community / Exhibition / Gallery / Re: RC helicopter UAS on: March 15, 2011, 12:49:07 pm Well, thanks for your work. It's been very helpful to me. I adapted the code to use a rolling average over 10 cycles to increase the speed reading frequency, but like the initial code, this has the problem of given a speed reading which is on average 5 cycles old. Now i've switched to reading the microseconds taken for just 1 cycle for a good resolution, high frequency and low delay.Rolling average:Code:void speedcalc(){  if (revcount > 0)   {  time = (lap0-lap10);  //(ms)  w = 20000*pi/time; //Calculating rad/sec by number of revolutions in a time sample  Serial.print(millis(),DEC);  Serial.print(",");  Serial.println(w,DEC);  revcount = 0;  //Reset rev count  }} void rev_fun(){  lap10=lap9;  lap9=lap8;  lap8=lap7;  lap7=lap6;  lap6=lap5;  lap5=lap4;  lap4=lap3;  lap3=lap2;  lap2=lap1;  lap1=lap0;  lap0=millis();  revcount=1;  //Increase revolution count by 1}
 4 Community / Exhibition / Gallery / Re: AX12 Hexapod Robot and other projects. on: March 12, 2011, 04:12:41 pm Your work is incredible! Are you working as a hobby, in academia or in industry?
 5 Community / Exhibition / Gallery / Re: RC helicopter UAS on: March 03, 2011, 12:52:03 pm Thanks for the suggestions. The speed code appears to work with no hiccups now that the calculations code have been placed in the loop rather than the interrupt. Code://AOA sweep//David Browne//Arduino nano pwm ports// 3,5,6,9,10,11#include #include "math.h"     Servo rear;  // create servo object to control a servo Servo right;Servo left;Servo esc; int aoa = 0;    // variable to store the aoaint angleright;int angleleft;int anglerear;int escspeed;float fp1 = -0.000011087;float fp2 = 0.00047226;float fp3 = -0.0054815;float fp4 = 0.020924;float fp5 = -1.631;float fp6 = 101.18;float rp1 = -0.0076468;float rp2 = -1.8592;float rp3 = 100.73;float pi = 3.14;volatile byte revcount;unsigned int w;unsigned long timeold = 0;unsigned int nomags = 1; void setup() {  Serial.begin(9600);    attachInterrupt(0, rev_fun, RISING);  //Run rev_fun every time the hall switch rises from low to high (interupt 0 = pin 2)    rear.attach(3);  left.attach(6);  right.attach(5);  esc.attach(9);    delay(5000);  esc.write(50);  delay(2000);  esc.write(150);  delay(2000);    right.write(50);  left.write(140);  rear.write(50);}  void loop() { for(escspeed = 50; escspeed < 100; escspeed += 1)  {    aoa = 5;    angleright = fp1*pow(aoa,5) + fp2*pow(aoa,4) + fp3*pow(aoa,3) + fp4*pow(aoa,2) + fp5*aoa + fp6;    angleleft = 140-angleright+50;    anglerear = rp1*pow(aoa,2) + rp2*aoa + rp3;        right.write(angleright);    left.write(angleleft);    rear.write(anglerear);    esc.write(escspeed);    if (revcount>= 10)     {  //Update RPM every 20 counts, increase this for better RPM resolution, decrease for faster update       w = 2000*pi*(revcount/nomags)/(millis() - timeold); //Calculating rad/sec by number of revolutions in a time sample        timeold = millis();  //Reset timeold for revcount = 0       revcount = 0;  //Reset rev count       Serial.print("Speed = ");       Serial.print(w,DEC);  //Print most recent speed value to serial       Serial.println(" RAD/s");    }        delay (1500);  }   for(escspeed = 8; escspeed > 5; escspeed -= 1)  {    aoa=5;    angleright = fp1*pow(aoa,5) + fp2*pow(aoa,4) + fp3*pow(aoa,3) + fp4*pow(aoa,2) + fp5*aoa + fp6;    angleleft = 140-angleright+50;    anglerear = rp1*pow(aoa,2) + rp2*aoa + rp3;        right.write(angleright);    left.write(angleleft);    rear.write(anglerear);    esc.write(escspeed);        if (revcount>= 10)     {  //Update RPM every 20 counts, increase this for better RPM resolution, decrease for faster update       w = 2000*pi*(revcount/nomags)/(millis() - timeold); //Calculating rad/sec by number of revolutions in a time sample        timeold = millis();  //Reset timeold for revcount = 0       revcount = 0;  //Reset rev count       Serial.print("Speed = ");       Serial.print(w,DEC);  //Print most recent speed value to serial       Serial.println(" RAD/s");    }        delay (1500);  }}  void rev_fun() {   revcount++;  //Increase revolution count by 1   //Serial.println("blip"); }The helicopter now has an Arduino nano mounted on it which, along with the servos and the motor, can be powered from the lipo battery:(edit. photos removed for being too big - will resize another time)http://en.wikipedia.org/wiki/Unmanned_Aircraft_Systemhttp://en.wikipedia.org/wiki/Unmanned_Aerial_VehicleUAS seems to be entirely appropriate nomenclature
 6 Community / Exhibition / Gallery / Re: RC helicopter UAS on: March 02, 2011, 09:47:18 am Thank you for having a look;Code://Speed & motor code#include volatile byte revcount;unsigned int w;unsigned long timeold;unsigned int nomags;float pi;Servo ESC;  //Creates servo objectint pos;  //ESC throttle position (0-180)void setup(){  Serial.begin(9600);    //Some ESC initialization - temperemental but seems to work  ESC.attach(9);  //Attach esc to pin 9 as a "servo"  pos = 150;  ESC.write(pos);  delay(5000);  pos = 50;  ESC.write(pos);    attachInterrupt(0, rev_fun, RISING);  //Run rev_fun every time the hall switch rises from low to high (interupt 0 = pin 2)    revcount = 0;  pi = 3.14;  timeold = 0;  //Initial time value  nomags = 1;  //Number of magnets around circumference}void loop(){                                 for(pos = 50; pos < 150; pos += 1)  // goes from 0 degrees to 180 degrees   {                                  // in steps of 1 degree     ESC.write(pos);              // tell servo to go to position in variable 'pos    delay(1500);                       // waits 15ms for the servo to reach the position  }   for(pos = 150; pos>=50; pos-=1)     // goes from 180 degrees to 0 degrees   {                                    ESC.write(pos);              // tell servo to go to position in variable 'pos'    delay(1500);                       // waits 15ms for the servo to reach the position   }}  void rev_fun() {   revcount++;  //Increase revolution count by 1   //Serial.println("blip");       if (revcount>= 10)     {  //Update RPM every 20 counts, increase this for better RPM resolution, decrease for faster update       w = 2000*pi*(revcount/nomags)/(millis() - timeold); //Calculating rad/sec by number of revolutions in a time sample        timeold = millis();  //Reset timeold for revcount = 0       revcount = 0;  //Reset rev count       Serial.print("Speed = ");       Serial.print(w,DEC);  //Print most recent speed value to serial       Serial.println(" RAD/s");    } }
 7 Community / Exhibition / Gallery / Re: RC helicopter UAS on: March 02, 2011, 05:55:06 am If you watch the video, you can see and hear that occasionally the motor will decelerate. I believe this is because the signal to the ESC is not being sent due to the interrupt function. I'm welcome to any other suggestions to what might be happening though.
 8 Community / Exhibition / Gallery / Re: RC helicopter UAS on: March 01, 2011, 09:33:23 pm Unmanned Air System, although I do like the starship abbreviation.Sorted out the servo control now. I have attempted to sync the rear, front and left servo so that they all raise the swashplate by the same amount throughout a sweep.
 9 Community / Exhibition / Gallery / RC helicopter UAS on: February 28, 2011, 08:14:40 pm I am building a UAS from a Gaui mini zoom RC remote control helicopter, very similar to the following link except with 2 blades rather than 3;http://www.buzzflyer.co.uk/Sub-Micro-RC-Helicopters/GAUI-Mini-Zoom-3-Blade/p-97-677/My intention is to initially mount the helicopter onto the end of a cantilever, therefore restricting it to 1 degree of freedom. The helicopter will then be able to stabilize itself against any disturbances to cantilever angle as well as navigate itself to user defined cantilever angles with high precision.There are 2 control systems used; 1 to govern the speed of the motor, 1 to control the angle of attack of the blades through the swash-plate servo motors. I plan to maintain a constant speed by varying the voltage to the motor and control the lift through the blade angle of attack. I have already designed the control laws for both of these systems. I am now in the process of implementing what I have designed into the hardware. My most recent progress was building a speed sensor to monitor the speed of the blades. This was achieved using a similar method to the demo code found here; http://www.arduino.cc/playground/Main/ReadingRPM. I am having some problems due to the interrupt technique that it uses. I plan to fix this by changing the code to use an alternative technique yet to be decided! The video below demonstrates the sensor in operation.
 10 Using Arduino / Sensors / Re: Amplifying sensor output on: February 22, 2011, 07:19:21 pm Thank you for the advice. Could you please clarify what 'network' you are referring to when you suggest I need to match them? What about the LMP2021 makes it suitable to my application?
 11 Using Arduino / Sensors / Re: Amplifying sensor output on: February 22, 2011, 12:16:00 pm Sorry, I meant to include the links in the original post.Opamp; http://focus.ti.com/lit/ds/symlink/lm3900.pdfMR sensor; http://www.farnell.com/datasheets/103843.pdfDiagram;
 12 Using Arduino / Sensors / Amplifying sensor output on: February 22, 2011, 11:38:06 am I am currently trying to interface a MR rotation sensor to my arduino.The sensor has 2 analog outputs of 2.5V+/- 0.1V. That is to say; if one output is 2.6V, the other is 2.4V.I would like to take this output and manipulate it using an omp amp so that it is roughly in the range of 0-5V for use in the arduino's ADC.I have been experimenting with a range of set ups and checking the results with a multimeter. Without the op amp plugged in, I have verified the sensor behaves as expected. If I set up the opamp to provide an expected amplification of 10X, and plug in the sensor, the sensor output drops to 0.7V and the opamp output is 4.0V. However, at the point, the sensor does not seem to operate, as the output does not change in the presence of a magnetic field.I believe my problem might be the Vcc and grounding I have used. Currently I have linked the 5V output and GND of the arduino to a breadboard, and linked all the required voltage inputs (from sensor and opamp) to this. Can anyone else suggest the problem and how to solve it?Many thanks
 13 Using Arduino / Sensors / MR rotary displacement sensor on: February 18, 2011, 09:21:48 am I have purchased the following MR rotary displacement sensor, and I was hoping someone could help me interpret the data sheet:http://www.farnell.com/datasheets/103843.pdfI am using the HMC1512 which has the larger angular range. Does the diagram below indicate that the sensor contains the circuit or that I should wire up the chip legs into the circuit shown? If the latter, where do I input power and output a signal?Thanks alot.
 14 Using Arduino / Sensors / Re: Problem using a "Hall switch" on: February 01, 2011, 10:06:06 am In case any one stumbles upon this thread looking for a solution themselves, the problem was that the sensor required a resistor to be placed between the Vin and Vcc ports. With this in place, the sensor is functional.
 15 Using Arduino / Sensors / Re: Problem using a "Hall switch" on: January 30, 2011, 01:54:41 pm Thankyou for your help anyway. With regards to your edit I already thought to try a different LED output pin, and the same results occur.I guess I'll wait and see if Jd.steinberger has anything to suggest if he had a similar problem.If there is no resolve, I still have reason to suspect I may of been sent an incorrect sensor model and I may return it. If you still have yours available could you let me know what markings it had on it?
 Pages: [1] 2