Being an economical option for flight controller, the KK2.1.5 is widely used and enough to get your quadcopter in the air. Unfortunately, it is not straightforward to interface it with a custom microcontroller. Having a raspberry pi to drive the flight could open a lot of possibilities - How about an autonomous quadcopter? If you ever tried to interface KK2.1.5 with a raspberry pi or might find yourself doing it, you are in the right place. Also check out our video on this in YouTube.

The process starts with sniffing the signals from the RC receiver sent to the KK2.1.5 controller. Connecting Pi's GPIO to the RC receiver directly is one way to burn your SoC as Pi is not 5V tolerant. An Arduino board, spoofing in the place of KK2.1.5, is more appropriate to betray signals coming out of the radio receiver. It is known that the KK2.1.5 expects Pulse Width Modulated (PWM) signals over four channels. Besides heuristically determining the signal's frequency (50Hz), we inferred other signal characteristics from the Arduino readings.

Arduino connected to fs-r6b receiver

As we know, the PWM signals in the four channels - Aileron, Elevation, Throttle, Rudder - drive the quadcopter. In our experiment, we observed 50Hz PWM signals with their duty cycle in the range ~4% to ~10%. For example, examining channel 3 (throttle), half throttle produced a PWM signal with ~7% duty cycle, while full-throttle witnessed a ~10% duty cycle. These numbers might differ based on the parts. The Arduino code to find PWM's duty cycle can be found here for reference.

PWM signal to be sent in Channel 3 for cutting off throttle - 4% duty cycle
PWM signal to be sent in Channel 3 for full-throttle - 10% duty cycle

Subsequently, knowing the signal characteristics, the r-pi is programmed to control the quadcopter by generating the required PWM signals. Thus Raspberry Pi, taking the place of the remote control receiver, can run custom code to pilot the quadcopter. The python script to generate PWM signals for KK2.1.5 can be found here.