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.

Files at this revision

API Documentation at this revision

Comitter:
Mashu
Date:
Wed Jul 08 13:35:50 2015 +0000
Child:
1:b55a0bb3a4f4
Commit message:
Updated frdm-copter with tested sensors including gyro sampling at 50Hz.

Changed in this revision

FXAS21000.lib Show annotated file Show diff for this revision Revisions of this file
FXOS8700Q.lib Show annotated file Show diff for this revision Revisions of this file
PID.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-dsp.lib Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXAS21000.lib	Wed Jul 08 13:35:50 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/JimCarver/code/FXAS21000/#41bd7f360406
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXOS8700Q.lib	Wed Jul 08 13:35:50 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Freescale/code/FXOS8700Q/#aee7dea904e2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PID.lib	Wed Jul 08 13:35:50 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/aberk/code/PID/#6e12a3e5af19
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 08 13:35:50 2015 +0000
@@ -0,0 +1,74 @@
+#include "mbed.h"
+#include "rtos.h"
+#include "MotionSensor.h"
+#include "FXAS21000.h"
+#include "FXOS8700Q.h"
+
+#include <BLE.h>
+#include <BLEInstanceBase.h>
+#include "UARTService.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);
+ 
+BLEDevice  ble;
+UARTService *uart;
+
+void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
+{
+    ble.startAdvertising();
+}
+ 
+void periodicCallback(void)
+{
+}
+ 
+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());
+    
+    Ticker ticker;
+    ticker.attach(periodicCallback, 1);
+ 
+    ble.init();
+    ble.onDisconnection(disconnectionCallback);
+    
+    uart = new UARTService(ble);
+ 
+    /* setup advertising */
+    ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
+    ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
+    ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,
+                                     (const uint8_t *)"BLE UART", sizeof("BLE UART") - 1);
+    ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS,
+                                     (const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed));
+ 
+    ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */
+    ble.startAdvertising();
+    
+    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);
+        ble.waitForEvent();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-dsp.lib	Wed Jul 08 13:35:50 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/mbed-official/code/mbed-dsp/#7a284390b0ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Wed Jul 08 13:35:50 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#e695cd34556b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jul 08 13:35:50 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7
\ No newline at end of file