BigHex deck?

Firmware/software/electronics/mechanics
Post Reply
japreiss
Beginner
Posts: 12
Joined: Thu Mar 24, 2016 1:17 am

BigHex deck?

Post by japreiss »

I'm wondering how difficult it would be to extend the BigQuad deck design to support six motors? I have no PCB design experience, but would this be a project suitable for an undergrad over one semester? I like hacking the CF firmware, I'm trying to avoid using pixhawk ;)
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: BigHex deck?

Post by arnaud »

The main designer of the bigquad deck (Tobias) is now in vacation but I can try to answer. The main things with the big quad deck is to be able to output PWM (PPM) signals for the motor driver, there is already 4 output implemented in the big quad deck so you are only missing 2 :-).

One way would be to create these two extra PWM channel using the STM32 timers. You can use the brushed motor output with a pull-up resistor (I think there is already a driver for that in the copter), or you can try to find extra timer output on the deck connector. There seems to be one extra timer channel available on PA5/SCK, I am not sure if there is a 6th one on the deck connector.

An alternative solution is to use an I2C PWM generator, something like that https://www.adafruit.com/product/815, if it is fast enough, it would be an easy way to add as many motors as you want to the Crazyflie. This would essentially replace the big quad deck.

Once you have the motor attached and controlled, all you need is to make a new powerDistribution for it, tune the PID and 'it should fly' :-).
japreiss
Beginner
Posts: 12
Joined: Thu Mar 24, 2016 1:17 am

Re: BigHex deck?

Post by japreiss »

That I2C PWM solution looks cool... I ordered one, I will try it out.

I do think it's kind of funny how we go from the flight controller, to PWM, and then the ESC digitizes the signal again in its firmware... I guess it's a relic of R/C airplane heritage?

I have Afro ESCs that also accept I2C input, but it seems like an undocumented/rarely used feature. Also there is no way to set the I2C address besides compiling a different version of the firmware for each ESC :roll: I am wary of messing around with ESC firmware and blowing up motors, but it would be really nice and clean to do the whole thing with two wires on the I2C bus as it was designed to be used...
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: BigHex deck?

Post by arnaud »

Yes, as far as I understand the PWM signal format comes from early R/C planes servo control (multiple PWM signals where sent in analog as a PPM signal and then separated for each servo). It is quite usual to stick to old format, for instance for a long time optical mouse sensor where outputting quadrature signals to imitate the rotary encoder on mouse balls ....

I am not too knowledgeable in ESCs but as an embedded system guy I would not use I2C outside of tight on-board connection. The Inter Ic Communication bus (I2C) was designed to connect multiple chip on the same board. Connecting board together with it is possible but can cause problems since there is nothing in the protocol to ensure data integrity and it uses pull-up to brings the lines high which means that you can start having problem if you use too long cables. If you keep everything tight you could try the I2C.

Compared to I2C the PWM signal should be much more robust, even though it is a bit old-school :).

A quick google search shows that connecting ESCs with I2C does not seem very popular. I found some doc about connecting them with a CAN bus, it makes much more sense since the CAN protocol is designed to connect boards with wires. However we do not have CAN support accessible on the Crazyflie and neither does your ESC.
japreiss
Beginner
Posts: 12
Joined: Thu Mar 24, 2016 1:17 am

Re: BigHex deck?

Post by japreiss »

OK, that makes sense about the long wires and data integrity. Getting an 0xFF instead of an 0x00 would be really bad when controlling motors :shock:. But the header pin connection from the Crazyflie to the Adafruit board should be OK, right?

In my code, should I be using the interface provided by i2cdev.h or i2c_drv.h ?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: BigHex deck?

Post by arnaud »

It should be no problem if you have the adafruit board close to the crazyflie and if the wire carrying the I2C is not running around the copter :-).

For an example of using the I2C in a deck driver you can look at the vl53 driver: https://github.com/bitcraze/crazyflie-f ... /vl53l0x.c. It is using i2cdev.h.
Post Reply