Skip to main content

ยท 2 min read
Ray Bello

Matek inspired this...โ€‹

I've spent alot of time thinking about an ideal size for my final PCB. There are currently some contraints that should be taken into account when planning on minimizing cost, maximazing flexibility and adhereing to airframe dimensions.

I have been doing some research on this topic and I've found that there seems to be a widespread agreement on what an ideal size should be for an onboard flight control system (amongst hobbyists and commercially).

MatekSys have made numerous flight control boards over the years so its safe to say their designs have been tried and true especially in the hobbyist community. The F405 Wing is probably one of their most popular boards. And I happen to own a couple F405's myself.

img
F405 Wing (left), F411 Wing (right)

Small Big Brotherโ€‹

The F411 Wing is the smaller updated version of the F405 board with all the essentials included. I don't own one but I plan on using a layout very similar to the F411 in my own design. The peripherals, connector and solder pad placement are some of the main traits that I plan on trying to carry over into my own design.

Updates to follow...

ยท 2 min read
Ray Bello

IMU Configurationโ€‹

Sequenceโ€‹

Added a step to select the internal 8Mhz oscillator as the clock source

// Set MPU9250 Clock Source to use the X Gyro for reference, which is slightly better than the default internal clock source.
// +-----+-----+-----+-----+-----+-----+-----+-----+
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// +-----+-----+-----+-----+-----+-----+-----+-----+
// | | | | | | CLKSEL[2:0] |
// +-----+-----+-----+-----+-----+-----+-----+-----+
uint8_t buf[2] = {MPU9250_RA_PWR_MGMT_1, MPU9250_CLOCK_PLL_XGYRO};
i2c_write_blocking(i2c_default, this->i2c_addr, buf, 2, false);
#if defined IMU_VERBOSE_CONFIG
printf("[IMU][CONFIG] wrote %d to MPU9250_RA_PWR_MGMT_1:%d\n", buf[1], MPU9250_RA_PWR_MGMT_1);
#endif
sleep_ms(DELAY_BETWEEN_WR_MS);

Added full scale range sensitivity selection for both accelerometer and gyroscope.

// Set Gyro full scale range
// +-----+-----+-----+-----+-----+-----+-----+-----+
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// +-----+-----+-----+-----+-----+-----+-----+-----+
// | | | |FS_SEL[1:0]| | | |
// +-----+-----+-----+-----+-----+-----+-----+-----+
buf[0] = MPU9250_GYRO_CONFIG;
buf[1] = (uint8_t)setting.gyro_fs_sel << 3;
i2c_write_blocking(i2c_default, this->i2c_addr, buf, 2, false);
#if defined IMU_VERBOSE_CONFIG
printf("[IMU][CONFIG] wrote %d to MPU9250_GYRO_CONFIG:%d\n", buf[1], MPU9250_GYRO_CONFIG);
#endif
sleep_ms(DELAY_BETWEEN_WR_MS);

// Set Accel full scale range
// +-----+-----+-----+-----+-----+-----+-----+-----+
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// +-----+-----+-----+-----+-----+-----+-----+-----+
// | | | |AFS_SEL[1:0]| | | |
// +-----+-----+-----+-----+-----+-----+-----+-----+
buf[0] = MPU9250_ACCEL_CONFIG;
buf[1] = (uint8_t)setting.accel_fs_sel << 3;
i2c_write_blocking(i2c_default, this->i2c_addr, buf, 2, false);
#if defined IMU_VERBOSE_CONFIG
printf("[IMU][CONFIG] wrote %d to MPU9250_ACCEL_CONFIG:%d\n", buf[1], MPU9250_ACCEL_CONFIG);
#endif
sleep_ms(DELAY_BETWEEN_WR_MS);

Validating Sequenceโ€‹

[IMU][CONFIG] wrote 1 to MPU9250_RA_PWR_MGMT_1:107
[IMU][CONFIG] wrote 0 to MPU9250_GYRO_CONFIG:27 // GYRO_250DPS
[IMU][CONFIG] wrote 0 to MPU9250_ACCEL_CONFIG:28 // ACCEL_2G

Tasks contd.โ€‹

MPU9250 IMU Driverโ€‹

  • Done: Implement full scale range and gyro sensitivity selection, currently using default settings.
  • Done: Add hardware reset & calibration sequence

Attitude Estimationโ€‹

  • Done: Refactor the existing attitude estimation algorithm with modularity/flexibility in mind.

Defines Usedโ€‹

#define DELAY_BETWEEN_WR_MS         50        // Delay between I2C writes during configuration
#define MPU9250_GYRO_CONFIG 0x1B // Gyro FS_SEL address
#define MPU9250_ACCEL_CONFIG 0x1C // Accel AFS_SEL address
#define MPU9250_CLOCK_PLL_XGYRO 0x01 // Xgyro pll clock
#define MPU9250_RA_PWR_MGMT_1 0x6B // Power management register 1 address

ยท One min read
Ray Bello

Tasks contd.โ€‹

MPU9250 IMU Driverโ€‹

  • Completed: Implement full scale range and gyro sensitivity selection, currently using default settings.
  • Completed: Add hardware reset & calibration sequence

Attitude Estimationโ€‹

  • Completed: Refactor the existing attitude estimation algorithm with modularity/flexibility in mind.

ยท One min read
Ray Bello

The system is currently in a stable state with regards to various sensor drivers and core flight logic. Although there are a lot of tuning modifications that need to be added to the attitude estimation madgwick filter to make it flight worthy...

Current tasksโ€‹

  • MPU9250 IMU Driver
    • In-Progress: Implement full scale range and gyro sensitivity selection, currently using default settings.
    • Outstanding: Add hardware reset & calibration sequence