RC India
Welcome Guest, please login or register.
 
Pages: [1]   Go Down
0 Members and 1 Guest are viewing this topic. Topic Tools Topic Tools 
Read
« on: September 16, 2016, 09:02:02 PM »
clickdelete
Heli Lover
Active Member
**

Reputation Power: 1 
clickdelete has no influence.
Offline Offline

City: mumbai
State: Maharashtra
RC Skills: Beginner
Posts: 7
Join Date: Sep, 2016




Greetings to one and all . I am new to this forum and to RC flying in general and this is my first post. I have never owned any serious RC equipment so far. But I have been an Arduino enthusiast for the past few years and have made a couple of Remote controlled things using blue tooth radios and X-bees.

 While fiddling around with an idea of making an RC buggy I felt why not try to make something which flies and the first thing which came to my mind was a Quadcopter. But then I realised that equipments required to make one comes at a cost.

I did not have a transmitter or a receiver. All flight controllers I came across required an RC Rx and Tx.  So I decided to make my own flight controller from an Arduino Mega.

The mode of control was chosen to be blue tooth. Yes I agree with most of you out there that it has a very low range but my initial copter is not expected to go beyond a basketball court below my building. 

One major advantage it had as far as my building abilities go was that I was conversant with blue tooth controls as I have already used it in some of my previous builds.  And yes it eliminates the requirement to have a transmitter. Almost all android phones have built in Bluetooth and I have used my phone as transmitter for the Quad.


A blue tooth receiver HC-05 is damn cheap and comes for around 250 Bucks. Considering all the advantages I was more than willing to sacrifice the range considering that the only place I have to fly it is a basketball court.



My first goal was to achieve a stable take off without toppling which I have achieved today after almost 25 crashes, multitude of code revisions, 65 days and 4 sets of broken propellers.  For stabilisation I chose an MPU6050 6 axis IMU. But so far I have only used the gyros to measure the rate of turn. I want to add an auto levelling mode at a later stage and will also utilise the accelerometers to calculate the angle of turn.


Since I am new to the black art of stabilising Quadcopters i wanted to make things simple to start with and further complicate it later. For the motors and ESCs i ordered from ebay and got a package delivered which consisted of 4 unbranded A2212, 13T, 1000 KV motors and four unbranded red coloured ESCs which only had one thing written on them “Simon 30A” .

With a lot of reference from the internet about the physics of Quadcopter stability and implementation of PID controls with particular reference to videos provided under the name YMFC 3D I was able to develop a not so inefficient code which had a loop time of 4 milliseconds. Ie, I could provide a refresh rate of 250Hz to the ESCs.



 I chose 250 Hz because i read in one of the references that almost all quad ESCs operate at refresh frequencies above 250 Hz. Most of the advanced ESCs can even operate at 8Khz. Since i didn’t know the exact refresh rate of my red unbranded ESC i stuck to the value it will definitely support. Aso a loop time of 4 milli seconds was not hard to achieve on the Arduino mega. I’ll upload a pic of the Esc in my post so that someone can identify the brand and possibly indicate a data sheet which describes the refresh rate. Any how with 250 hz it stabilises pretty decent in the Pitch and roll axis.



Presently my transmitter has only one channel and that is for throttle. I have made an android app which will communicate with the HC 05 blue tooth receiver through simple serial communication.


The app consists of only two items. One button to connect to the Bluetooth receiver and one slider, which will transmit the throttle value. (750 for stopped and 2000 for full speed) When the receiver gets these throttle  numbers it generates PWM for each ESC input and supplies this PWM through 04 digital pins of the Mega.

The onboard gyro senses the pitch and roll and provides this to the mega via  I2C and the code alters the throttle pulse widths going to the corresponding motors. That is, if the quad copter rolls to left , the gyro senses a negative rate of roll.


This value is provided to the roll axis PID controller. The out put of the PID controller is used as Roll motor correction. So in this example the motor correction is added to the left motor throttle value and subtracted from the right motor throttle value. The left motor speed increases and the right motor speed decreases there by correcting the roll to the left which kick started the whole business.
With only the throttle control from my android device, presently i can only move the quad skywards. Since the PID constants are not fine tuned the quad moves upwards and veers left/right. Since I do not have a yaw PID running , it does slowly spin in the Yaw axis too.  These are the things I look forward to fixing in the forth coming days.  Will keep all of you updated on the progress and  ill be glad to help someone who is trying to develop a flight controller with whatever i know presently. My controller is in a very nascent stage but it is showing promise.

My ultimate aim is to make Quadcopter building affordable to the common man. No expensive tx/Rx/Controller.  Infact once I settle down to a decent controller code I intend to jump from brushless motors to coreless DC motors which are priced way lesser than esc /BLDC combos. I can use a ULN2003 and driver for 4 motors and the whole Motor and driver package can reduce in price many fold. But those are for later, i shouldn’t count chickens before they hatch.


I am attaching a video of my Quad with only throttle control and PID control on Pitch and Yaw alone.

Cheers
Clickdelete

IMAG0075.jpg
Making a flight controller
* IMAG0075.jpg (49.71 KB, 455x800 - viewed 898 times.)
This post has 1 more images(s)/attachment(s). Please login or register to view them.
« Last Edit: September 17, 2016, 02:07:56 PM by clickdelete » Logged
 

Read
« Reply #1 on: September 17, 2016, 12:04:26 AM »
saikat
Plane Lover
Forum Hero
*****

Reputation Power: 14 
saikat has no influence.
Offline Offline

City: Tezpur
State: Tripura
RC Skills: Expert
Posts: 1130
Join Date: Jul, 2009



I can see that you are enthusiastic .....

welcome to the forum .... may your quest be succesfull !


little advice ,... your post is too long and no para spacing , very few will have the inclination to read.


summarize and simplify ....
Logged

 

Read
« Reply #2 on: September 17, 2016, 01:52:43 AM »
Balakrishna Reddy
Plane Lover
Forum Hero
*****

Reputation Power: 8 
Balakrishna Reddy has no influence.
Offline Offline

City: Hyderabad
State: Telangana
RC Skills: Intermediate
Posts: 698
Join Date: Feb, 2015



Your work is good and instead of using Arduino mega you can use uno to save space and money which is you goal.

However i would rather suggest to go with Atmel studio rather arduino ide because its libraries take up more space and are also slow.
As you have mentioned the frequency of operation as 250. The point here in ESC is the PWM operating frequency. You can have higher PWM operating frequecies at that loop time by carefully choosing prescaler. But that is no problem everything works as usual.
But generally PWM frequency must be higher than refresh rate.
Logged
 

Read
« Reply #3 on: September 17, 2016, 11:55:38 AM »
clickdelete
Heli Lover
Active Member
**

Reputation Power: 1 
clickdelete has no influence.
Offline Offline

City: mumbai
State: Maharashtra
RC Skills: Beginner
Posts: 7
Join Date: Sep, 2016



@saikat , point taken. Wilco henceforth.
@balakrishna reddy. Totally agree with you regarding kiting out the mega for a no.in fact I'm pro for a mini pro too.. I'm using the mega because of the multiple serial ports . Since my Bluetooth requires one serial port and I needed another for de bugging I chose the mega. Software serial interferes with servo library.

But anyways now I'm no longer using the servo library for PWM.

I read about prescalers to change pwm frequency but later decided to use direct port access to switch on and off four digital pins to generate own with code. One of the sites I referred to was praising this method and proved on oscilloscope that it's pretty fast avoiding the overheads caused by servo.writemicroseconds


I guess refresh rate of esc should be greater than loop time / loop frequency so that result of calculations of each loop reaches the esc and esc acts upon it. This way we ensure that no loop calculations go unattended and therefore crisp response. There is an article by Oscar Lang on this topic which I found pretty amazing.

In case of my esc I'm assuming that it's refresh rate is already 250 hz . So it will be awaiting one signal pulse every 4000 microseconds.  So my code provides a pulse every 4000 microseconds. If I later find that the esc can work at 300 hz I'll accordingly reduce my loop time to provide signals to the esc at that rate.

Atmel studio I haven't used yet. Will try out. But I'm in love with some library fun times of arduino , he he.
Logged
 

Read
« Reply #4 on: September 17, 2016, 02:51:51 PM »
clickdelete
Heli Lover
Active Member
**

Reputation Power: 1 
clickdelete has no influence.
Offline Offline

City: mumbai
State: Maharashtra
RC Skills: Beginner
Posts: 7
Join Date: Sep, 2016



https://www.google.co.in/url?sa=t&source=web&rct=j&url=https://www.youtube.com/watch%3Fv%3DFlp8yZ7H59M&ved=0ahUKEwi56feGiZbPAhUHuo8KHd0gBqgQtwIIJzAC&usg=AFQjCNHqV3nIf-yqEhcn9yYiA53UU4-LQg&sig2=gO1ExZmdwg7e5d6T2MGIuw
Logged
 

Read
« Reply #5 on: September 17, 2016, 02:55:43 PM »
clickdelete
Heli Lover
Active Member
**

Reputation Power: 1 
clickdelete has no influence.
Offline Offline

City: mumbai
State: Maharashtra
RC Skills: Beginner
Posts: 7
Join Date: Sep, 2016



https://www.google.co.in/url?sa=t&source=web&rct=j&url=https://www.youtube.com/watch%3Fv%3DFlp8yZ7H59M&ved=0ahUKEwi56feGiZbPAhUHuo8KHd0gBqgQtwIIJzAC&usg=AFQjCNHqV3nIf-yqEhcn9yYiA53UU4-LQg&sig2=gO1ExZmdwg7e5d6T2MGIuw

https
Logged
 

Read
« Reply #6 on: September 18, 2016, 11:09:03 PM »
clickdelete
Heli Lover
Active Member
**

Reputation Power: 1 
clickdelete has no influence.
Offline Offline

City: mumbai
State: Maharashtra
RC Skills: Beginner
Posts: 7
Join Date: Sep, 2016



over the week end i revised the code again and made two mods which seems to have greatly improved the stability. due to excessive rains here in mumbai , i did not get much chance to do an extensive flight test. however a short trial video is attached. the mods i did are as follows.


i) Cascaded PID : The stabilisation algorithm now consists of two loops in each roll and pitch . The outer loop consist of an angle PID. ie the setpoint is zero degrees and the input is actual tilt angle measured in degrees. The out put of this calculation is used as set point of the inner loop PID which is a rate PID. ie, it measures the rate of turn and uses it as input. the output of the rate PIDs is finally used for motor correction. I tried using only angle PID however it was much more unstable than the Rate PID i was using earlier. This cascaded PID seems to be the best choice so far. the best part is that in the video below im using only the Propotional component of the PID. constants for Derivative and Integral are still zero. Without them the quad stabilises quite well but will be required once i add steering controls in my code.

ii) Additional Yaw PID. Those of you who saw the previous video must have seen that the quad keeps rotating in yaw axis. This was because i had no PID running on yaw axis. I added a single stage rate PID on yaw axis and that rotation has stopped now.


ill post a longer video when there is light and when the weather clears up

cheers




Logged
 

Read
« Reply #7 on: January 05, 2017, 04:25:10 PM »
Voice of deaf
Plane Lover
Forum Veteran

****

Reputation Power: 4 
Voice of deaf has no influence.
Offline Offline

State: Rajasthan
RC Skills: Intermediate
Posts: 297
Join Date: Apr, 2016



Those are unbranded escs
You can flash simonK
The mcu is atmega8l
Logged

Born for FPV, Forced to LOS.
 

Read
« Reply #8 on: January 05, 2017, 04:27:37 PM »
Voice of deaf
Plane Lover
Forum Veteran

****

Reputation Power: 4 
Voice of deaf has no influence.
Offline Offline

State: Rajasthan
RC Skills: Intermediate
Posts: 297
Join Date: Apr, 2016



I think thema x frequency for the stock firmware  is 400 hz
Logged

Born for FPV, Forced to LOS.
 

Pages: [1]   Go Up
Jump to:  

Related Topics
Subject Started by Replies Views Last post
need motors,esc,battery,flight control board for making quadcopter
Wanted
rajibcic 2 2509 Last post August 08, 2014, 08:38:15 PM
by accidentallooser
Need KK flight controller
Wanted
sooraj.palakkad 9 4906 Last post February 06, 2016, 11:57:39 AM
by zalman15320011351
Need used Flight controller kk2
Wanted
cool16yash 2 3088 Last post December 12, 2014, 10:52:55 PM
by cool16yash
KK 5.5 Flight controller
Multirotors
sooraj.palakkad 18 15049 Last post September 09, 2015, 07:44:41 PM
by sooraj.palakkad
DIY flight controller
For Sale
Kailas 2 2630 Last post August 30, 2015, 08:49:26 PM
by Dipanjan