Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 29, 2024, 04:45:10 16:45


Login with username, password and session length


Pages: [1]
Print
Author Topic: 10DOF AHRS Project IMU  (Read 4122 times)
0 Members and 1 Guest are viewing this topic.
Droneman1982
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 3
-Receive: 12


« on: February 10, 2015, 03:41:21 15:41 »

Hi, I'm new to the forum

My current flagship project is a 10 degree of freedom IMU AHRS.
I'm using actually AltiIMU-10 v4 coupled with a LS20031 10 Hz GPS module, the microcontroller is a PIC18F26K80 (previously PIC18F2680), running at 64MHz (PLL), (16MIPS)

It may seem crazy to implement such a system on a PIC, but, as I said in my invitation request, i don't like arduino  Cheesy

The IMU parts are:
Accelerometer 3D, LSM303D
Magnetometer 3D, LSM303D (both on the same unit)
Barometric altimeter, LPS25H
Ratio gyroscope 3D, L3GD20H
GPS module LS20031

The communication between the PIC is performed through I2C (1MHz), while the GPS module communicates via USART (  Sad )

For the calculation i used fixed point maths, usually with 15bit fractional part of a LONG variable (1.0000 is represented as 32768). The trigonometric rotines are a mix of lookup tables (memory usage reduced using sin(a+b) trig identities) and CORDIC routines, (i made them in past for the windlogger), and are optimized to reduce the time spent into calculating the functions.

The calculation of the Attitude is done by using quaternions (i designed some functions to perform basic quaternio math), and complementary filter (kalman is too proc intensive). The complementary filter actually has a variable coefficient (similar to Kalman)

I use all the set of vectors, including compass giving exactly the three angular components (roll, pitch,yaw) of the attitude (the yaw is affected by mag declination though)

The code was optimized trying to remove, where possible, processor intensive operations, sush as multiplication an division (replaced by bitshifts on the absolute value)

The first experiments gave a refresh rate of 20Hz on PIC18F2680, not it is 130 Hz including the GPS USART wait time.

The GPS gave me lot of problems, since i cannot request a NMEA packet, I have to wait for the data packet to arrive (and this wastes PIC proc time, and can be very deleterious for an UAV  Grin ) so i used the internal Timer of the pic to sinch with the 10Hz GPS refresh rate reducing the wait time to a calculation cycle time (currently 6msec)

It is a bit cumbersome. I have thought other solutions such as using another PIC as a buffer/frontend or reducing the GPS refresh rate but I don't think it is a good idea.

Next steps will be pulsing the PWM input of the ESCs (1-2ms square pulse) and reading the receiver signal (this time i will need a front end) in PPM or D-SBUS.

The project should evolve in a fixed wing marconi plane (marconi is a type of kite) for aerial mapping. The intrinsic safety it such an aircraft may be of interest for specialized UAV operations

Any questions, suggestions, requests?



Logged
Parmin
Hero Member
*****
Offline Offline

Posts: 582

Thank You
-Given: 496
-Receive: 133


Very Wise (and grouchy) Old Man


« Reply #1 on: February 10, 2015, 09:32:04 21:32 »

.Sounds good.
 Are you going to share?
Logged

If I have said something that offends you, please let me know, so I can say it again later.
Droneman1982
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 3
-Receive: 12


« Reply #2 on: February 11, 2015, 01:26:33 01:26 »

Of course  Smiley

The main program cycle is only to testing and debugging the subroutines, but the subroutines, i think, are at a stable version.

Are you working on a similar project?
Logged
Parmin
Hero Member
*****
Offline Offline

Posts: 582

Thank You
-Given: 496
-Receive: 133


Very Wise (and grouchy) Old Man


« Reply #3 on: February 11, 2015, 09:19:17 21:19 »

No, just very interested.
Logged

If I have said something that offends you, please let me know, so I can say it again later.
Droneman1982
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 3
-Receive: 12


« Reply #4 on: February 11, 2015, 10:47:03 22:47 »

I will have to start designing the front-end with the RC receiver and maybe also moving the GPS module communication on the frontend too.

Another issue will be the magnetic declination, a couple of deegres is fine but more will cause "toiletbowl effect" or even a flyaway...

one possibility is to store a lookup table in the EEPROM memory of the PIC or design an algorithm to calibrate the compass.

so much work  Cheesy
Logged
Droneman1982
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 3
-Receive: 12


« Reply #5 on: February 16, 2015, 03:55:09 15:55 »

I have decided to split the device into two distinct microcontrollers. One will be devoted only to the IMU and motor control, the other will manage GPS, receiver, ground station etc.

The communication between them will be indirect using a shared I2C ram. To detect when the bus is busy i will use a pull-up resistor connected to the open collector (RA4) of both PICs. The ram will store the IMU attitude (roll, pitch, yaw and altitude) coming from the PIC1 and the angle and altitude setpoints, mag and accel calibration constants, distance and heading coming from the PIC2, and PID parameters. This way the first pic will work at the highest frequency without any waiting times driving the ESCs using a PID algorithm and imu calculations, the second will manage AI and all the communication with the user.

I have to find a 1K I2C ram to work with
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC