HobbyKing.com New Products Flash Sale
Reply
Thread Tools
This thread is privately moderated by Steveis, who may elect to delete unwanted replies.
Old Dec 22, 2012, 06:16 AM
AVR Dude
United Kingdom, England, Cnwll
Joined Jul 2011
1,658 Posts
Discussion
KK Software for Original Board with Stick Centreing

I get frustrated when poeple say that the KK firmware for the original board (without the LCD) is no good. All you have to do is be brave and trim your transmitter.

However, for those that have requested it, I've added some code to the KK Quad V4.7 and Tri V1.6 for the board to learn where Stick Centre is. This will help if you have the lazy motor 4 problem.

The code is now too big for the M48 chip so this is for the M168 and M328 chip only.

Everything is the same as V4.7 and V1.6 except the way to get the board to learn the Stick Centre but first you must set up your transmitter: -

a) Set to Aeroplane mode.
b) Centre all Sub Trims
c) Centre all trims
d) Put throttle trim to minimum
e) Do not set dual rates - leave all rates at 100%
f) Set end point adjust (travel) to 100%
g) Use Expo as required

Now, follow this routine to get the KK board to learn Stick Centre (it actually only checks the Rudder stick and assumes others are the same): -

1) Turn on the transmitter
2) Set Yaw and Roll pots to zero (usually CCW)*
3) Turn on Flight Controller
4) The led should flash slowly 10 times
5) Now, the KK board reads the centre of the Rudder stick
6) The led should flash rapidly to say it has finished
7) Power down the Flight Controller
8) Set pots to normal

* I didn't use the Pitch Pot to enter this mode as that is used to change the arming direction in the Tricopter software. I also like to be able to set the I term to zero when setting up a quad.

Now you should be able to fly. You may need to slightly adjust trims to compensate for your CoG being slightly out or your roll and pitch gimble being slightly differnt to the yaw gimble.

If you don't do the above, it assumes 1500 usec centre. If your rudder stick centre is less than 1400 usec or more than 1600 usec, the board defaults to 1500 usec.

There are files for ScaleStick 5, 4 and 3 (default, acro and aggresive).

The only other change to the code is that the arming LED stays on when you are calibrating the throttle limits on the ESCs. Seems a little dangerous being in Throttle calibration mode without the arming LED on. Also draws your attention to it if you are accidentally in this mode.

Respect to the Kaptein.

Enjoy
Steveis is offline Find More Posts by Steveis
RCG Plus Member
Last edited by Steveis; Dec 23, 2012 at 01:25 PM.
Reply With Quote
Sign up now
to remove ads between posts
Old Dec 23, 2012, 01:06 PM
Registered User
Cheyenne, WY
Joined Oct 2010
114 Posts
download your X mode file was getting ready to flash but noticed the hex file for SS4 is labled as a +. is it just mislabled? can't wait to try.
augerN is offline Find More Posts by augerN
Reply With Quote
Old Dec 23, 2012, 01:20 PM
AVR Dude
United Kingdom, England, Cnwll
Joined Jul 2011
1,658 Posts
Quote:
Originally Posted by augerN View Post
download your X mode file was getting ready to flash but noticed the hex file for SS4 is labled as a +. is it just mislabled? can't wait to try.
Oops, it was an error in naming the file. I tested SS5 and then compiled SS4 and SS3. I have updated the zip file.
Steveis is offline Find More Posts by Steveis
RCG Plus Member
Old Dec 23, 2012, 01:50 PM
Registered User
Cheyenne, WY
Joined Oct 2010
114 Posts
Cool! Love these 5.5 boards. Great to see somebody working to make them stupidproof. Now I have a reason to build another Quad. Thanks!
augerN is offline Find More Posts by augerN
Reply With Quote
Old Dec 25, 2012, 06:24 AM
KK Tri Flyer
mattcro's Avatar
United Kingdom, Scotland, Glasgow
Joined Feb 2012
346 Posts
I had a bit of time and brief window of clear calm weather this morning so I flashed your SS4/acro tricopter firmware on my RCExplorer tri with HK-KK2.1 (M168). I wanted to try faster rates (getting into more acrobatic flight) as well as centering.

Stick Centreing works fairly well (I reset all my trims to neutral), although I have done it a few times in a row and get slightly different centre points each time - just enough to have the tri drifting one way or another and needing a couple of clicks of trim to stabilise.

I don't know if that's down to clock or gyro drift, or just timing tolerances in the PPM reading. Would it be much trouble to take a few RX channel readings and average them for the centre calibration? It would be interesting to see if that helps.

In any case, it works well and will hopefully make it easier/simpler than fiddling with lots of trim!

Cheers, and enjoy your Christmas and New Year!
mattcro is offline Find More Posts by mattcro
Reply With Quote
Old Dec 26, 2012, 01:35 PM
Registered User
United States, CA, Anaheim
Joined Dec 2012
57 Posts
Quote:
Originally Posted by Steveis View Post
...it actually only checks the Rudder stick and assumes others are the same......You may need to slightly adjust trims to compensate for ... your roll and pitch gimble being slightly differnt to the yaw gimble.
From the above I presume that the tx deviation that causes 'Lazy4' is a proportional and linear effect across all channels. In other words, the offset is the same amongst throttle, yaw, pitch, and roll. That's why you only check the rudder channel.

Reason I ask is, I typically have to apply significant trim to pitch and roll, but a negligible amount to yaw. If you only look at yaw, how will it fix pitch/roll?
mageus is offline Find More Posts by mageus
Reply With Quote
Old Dec 26, 2012, 01:59 PM
KK Tri Flyer
mattcro's Avatar
United Kingdom, Scotland, Glasgow
Joined Feb 2012
346 Posts
Theoretically, the KK board trim issue should affect the roll, pitch and yaw channels equally. Basically, the timer that measures the servo pulses from the RX is running slightly fast (or maybe slow in some cases) and therefore all channels will be miscalculated by the same factor.

On my DX6i and tricopter with stock v1.6 firmware, I needed approx the same amount of subtrim on these channels for level/stable flight.

With Steve's stick centreing firmware, I only need a couple of clicks of pitch and roll trim to fly level after doing the stick centreing (all TX trims/subtrims at centre) and balancing the frame CG.

If your frame dimensions, CG or ESC calibration are slightly off, you will need to apply some TX trim to get your copter flying level. The yaw is less affected by CG.
mattcro is offline Find More Posts by mattcro
Reply With Quote
Old Dec 26, 2012, 11:07 PM
Registered User
United States, CA, Anaheim
Joined Dec 2012
57 Posts
Can someone please edumicate me? From what I can gather from the nomenclature, I'm guessing the rx sends a simple pulse wave signal to the servo, the base (or 0 trim) frequency being around 666Hz (dependent on the rx manufacturer). Lazy4 happens because of 2 things:

- Slight variations in tx/rx mfgs' base rate
- Cheapo FC clock that doesn't know what 1 second is.

If this is correct, then it makes sense that all channels would have the same deviation, and calibrating off of one channel would be just fine.

The other issue is FC clock drift, which means you have to keep trimming during flight. But that's why I have an APM 2.5 on the way.

I tested on the bench with props off, and couldn't get it trimmed in, so my Lazy4 was pretty bad even before CG issues. For now I'll stick with Pug's 1530us 4.7 FW, which works fine for me. But thanx for all the hard work, Steve.
mageus is offline Find More Posts by mageus
Reply With Quote
Old Dec 27, 2012, 03:49 AM
AVR Dude
United Kingdom, England, Cnwll
Joined Jul 2011
1,658 Posts
The biggest issue is different manufacturers using different pulse widths for centre stick. Most use 1500 usec or 1520 usec. It would appear some use other values due to Pug's versions working well for some people (1530, 1540 etc). Since Pug only changes one value which is used for roll, pitch and yaw and it has helped many people, I just read in the yaw at centre stick and used that.

In cheaper transmitters, another error could be the mechanical set up of the pots connected to the transmitter gimbals. Other errors are: -

1. Pulse generator in the tx.
2. Pulse recovery in the rx.
3. Clock rate of FC*
4. Centre of gravity and centre of thrust.
5. ESC clock rate (drifting across all ESCs).
6. ESC calibration (needs to be the same across all ESCs - only apparent at max throttle).
7. Motor manufacture tollerances.
8. Angle of motor mount (even a few degrees can make a difference).

* Then again, I'm not too sure about this one. If it was slow or fast, it would read an incorrect value but I think this would be cancelled out by the incorrect pulse width it generates. It's relative.
Steveis is offline Find More Posts by Steveis
RCG Plus Member
Last edited by Steveis; Dec 27, 2012 at 07:42 AM.
Reply With Quote
Old Dec 27, 2012, 07:41 AM
AVR Dude
United Kingdom, England, Cnwll
Joined Jul 2011
1,658 Posts
Quote:
Originally Posted by mattcro View Post
I don't know if that's down to clock or gyro drift, or just timing tolerances in the PPM reading. Would it be much trouble to take a few RX channel readings and average them for the centre calibration? It would be interesting to see if that helps.
I've tried taking the average of 32 readings but it didn't make any difference so it must be a little drift over time.
Steveis is offline Find More Posts by Steveis
RCG Plus Member
Old Dec 27, 2012, 03:10 PM
KK Tri Flyer
mattcro's Avatar
United Kingdom, Scotland, Glasgow
Joined Feb 2012
346 Posts
Steveis, I've since tried the stick centreing again and figured that any errors I'm getting are probably just KK clock drift or slight imbalances/CG. It generally works pretty well and I'm always within a couple of clicks of correct trim anyway.

It doesn't help that I changed 2 variables when flashing your firmware - I'm now on acro (stickscale 4) and was on stock v1.6 (stickscale 5), so any TX trim imbalance is more apparent in pitch/roll/yaw rate.

When I was first experimenting with the KK board, I concluded that the lazy motor issue was simply due to the AVR RC oscillator frequency being slightly off. I measured my RX output pulse widths at exactly 1500us (on a scope) with centred sticks and trims.

The KK code has some debug output that I enabled to send the measured pulse widths out as serial data. To get the KK output showing 1500us, I had to set the TX trims so that the RX was producing something like 1465us, which implies that the clock oscillator was running around 2% fast. The datasheet implies that the oscillator is factory trimmed to within 10% of 8MHz (yes, only ten percent!).

This means the KK firmware thinks you are giving up elev and right aile input, and it tries to rotate in that direction. If it's on the ground, that means that the rear-right motor (X quads) will slow down (as the gyro error builds up).... lazy motor.

The output pulses will also be off by this amount, but as they are all out by the same factor it won't affect flight because all motors will run at the same rate (except maybe tri tail servo, which could explain why I always needed slightly different tail trim).
mattcro is offline Find More Posts by mattcro
Reply With Quote
Old Dec 27, 2012, 04:05 PM
AVR Dude
United Kingdom, England, Cnwll
Joined Jul 2011
1,658 Posts
Why is any clock drift not due to the oscillator in your transmitter or receiver?

Lazy motor 4 is certainly due to different manufacturers choosing different values for centre stick. Most are 1500 or 1520 usec. Those close to 1500 do not see the problem. Spektrum are 1520 usec so do see a little problem. Others are 1530 and 1540 so see a bigger problem. KK2 has a nice crystal oscillator but I still have to trim

How do you know your receiver should be outputting 1500 usec at centre stick? Um, Spectrum is 1520 usec at centre stick!

Just some interesting debate
Steveis is offline Find More Posts by Steveis
RCG Plus Member
Last edited by Steveis; Dec 27, 2012 at 04:15 PM.
Reply With Quote
Old Dec 27, 2012, 05:29 PM
Registered User
United States, CA, Anaheim
Joined Dec 2012
57 Posts
Well, I can say that I'm getting a little bit of both.

I have a Dx6i, so that should put me at 1520us. However, 1530 works best for me, so there must also be contribution from the FC clock.

Also, it's been cool outside recently. (I'd like to say cold, but I live in CA, and I'm sure I'd raise the ire of East Coasters / Mid Westeners if I went that far) I have to keep adjusting trim for the first battery pack, after which it settles down. So there's definitely some temperature drift going on also.
mageus is offline Find More Posts by mageus
Reply With Quote
Old Dec 28, 2012, 06:43 AM
KK Tri Flyer
mattcro's Avatar
United Kingdom, Scotland, Glasgow
Joined Feb 2012
346 Posts
The TX and RX use crystal oscillators, which are several orders of magnitude more accurate than an RC oscillator, and a lot more stable with varying voltage and temperature - their timing should be spot-on. I've just checked the servo pulse outputs on my Spektrum AR6210 on the tri, and also 2 Orange 6 channel DSM2 RXs - all within a hair of 1500us on oscilloscope and pulse/frequency counter at centre stick and no trims.

I don't actually know if Spektrum use 1500us as standard - I've just assumed that from the RX measurements, but I've seen Spektrum servo specs with centre at 1520us and my DX6i trainer port is somewhere in between at around 1510us...

Something to try if you have KK tri v1.6 firmware is measure the M6 output pulse width. Going by the code it should be exactly 1000us as a timing reference controlled by hardware Timer2. My board produces around 985us which confirms that the RC oscillator is running slightly fast.
mattcro is offline Find More Posts by mattcro
Reply With Quote
Old Dec 29, 2012, 12:30 PM
Registered User
Cheyenne, WY
Joined Oct 2010
114 Posts
Great job Steveis

Decided to build a Tri instead of a quad a T really. When I was buliding the tilt I centered the servo to the trans. when I powdered up the FC the tail motor was tilted 20 degrees left, did the centering routine and BAM went to center. Who could ask for more? Thanks Bud.
augerN is offline Find More Posts by augerN
Reply With Quote
Reply

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion OpenAero open-source stabilisation software for KK boards HappySundays FPV Talk 1878 Jul 21, 2014 09:09 AM
Discussion Stick centring for KK Board chullaa Multirotor Electronics 1 Mar 23, 2013 06:31 PM
Question Original HK KK V2.1 board firmware?? Thomasvijf Multirotor Talk 2 Sep 02, 2012 11:59 AM
For Sale HK KK Board + Programmer, and KK Balck Board + Programmer For Sale Actuality Aircraft - Electric - Multirotor (FS/W) 11 Apr 29, 2012 08:27 PM
For Sale KK Board 5.5e with LCD and MKUSB LInker for KK+ pajonate Aircraft - Electric - Multirotor (FS/W) 2 Mar 04, 2012 08:59 PM