my MultiWii with Atmega2561

Post Reply
Buzo
Posts: 5
Joined: Thu Oct 24, 2013 3:27 am

my MultiWii with Atmega2561

Post by Buzo »

Hi everyone,

I just started in this R/C flying stuff. I bought a little RTF quadcopter just to feel If this is what i want and yes! it was so exciting so I put an order for just everything I need to build a DYI -and bigger- quadcopter.

Then found this site, I have some background in electronics and AVRs. I normally use to write my software in AtmelStudio and program my chips with a SPI programmer.

I am new to Quadcopters, MultiWii and to the Arduino world as well. I only have Atmega128's and 2561's in inventory so the first step was to create a board definition for those AVRs to be recognized by Arduino. Then I modified the MultiWii code to suit my new defined pins, timers etc.

I'll be building the frame while I wait for the stuff to arrive, so hopefully I can start flying into a couple of ... weeks or months, whatever should be OK.

I am sure there will be a lot of questions as the build progress, that's why I am introducing myself here hopping you guys can help me out when in troubles.

So far I succesfully compiled the multiwii firmware and downloaded it to the Atmega2561 with no problems, I tested the serial communication port, the PWM outputs, etc and everything seems to be working OK.

PS. Just to be safe, I included a small original Arduino board (a 328P I guess) in my order as backup plan, but the whole Idea is to create my own board and give a good usage to those several AVRs in my drawer.

Thanks for this great forum/project.
Buzo.

tovrin
Posts: 705
Joined: Tue Sep 20, 2011 4:08 pm

Re: my MultiWii with Atmega2561

Post by tovrin »

good luck, keep us posted, show pictures/video as you can!

Buzo
Posts: 5
Joined: Thu Oct 24, 2013 3:27 am

Re: my MultiWii with Atmega2561

Post by Buzo »

The mechanical part of the quadcopter is done. I took pics of everything so I will upload them later.

I forgot to order the R/C receiver so I am going to use my RTF quadcopter control and receiver.
This RTF has four DC motors which are controlled by a 4.1 Khz PWM signal going from 0 to 99% range

The question I got is if an ESC would be able to read a frequency this high?
I know standard R/C signals are 50 hz where the positive pulse is only 1 to 2 ms.

I can make a kind of translator to read the length of the positive pulse which will correspond to the position of the stick and then generate a more standard pulse per the above.

Will be trying to program my ESCs with the DC motor signals tonight, if not able to, I will add another microcontroller in between to divide the output freq from 4.1 khz to the standard 50 hz.

Just wanted to give an update to my "build thread" and shut the question in case somebody knows.

Buzo
Posts: 5
Joined: Thu Oct 24, 2013 3:27 am

Re: my MultiWii with Atmega2561

Post by Buzo »

I have completed the code to translate from 4.4 khz 0-100 PWM signal to 50 Hz 1-2 ms pulse

There is one timer generating an interruption every 20 ms, inside of that, there is an internal delay of 1000 us running as default so that will give me the 1ms pulse every 20 ms.
As soon as the 20 ms elapses, I wait for the next rising edge of the 4.4K pulse, then count each individual PWM sent to the DC motors.
Rise a “new data ready flag” and just wait for the next interruption to add the individual counters to the end of the 1000us delay.

User avatar
Gartenflieger
Posts: 65
Joined: Sat Oct 01, 2011 10:07 pm
Location: Dortmund, Germany

Re: my MultiWii with Atmega2561

Post by Gartenflieger »

I would think that the PWM Motor Signal of the micro already includes the stabilization from the flight controller. So you will end up with two stabilizers fighting each other?
Anyway, Obviously you are willing to hack all the was into the micro's board to find the pure teceiver Signal.

regards
Christoph

Buzo
Posts: 5
Joined: Thu Oct 24, 2013 3:27 am

Re: my MultiWii with Atmega2561

Post by Buzo »

I tested my idea of using the small RTF flight controller board to drive bigger motors, and it didn't work.
It was because I can't tune the controller.
All the theory worked as expected but I think every mechanism needs its own tune.
Unless somebody have done that before… I’m just a newbie.

Next step is to get familiar with the NANO-WII I bought. Is it already programmed? I need to investigate.
Attachments
quad1.jpg

Buzo
Posts: 5
Joined: Thu Oct 24, 2013 3:27 am

Re: my MultiWii with Atmega2561

Post by Buzo »

Gartenflieger wrote:I would think that the PWM Motor Signal of the micro already includes the stabilization from the flight controller. So you will end up with two stabilizers fighting each other?
Anyway, Obviously you are willing to hack all the was into the micro's board to find the pure teceiver Signal.

regards
Christoph


Couldn’t find the pure receiver signal in the small board, so I converted the PWM to be 1ms pulse length when the PWM was 0% and 2ms pulse length when the PWM was 100% and let the RTF board to stabilize the quad.
All the motors worked and increased speed according to the inclination of the quad, and it put a lot of thrust while I held it with my hand. However, it never left the floor because it was always inclined to one side and that motor reacted too late to compensate, then it applied too much speed, and so on.

Post Reply