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.

Committer:
Mashu
Date:
Wed Jul 08 14:35:47 2015 +0000
Revision:
2:05aaa453fbac
Parent:
0:ec519775ae6f
Removed not working BLE_API

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mashu 0:ec519775ae6f 1 #include "mbed.h"
Mashu 0:ec519775ae6f 2 #include "rtos.h"
Mashu 0:ec519775ae6f 3 #include "MotionSensor.h"
Mashu 0:ec519775ae6f 4 #include "FXAS21000.h"
Mashu 0:ec519775ae6f 5 #include "FXOS8700Q.h"
Mashu 0:ec519775ae6f 6
Mashu 0:ec519775ae6f 7 Serial pc(USBTX, USBRX);
Mashu 0:ec519775ae6f 8 I2C i2c(PTE25, PTE24);
Mashu 0:ec519775ae6f 9 I2C i2c_gyro(A4, A5);
Mashu 0:ec519775ae6f 10
Mashu 0:ec519775ae6f 11 FXOS8700QAccelerometer acc(i2c, FXOS8700CQ_SLAVE_ADDR1); // Configured for the FRDM-K64F with onboard sensors
Mashu 0:ec519775ae6f 12 FXOS8700QMagnetometer mag(i2c, FXOS8700CQ_SLAVE_ADDR1);
Mashu 0:ec519775ae6f 13 FXAS21000Gyroscpe gyro(i2c_gyro, FXAS21000_SLAVE_ADDR);
Mashu 0:ec519775ae6f 14
Mashu 0:ec519775ae6f 15 int main(void)
Mashu 0:ec519775ae6f 16 {
Mashu 0:ec519775ae6f 17 motion_data_units_t acc_data, mag_data, gyro_data;
Mashu 0:ec519775ae6f 18
Mashu 0:ec519775ae6f 19 acc.enable();
Mashu 0:ec519775ae6f 20 mag.enable();
Mashu 0:ec519775ae6f 21 gyro.enable();
Mashu 0:ec519775ae6f 22 //printf("FXOS8700QAccelerometer Who Am I= %X\r\n", acc.whoAmI());
Mashu 0:ec519775ae6f 23 //printf("FXOS8700QMagnetometer Who Am I= %X\r\n", acc.whoAmI());
Mashu 0:ec519775ae6f 24 //printf("FXAS21000Gyroscope Who am I= %X\r\n", gyro.whoAmI());
Mashu 2:05aaa453fbac 25
Mashu 0:ec519775ae6f 26 while (true) {
Mashu 0:ec519775ae6f 27 // unit based results
Mashu 0:ec519775ae6f 28 acc.getAxis(acc_data);
Mashu 0:ec519775ae6f 29 mag.getAxis(mag_data);
Mashu 0:ec519775ae6f 30 gyro.getAxis(gyro_data);
Mashu 0:ec519775ae6f 31 /*
Mashu 0:ec519775ae6f 32 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,
Mashu 0:ec519775ae6f 33 gyro_data.x, gyro_data.y, gyro_data.z);
Mashu 0:ec519775ae6f 34 */
Mashu 0:ec519775ae6f 35
Mashu 0:ec519775ae6f 36 printf("%1.4f,%1.4f,%1.4f\r\n", gyro_data.x, gyro_data.y, gyro_data.z);
Mashu 2:05aaa453fbac 37 wait(0.5f);
Mashu 0:ec519775ae6f 38 }
Mashu 0:ec519775ae6f 39 }