CleanFlight supports RGB LED strip, which is really great. In this post I will show you how I setup and configure LEDs in Naze32 Cleanflight. Same should work for CC3D too.
RGB LED does not only help you identify your quadcopter easier, it can also indicate many flight data using different colours, such as battery level warning (voltage alarm), flight mode indicator, orientation lights, RSSI singal strength, thrust levels etc.
To learn how to flash CleanFlight Firmware on your Naze32 or CC3D.
To learn other ways of turning LEDs on and off using Radio transmitter.
Recommended LED Strip for Cleanflight
This LED feature of Cleanflight are primarily designed for addressable LED strips. The recommended type of LEDs are called WS2812. These LEDs comes all connected as a strip, you can cut it to whatever length or number of LEDs you like. They only needs 1 data input, and takes 5V power supply.
I am using WS2811, they look identical to the WS2812, which also seem to work fine. These LEDs are left over from my TV ambilight project and DIY bike light project a year ago, they are super bright and the colours are great. This feature can support up to 32 LEDs, that means Cleanflight can changes the colour of the LEDs independently at the same time.
Soldering the Connectors to the LED strip
I am not a crazy LED fan, so I decided to only use 9 LEDs, and divided them into three strips so I can place them at different places of the quad.
Soldering isn’t my strong point, and it was quite a challenge to solder the pins on the pads.
WARNING: These LED strips are directional! make sure you are soldering the right direction with your connectors. (Thank you Brian for pointing this out in the comment :) )
LED strips size comparison with the Naze32. I am surprised the colours actually match quite well. :D
Right after soldering, I tested the LEDs with my Arduino. You will need to use a BEC to supply the 5V for the LEDs, because these LEDs are super bright and requires quite a bit current. The Arduino (which is connected to the computer with USB cable) is not capable of supplying enough current, you might risk burning the Arduino if running the LEDs with it. I use the library called NeoPixel on the Arduino for testing.
With the male and female connectors I soldered, they can also be connected in series if I want to.
With some heatshrinks to protect the connector soldering, just perfect :)
* Warning: These LEDs are extremely susceptible to heat. I damaged a few when I was soldering connectors on them. When they are damaged, they just won’t turn on. Remember don’t leave your solder iron on those pads on the LEDs for too long, and use lower temperature for soldering.
There are people unsure about the detail.
I used female and male PCB connectors on the LED strips, male connector on the input, female on the output. (the male pins are compatible with Servo leads)
To connect the LEDs to the Naze, use a single jumper cable to connect the LED signal pin to the Naze, and power the LED strips with the spare motor power +/- using 2 jumper cables.
To slit the LED strips, just use scissors.
To connect slit up LED strips, I just use servo leads. I don’t use anything to protect the LEDs, they are pretty solid. I only concern about the connects and solder joins, so used heatshrink and a bit of hot glue to secure that.
LED strip Current Draw
You might wonder, how much current do these little suckers draw? The answer is around 18mA per LED. (of course, current draw changes as colour changes, blue actually uses more energy than red, but it’s not a big deal for our LiPo batteries :) ) This is the result for 3 LEDs.
Enabling LED_Strip Feature in CleanFlight
As you know the Naze32 has very limited pins on the board. To use the LED feature we can take advantage of some of the spare radio input pins. Be default pin1 to pin 8 are all have PWM signal input, in order to use them as outputs, we need to enable PPM feature. That allows you to use only pin1 as radio signal input (including channel1 to channel8) and the rest of the pins will be come spare. PPM feature is a great feature, it will make your wiring easier and tidier. I would recommend it even if you are not going to use LED_strip.
Enter the following commands in CLI to enable the LED_Strip feature.
# feature rx_ppm Enabled RX_PPM
# feature led_strip Enabled LED_STRIP
Connecting LED strip to the Naze32
Depends on how many LEDs you are planning to use, make sure your BEC is capable of supplying enough current. I would recommend getting power from spare ESC BEC, and not using the BEC that powers your radio and flight controller. In this case I will just connect the + and – to the spare motor pins.
As mentioned, these LED only need 1 data input, and the pin used for the LED is Radio pin5 on the Naze32 and CC3D.
Naze32 RC5 CC3D RCO5 ChebuzzF3/F3Discovery PB8 Sparky PWM5
Since RC5 is also used for SoftSerial and Parallel PWM on the Naze32, that means you cannot use LED_Strip with these features at the same time.
Configuring LED strip in CleanFlight
There are two ways of configuring LEDs in Cleanflight, 1 – LED Tab in GUI. 2 – CLI Commands.
Configure LED in CLI Command
You can configure the LEDs using the led command. By entering “led” only in CLI it prints out your current configuration.
Each LED can be configure using this template “lednumber x,y:ddd:mmm”.
LED number is the sequential ordering of your LED in the LED strip. LED number should start at 0 (0 for first LED).
The LED system is a 16×16 grid. x and y are the grid coordinates. So if x,y=0,0, it’s top left corner cell. If it’s 15,15, you get the last cell in the bottom right.
ddd is direction – N – North E – East S – South W – West U – Up D – Down. For instance, an LED that faces South-east at a 45 degree downwards angle could be configured as SED.
mmm is the LED mode. The currently available LED modes are
- W – Warnings.
- F – Flight mode & Orientation
- I – Indicator.
- A – Armed state.
- T – Thrust state.
To erase or mark the end of the LED strip.
led 4 0,0::
So for example, if I were using only three LEDs, one on the left front arm, one on the right front arm, and one one the tail of the body.
1 2 / / FRONT / | | / / 3 / /
I would define my LED strip in this way.
led 0 0,0:ND:IA led 1 0,15:ND:WF led 2 8,8:D:IA led 3 0,0:: save
Configure LED in Configurator LED Tab
As I posted this page, a new version of CleanFlight GUI was released. Along with other updates, was the LED strip Tab. It’s probably the easiest way to configure your LED strip, in a graphic interface rather than command lines.
Get the latest version of CleanFlight Configurator. Go to the LED Strip tab. If you already have LEDs setup and don’t want them, you can press “Clear All Wiring”. To start adding LEDs, click “Wire Ordering Mode”.
Now click on the grid to place your LEDs. I will place three LEDs, and Exit Wire Ordering mode.
Now click on each individual LED, and you should be able to assign them LED functions, and their Orientation.
After you have assigned all of them, click save. (Remember to update your firmware to 1.6, otherwise “Save” will not work).
For more examples and detail, visit the CleanFlight LED strip page.
For the example above, here is the demo result. Just imagine the LEDs are splitted and placed where they should be.
Another CleanFlight LED Example
This time I will actually mount the LED strip on a mini quadcopter. I will be using 8 LEDs, 3 on the front left arm, 3 on the front right arm, and 2 at the back of the frame.
My CLI commands for LEDs:
led 0 8,9:SD:A led 1 8,8:SD:AT led 2 0,0:WD:IA led 3 1,0:WUD:FT led 4 2,0:WD:WFT led 5 13,0:ED:WFT led 6 14,0:EUD:FT led 7 15,0:ED:IA led 8 0,0::
Or the equivalent LED Strip tab in configurator:
I still find it a bit hard to use the LED feature in CleanFlight, hope in the future it can be improved and made more user-friendly.
This is how I mount the LED strip at the bottom of my mini quadcopter:
And finally here is a quick demo of the result.