Open source ESC firmware for F5B - Page 3 - RC Groups
Thread Tools
This thread is privately moderated by jjmouris, who may elect to delete unwanted replies.
Jul 04, 2012, 08:04 PM
It's not uploaded as a standard download from github, since the default is still brake off. But the code is pushed there, and you can make your own by setting MOTOR_BRAKE to 1. There are also two new options, BRAKE_POWER and BRAKE_SPEED. If you set BRAKE_POWER to MAX_POWER, it works like it did before that commit, and the brake is not regenerative, but very strong. All other settings do some regeneration and this goes through the body diodes of the hide-side FETs, PWMing all low FETs at the same PWM rate as normal operation.

I was hoping to make the brake part actually happen as part of the PWM cycle, so that transitioning between brake and operation can happen at PWM rate, but for now it has to exit from running mode to enter brake mode. This is probably transparent for the most part, but there could be potential tracking issues if the brake is sent very briefly and running mode is requested again while the motor is still spinning at high speed. If there are any problems, the starting demag period could be reduced or removed again, or the first start cycle could be unpowered, or the brake PWMing has to be blended with the drive PWMing, which is significantly more work.

Anyway, see how it goes. YMMV, especially with different voltages and motors. The brake duty actually starts pretty high, since the force is very inverse-exponential to the duty. The trade-off with the linear duty rate slide I have in there now seemed to be that some motors don't start to slow down much at all until significant braking duty is present. It might need to be nonlinear.
Sign up now
to remove ads between posts
Jul 05, 2012, 02:09 PM
Needs to do 52 legs !!
jjmouris's Avatar
Thanks Simon.

That's right, the code is here.

So if i understand correctly, brake power set to max power would give full brake instantly with no stuff in between. This full brake would be all low side fets to ON and all the high side fets to OFF ? At what switching cycle of the fets? Still 16Khz?

What real world times can we expect with the various brake speed settings? Currently it is set to 3 out of 8 with 8 being the fastest? How short would 8 be?

The initial flight tests where with a Neu 1511/1Y/6.7 motor. This is probably one of the hardest to brake motors. Despite that, the brake worked well enough for an intermediate F5B pilots needs and so far no fire. Up to 4500W peak during a normal climb with some ramping and on 6S.

Sergey 17.5'' S-prop
Neu 1511/1Y/6.7 (~2900KV)
Red Brick 200A BEC
Turnigy 6S 3000mah 40C

It looks like the brake works well enough until down to just below half RPM and then there is a little delay before the prop stops fully. This delay seems to be about 0.3 seconds but it is hard to see since the RPM sensor is an electronical one and does some funny things.

See attached graphs.

Note, the RPM's are doubled due to me forgetting to set the Unilog properly. So max RPM is more like 55K on this drive.
Jul 05, 2012, 02:29 PM
Needs to do 52 legs !!
jjmouris's Avatar
Here is a plot of the LOW side fet temperature with 180 W.min left out of our 1750W.min allowance. So you can mentally add a few more degrees if you emptied the tank fully. However the ESC was probably still a little warm from the previous flight as you can see on the starting temperature.

Just a bit hot but not to bad.
Last edited by jjmouris; Jul 05, 2012 at 02:48 PM.
Jul 05, 2012, 03:13 PM
Originally Posted by jjmouris
Here is a plot of the LOW side fet temperature with 180 W.min left out of our 1750W.min allowance. So you can mentally add a few more degrees if you emptied the tank fully. However the ESC was probably still a little warm from the previous flight as you can see on the starting temperature.
Seems like it has pretty good thermal mass compared to the heat it is generating, but it's dissipating quite slowly. I'm guessing it's not getting much air flow? The plot doesn't seem to be rounding off yet and it would probably get much hotter if you kept going (eg: for 2 or 3 times as long). Anyway, if it keeps working, that's cool..
Jul 05, 2012, 05:09 PM
Needs to do 52 legs !!
jjmouris's Avatar
Originally Posted by simonk
Seems like it has pretty good thermal mass compared to the heat it is generating, but it's dissipating quite slowly. I'm guessing it's not getting much air flow? The plot doesn't seem to be rounding off yet and it would probably get much hotter if you kept going (eg: for 2 or 3 times as long). Anyway, if it keeps working, that's cool..
This is the thing, there is not much cooling and at these power levels you would need a LOT of cooling to keep things from cooking despite the relatively high efficiency. If you kept going the motor would cook as well, no doubt about it. This is why we have the 1750W.min Energy limit. That is about 50% out of a 500 gram Lipo pack.

I'd have to go try a CC P125 modified as per George's instructions on the same setup to see how hot that gets for a fair comparison. Unfortionately i can't really be asked to do that right now even tho i do have one spare. I will keep these logs for my records and maybe sometime later try that just to see. For now as long as it doesn't exceed 90 degrees i am happy.

Jul 05, 2012, 06:30 PM
Registered User
WimH's Avatar
Originally Posted by jjmouris

You can see that the P180 with it's CC firmware actually wastes a fair bit of time kicking the motor round before it starts to seriously increase the RPM.

I've been wondering what my CC180 is doing here (yellow circle). It' not always the same on every climb, sometimes it's just the slope changing a little. Is this what you mean here or is it something else?
Jul 05, 2012, 07:02 PM
Needs to do 52 legs !!
jjmouris's Avatar
Wim, yes.

Your time scale is very big there and if you zoom in you will see how long it actually takes. You are probably using a higher starting power then me and so this blip accors at a higher power for you then it does for me. I am using only 9% start power these days.

The blip is the firmware going from starting mode into running mode only it's maybe a little late as the motor is well and truely spinning by then and it is subsequently also trying to match what you are requesting it to do in terms of throttle input. Sometimes this blip will not show due to the low recording frequency of the Unilog and rapidly rising Watts.

In Simon K 's firmware there is no such blip. Not really sure how he has done it but the changeover between starting mode and running mode is much better.
Jul 05, 2012, 07:51 PM
The starting mode and running mode are actually the same code path, with just a flag that turns off the commutation timing wait and uses a fixed post-commutation blanking window. These are set to dynamic amounts based on sensed timing when in running mode. In starting mode, there is only a timeout commutation advance to try to get it spinning if it's stuck without a zero-crossing, and the requested duty cycle is limited to PWR_MIN_START growing to PWR_MAX_START. It also halves the PWM frequency, mostly just as an audible marker to make it apparent that it's in starting mode. That's it..
Jul 06, 2012, 05:37 AM
Needs to do 52 legs !!
jjmouris's Avatar
You make it sound so simple!

So that then makes me wonder what the CC firmware is doing. Or for that matter any of the other ESC's out there as most have this little jump during startup.

Waiting for the sun to come out...... static test with BRAKE_SPEED 4 seems good.
Jul 06, 2012, 02:57 PM
Registered User
Originally Posted by jjmouris
You make it sound so simple!

So that then makes me wonder what the CC firmware is doing. Or for that matter any of the other ESC's out there as most have this little jump during startup.

Waiting for the sun to come out...... static test with BRAKE_SPEED 4 seems good.
CC use a 4 stage start-up. They start at 1.5 kHz, increase the pulse width, halve it and switch to 3kHz, increase it again, halve it and switch to 6kHz, increase it again, halve it and switch to 12kHz or so. The initial pulse width is about 18 us on "medium power star-up 79 %). This is all observed on Phoenix version 1.56. Perhaps the zig-zag is one of these, probably the last, changeover.

I presume that the reason for this is that they need a longish pulse width to measure the zero crossing, most likely with pulse on.

But it is dangerous as the current can rise very high in exceptional circumstances and the ESC can catch fire at start-up, as has just happened to Steve Burns and has been reported many times on rcgroups, even in the Castle vendor thread. It is a particular problem in F5B with our high voltages, low inductance and low resistance motors.

Joe, did the sun not come out down south! Keen to hear your report.
Jul 06, 2012, 04:50 PM
Needs to do 52 legs !!
jjmouris's Avatar
Complete and utter success!!!!

Simon sent me the whole list of brake speed options and i changed it up one step each flight.

The ramp time is halved at each increase in brake speed, assuming that brake speed 3 gives 0.5 seconds then speed 4 gives 0.25 seconds, 5 gives 0.125 seconds and 6 gives 0.0625 seconds. Brake speed 6 is where i stopped, didn't feel the need to try 7 as you could only hear the blades slamming on the side of the fuselage!

For referance, on the CC firmware if you use Very Fast on the brake ramp it is equal to 0.1 seconds according to Castle. Or so Roy told me earlier today.

At home after close inspection i could not see any damage to the prop or the output shaft of the gearbox for that matter. The prop came off no problem.

All that is left to do now is fly it much more and maybe later up the power a little. Need to get many cycles on this to prove reliabilaty over time. So far 8 cycles.

THANK YOU SIMON !!! Let me know how to send you a crate of beer and it will be done.

Last edited by jjmouris; Jul 08, 2012 at 10:46 AM.
Jul 07, 2012, 01:38 AM
Registered User
Mutchy's Avatar
Hi Joe.
First congratulations to you and Simon and George: very impressive! I assume you are referring to the Red Brick ESC and the setup in report #32.
I am mightily unimpressed with my Red Brick on 6s. The start up ramp in the ESC is soft, but not inconvenient for someone who flies a hotliner rather than serious F5B. But the brake is tragically slow and I can see the reason for your jubilation above.
Richard (Solomon) has a green card type Red Brick and a high temp fine point soldering iron and is going to attempt to solder some fine single strand wire onto the legs of the chip so we can load the firmware. We have loaded open source firmware into our 9x radios so the process is not unfamiliar, however can you detail for us what we need to do?
BTW referring to the blip in the curve maybe it's due to the change in moment of inertia of the blades as they unfold and/or the change in propellor aerodynamics as it reaches pitch speed?
Oh, and another Red Brick thing- Do yours get really hot while waiting to launch? I mean untouchable hot? Mine also achieved heat shrink melting temperature while trying to program it with the Tx stick when I first received it. My Unilog trace shows 80 to 100 watts being used to make that annoying "I have no Rx signal" series of four beeps.
Congrats again
Jul 07, 2012, 03:10 AM
Registered User
Hi Steve,
Does your green board have an MLF or TQFP microprocessor? One of mine has an MLF chip, as does one of Joe's. Even Simon was despairing at the MLF. Joe managed to solder wires to his MLF, congratulations to him, he shows a picture in post 14. I failed after several attempts and ended up having to pick out shorting solder with a pin.
Only the MISO, MOSI and SCK pins are the problem. The reset pin has a solder pad and the GND is readily available elsewhere.
In the end I made three probe wires by soldering the flasher wires to normal dressmaking pins. Then held the dressmaking pins in contact with the microprocessor pins, easy and clean to do. They make a micro pit in the microprocessor pins which stops them slipping.
If you are an octopus it is then very simple. But I manage to hold the MISO, MOSI pins in one hand once they are firmly place, hold the SCK pin in the other, and get my wife to operate the computer. Fortunately it all seems very robust and the occasional slip is not (so far) disastrous. I don't use the VCC, keep clear of that, my flasher is wired to assume 5V.
I will probably use this technique for the huge TQFP package even though an elephant could cope with them after MLF!
Last edited by George Shering; Jul 07, 2012 at 03:26 AM.
Jul 07, 2012, 12:00 PM
Needs to do 52 legs !!
jjmouris's Avatar
Steve, My controllers only had 4 option rather then 6 and didn't seem to get hot programming. I used 3S to program them. The motor would get hot after only a few short runs tho. But all this doesn't really matter as with the new firmware it's as good as gold. They do not get hot at all sitting on the bench with 6S and short motor runs does not heat the motor up either. Frankly i think these controllers with the new firmware are better then the classic CC P125 or the ICE 200 (Lite) in terms of performance for money and for our purposes. No need to physically modify the boards, the start is better and the brake also. Both these controllers should be able to run about the same power. You may wish to add some better capacitors if you also plan to use ramps.

There are a fair few versions of the 200A controller out there, sold under different names, some with BEC others without. So far we have seen 3 different versions of the logic board layout that each need a different hex file to work correctly. Some have different fets, it's hard to tell what you will get and if it makes any real difference. You would want to get a TQFP packedge processor as it's far easier to solder to. But it may prove difficult to know for sure what you will get when you order. Maybe in future there will be programming pads?! At the moment both the controllers i bought (Red Brick) have gone out of stock, also the SS series is out of stock in China but it seems like you guys down in Australia are lucky as there is still 10+ stock there. I also think these are usuable. Boat series, makes no difference after the new firmware is on there and the heatsink should come right off anyway;

Birdie, a little more expensive but available at least;

If you do a search for 200A on the Hobbyking website you will get a nice list of what is currently in stock and then you can pick what you want to try. You can also try your luck on Himodel, e-bay or the web in general. It's very easy to spot these ESC's when you have seen one.

When you get your ESC you should try to compare it to the below list in order to kick the right hex file if there indeed is one to match what you have. Be sure to check the pictures and not just blindly go by the name.

As for flashing the firmware on there, there is a very extensive thread on this that i linked to in my first post. I think it's best to refer to this if anyone has any questions. However i will list what i have used as an example, there are many options out there.

I used the USBasp dongle from Hobbyking as per my first post. I use the KKflashtool version V0.63 beta 8 as this has a function to enable the bootloader at the same time as flashing so that you don't have to set the fuses seperately. When subsequently using the Turnigy USB linker, you want to use the SERIAL version of the KKflashtool that is in the same folder when you have installed it as this will allow you to set the COM port. Unplug the red wire from the RX cable going into the Turnigy USB linker. I use a small 2S 360mah Lipo to power the ESC when programming and testing. No prop! If you don't get the 3 beeps + arming tone then don't try to run it!!! You likely have the wrong hex file!!! That's basically it.

I don't know if Simon will want to add all the various brake setting files for the 3 different controller versions (rb70a, birdie70a and hk200a) to the tree at github so that they will remain up to date with new versions of the firmware coming out? I've got the rb70a and birdie70a files here if anyone wants them anyway, just need the hk200A ones still. With a bit more time invested i should also be able to build these hex files for other controller versions in future.

Last note, you need some kind of ramp on the TX to slow the start down or you may break your props. Maybe Simon can add a startup ramp just like the brake one to increase the time it takes to reach full power to 0.25 seconds, that way most props should be fine. But maybe this will take some time to do and Simon is going off on holiday soon.

George, when i soldered to the MLF i used a lot of fresh resin core solder and this tends to form balls and run off the board, not shorting any of the pins out. Whenever i get stuck i actually flood the area with fresh solder and end up back with a clean board. You have to be carefull not to break the legs when putting strain on the wires. One of my legs is now shorter then the others and i am glad i now have the bootloader as it's probably impossible to solder to it now. With the TQFP it's actually more easy to short the legs together and then you need a sharp knife plus fresh solder to seperate the two. My experiance anyway.

For those who don't feel confident or screw it up, i will provide a service against minor payment. I may also buy a bunch and offer them for sale.

Last edited by jjmouris; Jul 07, 2012 at 12:15 PM.
Jul 07, 2012, 04:00 PM
Registered User
Joe, when you are doing test flights could you install a temperature sensor on the motor as well as on the controller. This could be an important check.

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion NeXtcopterPlus open-source release for KK and KK+ boards HappySundays Multirotor Drone Electronics 812 Jan 09, 2013 04:10 PM
Idea Motor, ESC, battery DYNO open-source project Mastino Power Systems 4 Jul 10, 2012 12:16 AM
Discussion Any Open Source / CC CAD Files for gliders? DrFragnasty Composites Fabrication 8 Apr 09, 2012 06:36 AM
New Product Rock ESC - a new open source ESC in town hols DIY Electronics 26 Mar 23, 2012 05:52 PM
Question Graphical designer for Open Source FrSky Android Dashboard Takilara DIY Electronics 2 Dec 09, 2011 08:38 AM