Skip to content

Commit

Permalink
Added iBUS schematic
Browse files Browse the repository at this point in the history
  • Loading branch information
EFeru committed Dec 7, 2020
1 parent ff9a135 commit 46d10a0
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 13 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Table of Contents
* [Example Variants ](#example-variants)
* [Flashing](#flashing)
* [3D Visualization Demo](#3d-visualization-demo)
* [Wiring iBUS Receiver](#wiring-ibus-receiver)
* [Contributions](#contributions)

---
Expand Down Expand Up @@ -49,8 +50,9 @@ For more details see the [MPU-6050 datasheet](/docs/1_MPU-6000-Datasheet.pdf) an
## Example Variants

This firmware offers currently these variants (selectable in [platformio.ini](/platformio.ini) or [config.h](/Inc/config.h)):
- **VARIANT_DEBUG**: In this variant the user can interact with sideboard by sending commands via a Serial Monitor to observe and check the capabilities of the sideboard.
- **VARIANT_HOVERBOARD**: In this variant the sideboard is communicating with the mainboard of a hoverboard using the [FOC firmware repository](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC).
- **VARIANT_DEBUG**: In this variant the user can interact with sideboard by sending commands via a Serial Monitor to observe and check the capabilities of the sideboard
- **VARIANT_HOVERCAR**: This variant can be used for Hovercar build. An RC receiver with iBUS protocol can be connected to the AUX serial Rx pin (see [schematic](#wiring-ibus-receiver))
- **VARIANT_HOVERBOARD**: In this variant the sideboard is communicating with the mainboard of a hoverboard using the [FOC firmware repository](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC)

Of course the firmware can be further customized for other needs or projects.

Expand Down Expand Up @@ -103,6 +105,14 @@ By [converting Quaternions to Euler angles](https://en.wikipedia.org/wiki/Conver
![sketch_pic](/docs/pictures/sketch_processing_pic.png)


---
## Wiring iBUS Receiver

An RC transmitter (Flysky [FS-i6S](https://www.banggood.com/custlink/3KvdPnfDPc) or [FS-i6X](https://www.banggood.com/custlink/KmDy5swKPD)) can be connected to the sideboard using an [FS-iA6B](https://www.banggood.com/custlink/KD3RFswKcT) receiver as shown in the following schematic:

![wiring_iBUS_pic](/docs/pictures/wiring_ibus_rc.png)


---
## Contributions

Expand Down
10 changes: 5 additions & 5 deletions Src/mpu6050.c
Original file line number Diff line number Diff line change
Expand Up @@ -3720,19 +3720,19 @@ void mpu_print_to_console(void)
{
#ifdef SERIAL_DEBUG
if (hal.report & PRINT_ACCEL) {
log_i( "Accel[XYZ]: %d %d %d\r\n", mpu.accel.x, mpu.accel.y, mpu.accel.z);
log_i( "accX:%d accY:%d accZ:%d\r\n", mpu.accel.x, mpu.accel.y, mpu.accel.z);
}
if (hal.report & PRINT_GYRO) {
log_i( "Gyro[XYZ]: %d %d %d\r\n", mpu.gyro.x, mpu.gyro.y, mpu.gyro.z);
log_i( "gyrX:%d gyrY:%d gyrZ:%d\r\n", mpu.gyro.x, mpu.gyro.y, mpu.gyro.z);
}
if (hal.report & PRINT_QUAT) {
log_i( "Quat[WXYZ]: %ld %ld %ld %ld\r\n", (long)mpu.quat.w, (long)mpu.quat.x, (long)mpu.quat.y, (long)mpu.quat.z);
log_i( "qW:%ld qX:%ld qY:%ld qZ:%ld\r\n", (long)mpu.quat.w, (long)mpu.quat.x, (long)mpu.quat.y, (long)mpu.quat.z);
}
if (hal.report & PRINT_EULER) {
log_i( "Euler[RPY]: %d %d %d\r\n", mpu.euler.roll, mpu.euler.pitch, mpu.euler.yaw);
log_i( "Roll:%d Pitch:%d Yaw:%d\r\n", mpu.euler.roll, mpu.euler.pitch, mpu.euler.yaw);
}
if (hal.report & PRINT_TEMP) {
log_i( "Temp: %d\r\n", mpu.temp);
log_i( "Temp:%d\r\n", mpu.temp);
}
if (hal.report & PRINT_PEDO) {
unsigned long timestamp;
Expand Down
13 changes: 7 additions & 6 deletions Src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ volatile int8_t i2c_aux_nRABytes;
#endif



/* =========================== General Functions =========================== */

void consoleLog(char *message)
Expand Down Expand Up @@ -182,10 +183,10 @@ void intro_demo_led(uint32_t tDelay)


uint8_t switch_check(uint16_t ch, uint8_t type) {
if (type) { // 3 position switch
if (ch > 850) return 2; // switch in position 2
else if (ch > 250) return 1; // switch in position 1
else return 0; // switch in position 0
if (type) { // 3 positions switch
if (ch < 250) return 0; // switch in position 0
else if (ch < 850) return 1; // switch in position 1
else return 2; // switch in position 2
} else { // 2 positions switch
return (ch > 850);
}
Expand Down Expand Up @@ -376,7 +377,7 @@ void handle_usart(void) {
/*
* Handle of the sideboard LEDs
*/
void handle_leds(void){
void handle_leds(void) {
#ifdef SERIAL_FEEDBACK
if (!timeoutFlagSerial1) {
if (Feedback.cmdLed & LED1_SET) { gpio_bit_set(LED1_GPIO_Port, LED1_Pin); } else { gpio_bit_reset(LED1_GPIO_Port, LED1_Pin); }
Expand Down Expand Up @@ -463,7 +464,7 @@ void usart_process_debug(uint8_t *userCommand, uint32_t len)
*/
#ifdef SERIAL_FEEDBACK
void usart_process_data(SerialFeedback *Feedback_in, SerialFeedback *Feedback_out)
{
{
uint16_t checksum;
if (Feedback_in->start == SERIAL_START_FRAME) {
checksum = (uint16_t)(Feedback_in->start ^ Feedback_in->cmd1 ^ Feedback_in->cmd2 ^ Feedback_in->speedR_meas ^ Feedback_in->speedL_meas
Expand Down
Binary file removed build/VARIANT_DEBUG/firmware.bin
Binary file not shown.
Binary file removed build/VARIANT_DEBUG/firmware.elf
Binary file not shown.
Binary file removed build/VARIANT_HOVERBOARD/firmware.bin
Binary file not shown.
Binary file removed build/VARIANT_HOVERBOARD/firmware.elf
Binary file not shown.
Binary file modified docs/pictures/GD_pics.pptx
Binary file not shown.
Binary file added docs/pictures/wiring_ibus_rc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 46d10a0

Please sign in to comment.