Developing an IMU from the UAVDevBoard

Hi all!

First I wanna congratulate all of you with all the things you've achieved already!
Now I have question:
I have to do a large school project, I have almost a year to complete it, and I want to make an IMU and display the data graphically using a rotating cube. I've done a lot of reading on this site already, and this is what i came up with:

My idea is to use the UAV Dev Board as a starting point. I would make my own board based on the UAVDevBoard, and rewrite the code (Yes I know I'd be reinventing the wheel, but thats part of the assignment :P).
Because the IMU would not be moving a lot, I won't be able to use GPS data for yaw correction (Right?), so I would need to use a magnetometer (Right?). And if so, what kind of magnetometer would I have to use? I was thinking a 3-axis tilt-compensated magnetometer like this one: http://www.sparkfun.com/commerce/product_info.php?products_id=8656

Also the sparkfun description of the UAVDevBoard kind of confuses me, because it says
"dsPIC runs at 120MHz with 16MHz resonator and PLL"
Now I understand that PLL can multiply the clock speed. But my understanding is that it can only multiply by 4, 8 or 16, none of which give 120MHz. Also the datasheet says that PLL can only be used with a 4-10MHz oscillator.
And finally, in the code i can't seem to find the place where the PLL is set?
Could someone maybe explain to me how they got to 120 MHz?

With regards,
Wouter van Verre
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Hi Dave_fr, 

    This thread is about the UDB2 board, which runs on a dsPIC30F4011 processor (the UDB3 board has this processor as well). I quickly skimmed through the documents on this cpu and I don't think it supports a PLL feedback divisor. It does have a Programmable Oscillator Postcaler, but I am not very familiar with it, so I wont comment on it. Maybe I will have some time to read about it this afternoon.

    I guess you are talking about the dsPIC33F256GP710A processor on the UDB4 boards. This processor does feature the PLL Feedback Divisor you mentioned. The frequencies mentioned in this thread are not applicable to the UDB4 boards, because the cpu and the crystal are different. 

    I hope this helps!

    Kind regards,

    Wouter van Verre

  • So, here are the frequencies the UAV DevBoard will run at:

    7.5 MHz : fast RC
    16 MHz : crystal
    30 MHz : fast RC + 4X PLL
    60 MHz : fast RC + 8X PLL
    120 MHz : fast RC + 16X PLL

    I don't underdand why these frequencies are the only ones acceptable. I see that N1 & N2 are limited to a few values but can't you set M (PLLFBDbits.PLLDIV) to get,say 80Mhz ?

  • T3
    Peter,
    You are 100% correct. Thank you so very much for supplying this information.
    Bill
  • Developer
    The DCM algorithm does yaw correction using the course reported by the GPS when the plane is moving.
    So when the plane takes off it is normally in stabilized mode, but does not need at that point to know whether it is pointing North,South,East or West. But over the next 20 seconds the Yaw Gyro is calibrated by the GPS course. So after 20 seconds of flight, if you switch into waypoint mode, the plane (and it's gyros and the DCM), know exactly which course the plane is on. The gyros control the heading of the plane 40 times / second. The Gyros are corrected every 1/4 or every 1 second (depending on whether you use a Ublox or an EM406A).

    The Magnetometer for flight in a plane is only needed really for two distinct conditions. 1) When the plane is in hover mode (hanging of it's propellor) or 2) for fully automated take off.
  • Hi Pete,

    Thanks for you quick response! I'll go and that magnetometer.
    Also, another question just popped up in my mind. How does the DCM algorithm perform without yaw compensation?

    Regards,
    Wouter
  • Developer
    Wouter,

    I think you probably will want to get the magnetometer that is in the DIY Drones.com Store if you are going to use it with the UAV DevBoard. Why ?

    1) There is an ongoing project to integrate that device with the UavDevBoard. Progress is being made.
    2) Tilt compensated magnetometers usually have on board acclerometers to detect gravity. I don't think these will work well when a plane is pulling say 2g in a tight continuous turn.
    However, the UDB already has all of that calculation completely done. The UDB knows exactly what orientation it is in all the time. So it can provide the tilt compensation functionality itself in it's own firmware. So we do not need the more expensive tilt compensated magnetometers. We can use the more basic and cheaper ones.
  • Hi all,

    I've got another question. I've tried to find the answer myself, but I can't seem to find it.
    My question is, should I get a tilt-compensated magnetometer or would a 'simple' one that is not tilt-compensated do?

    With regards,
    Wouter
  • Bill,

    Again thanks for the response! I now understand all the different clock speeds and settings :).
    Thanks for all the help :).
    Right now I'm reading through the UDB google discussion groups, a lot of interesting stuff there too!!

    With regards,
    Wouter
  • T3
    Wouter,

    All of the released firmware for the UAV DevBoard runs at 16 MHz. We are doing that to reduce the amount of power the board draws, and because the CPU loading is still only about 10% at the frequency.

    SparkFun does not have any connection to the firmware, they only sell the hardware. The frequency is software configurable. The board could
    run at 120 MHz, if you wanted it to. So, SparkFun advertises the top speed of the hardware, 120 MHz. To be precise, I suppose SparkFun should say that it can run at 120 MHz.

    I have tested the board at 120 MHz, it does work at that speed.

    As we continue to develop more firmware, and the CPU loading goes up, we may raise the frequency to 30 or 60 MHz. There would not be any change to the hardware, we would just change a couple of software option bits.

    Best regards,
    Bill
    speed.as
  • @Bill,

    Thank you for your explanation! Indeed it wouldn't matter very much, however on my own board I was planning on using dsPIC too and I was wondering what speed to set it at??
    I've one question left though:
    Does the UAV DevBoard run at 16 MHz, 120 MHz or a combination of both? 'Cause in the code I came across this line:
    _FOSC( CSW_FSCM_OFF & HS ) ; // external high speed crystal
    This means it uses 16 MHz, I think. If so, why then does sparkfun say it runs at 120 MHz?

    With regards,
    Wouter
This reply was deleted.