sparkfun - UAV v2 Development Platform - dspic30f4011

Post Reply
zafer
Posts: 3
Joined: Thu Apr 22, 2010 6:58 am

sparkfun - UAV v2 Development Platform - dspic30f4011

Post by zafer » Thu Apr 22, 2010 7:21 am

Hi Lubin,

I and my friends are working on a mini helicopter uav project. We bought an open source uav development board of sparkfun. But there are a lot of codes about this. I think simulink is more user friendly. Then I came across your blockset and I have very big smile on my face until now :D I tried your examples (servo sinus, servo adc etc.) and they all worked. I know this 6 I/O is not enough for me, for now I am working on the blocksets,trying to understand, after having some experiance, it will be necessary for me to have 10 I/O. Now I have a problem.

My development board has 3 axis gyro and accelerometers, 4 radio inputs and 3 servo outputs. As you can see from the hardware description of dev board I attached, I3 and I4 pins are OC pins. When I use OC block, I can use only these 2 pins for my servo outputs. How can I have my servo PWM outputs from 3 servo out pins?

Sincerely
Attachments
UAV_v29.pdf
(Datasheet)
(79.09 KiB) Downloaded 637 times
GPSUAV2Manual_v29.doc
(Dev Board Manuel)
(172.5 KiB) Downloaded 588 times

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: dspic30f4011

Post by LubinKerhuel » Thu Apr 22, 2010 7:34 am

Hi Zafer,

This board seems very nice for many projects.

I quickly read of the doc; why don't you use the PWM motor block to generate PWM for servo motor?
You get O1 O2 and O3 pins wired as I understand it.
As the duty cycle is fixed for servo motor to 20ms, PWM motor peripheral should be perfect. (It is even better than OC peripheral)
You can also use booth: two servo on OC peripheral, and the last one on PWM motor peripheral...

Let me know if you encounter problems.
I am interested by your project. Are you going to publish it somewhere?
You may find similar project I started few years ago: http://www.kerhuel.eu/wiki/Miniature_In ... Unit_-_IMU.
Sparkfun board is better!

Lubin

zafer
Posts: 3
Joined: Thu Apr 22, 2010 6:58 am

Re: dspic30f4011

Post by zafer » Mon Apr 26, 2010 3:23 pm

Hi Lubin,

First, thank you very much for your quick response.
As you said, you can use this board for many project. Normally this board is designed for fixed wing uav autopilot applications and you can easily find its open source files in the internet. But we decided to use uavdevboard on a ccpm (cyclic collective pitch mixing) helicopter and if we succeed, it is a dream but we will try something intelligent like cooperative flight of 3 or more helicopters.

Now, here is my question again.
1. You said I could use PWM motor block for servo outputs, I still can not have any outputs from servo outputs. On the model which I attached, I have moving servos from the OC channels and they look fine but I still can not have any outputs from servo output ports.
As you said I get O1 (PWMH1, RE1), O2 (PWMH2, RE3) and O3 (PWMH3, RE5) pins. For example in Digital output write, we assign the output port like RE1 or RE3. Do i forget to assign my PWM ports like that or something else? I am confused.

2. In the picture I uploaded, you can see that there is nothing above input enable selection, I mean I can not select PWM 1 or PWM 2.

Thank you very much again, I am looking forward to have your answer.
Attachments
Servo_ADC.mdl
(52.1 KiB) Downloaded 534 times
servo adc.JPG

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: dspic30f4011

Post by LubinKerhuel » Mon Apr 26, 2010 6:11 pm

Hello, I noticed few things.

Please try the following modification :

First of all, change OC1max variable (used for normalizing signals) :
For OC (HW) block, you must use OCmax variable (is set to 9999 in matlab workspace)
For PWM motor block, you must use PWM (is set to 40000 in matlab workspace)

If you have a scope, do you have a signal on the PWM motor output block?
If you have a servo, does the servo try to get on the extreme position (because of the normalization error here)
If so, it should works now with the correction above.

If not, there is something else wrong, I have no idea now but I would be interested to determine what happening there ; That may be a bug from the blockset ! (I hope not)

Lubin

zafer
Posts: 3
Joined: Thu Apr 22, 2010 6:58 am

Re: dspic30f4011

Post by zafer » Tue Apr 27, 2010 8:18 am

Hi Lubin,

You are great !!! I tried the modifications you said and now servos are dancing :D
Again thank you very much for your quick response. We will be in touch during the project. Your blockset showed the shortcut :o

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: sparkfun - UAV v2 Development Platform - dspic30f4011

Post by LubinKerhuel » Tue Apr 27, 2010 9:33 am

Good to see it working.

You will be able to focus on the interresting part now (that's one of the reason why I created that blockset, when I discovered I spent more time on programming problem than math problems...)
The wiki is open for you if you wish to publish results in a pretty way.

Lubin

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests