FRDM-Copter is an attempt to build firmware for mbed based multicopter running on FRDM boards from Freescale.

Dependencies:   FXAS21000 FXOS8700Q PID mbed-dsp mbed-rtos mbed

FRDM-Copter

Hardware

So far the following boards are used:

In addition I am planning on using:

Implementation

I decided to use mbed platform as it allows easy CMSIS-DAP debugging and firmware can be easily ported to other mbed enabled devices in future.

Phase 1

Sensor fusion will be implemented and estimated orientation plotted over blue-tooth in the Android application.

Phase 2

PID controller will be used to maintain orientation and control the motors using PWM channels, tuning will be possible in the Android application.

Phase 3

Controll will be implemented with CR20A 2.4Ghz module for use with Frsky Taranis.

Phase 4

All schematics will be transferred to KiCad on a single board.

main.cpp

Committer:
Mashu
Date:
2015-07-08
Revision:
2:05aaa453fbac
Parent:
0:ec519775ae6f

File content as of revision 2:05aaa453fbac:

#include "mbed.h"
#include "rtos.h"
#include "MotionSensor.h"
#include "FXAS21000.h"
#include "FXOS8700Q.h"

Serial pc(USBTX, USBRX);
I2C i2c(PTE25, PTE24);
I2C i2c_gyro(A4, A5);

FXOS8700QAccelerometer acc(i2c, FXOS8700CQ_SLAVE_ADDR1);    // Configured for the FRDM-K64F with onboard sensors
FXOS8700QMagnetometer mag(i2c, FXOS8700CQ_SLAVE_ADDR1);
FXAS21000Gyroscpe gyro(i2c_gyro, FXAS21000_SLAVE_ADDR);

int main(void)
{
    motion_data_units_t acc_data, mag_data, gyro_data;
    
    acc.enable();
    mag.enable();
    gyro.enable();
    //printf("FXOS8700QAccelerometer Who Am I= %X\r\n", acc.whoAmI());
    //printf("FXOS8700QMagnetometer Who Am I= %X\r\n", acc.whoAmI());
    //printf("FXAS21000Gyroscope Who am I= %X\r\n", gyro.whoAmI());

    while (true) {
        // unit based results
        acc.getAxis(acc_data);
        mag.getAxis(mag_data);
        gyro.getAxis(gyro_data);
        /*
        printf("%1.4f,%1.4f,%1.4f,%4.1f,%4.1f,%4.1f,%1.4f,%1.4f,%1.4f\r\n", acc_data.x, acc_data.y, acc_data.z, mag_data.x, mag_data.y, mag_data.z,
        gyro_data.x, gyro_data.y, gyro_data.z);
        */
     
        printf("%1.4f,%1.4f,%1.4f\r\n", gyro_data.x, gyro_data.y, gyro_data.z);
        wait(0.5f);
    }
}