Click on the circular icon that is on the right side of Blockly to open the color training tool. Next, click on the New color data button to start color training process.
The color training tool will prompt you to enter a name for your color data set. Name your color set codrone_colors
, or any other name that you will remember.
To train your color data, you need to collect color samples for each color that you have in mind (indigo, orange, beige, red, black, etc.). To simplify what colors we are going to be collecting data from, we will use the color cards provided by the CoDrone EDU kit.
The color training tool will prompt you to add a color to your data set by clicking the ‘+’ button.
Now, you can add a name for the color that you just added! Let’s start with ‘red’ first.
After entering a name for your color, you can now click on the color picker icon right above the name to open a pop-up window to start collecting samples.
A pop-up window will appear that will let you collect samples of the desired color. The window provides the name of your color data set, the name of the color that you will be collecting, instructions on how to properly collect samples, and a button to collect samples.
Once your drone is flat on the surface and its color sensors start illuminating, you can click on ‘Collect samples’.
Now, you can repeat the same process for the other color cards!
The color training tool tab should look like this once you finish collecting samples for each color!
If you’re unhappy with how a color turned out, you can click on the ‘X’ button that’s next to one of the colored circles to remove it from your color data set and simply add a new color with the same name. For example, the ‘red’ color data that we collected didn’t look red, so the ‘red’ color was removed and was redone. Remember, if all of your colors aren’t coming out the way that they’re supposed to, head to this lesson to re-calibrate your drone’s color sensors!
Now, let’s start testing our color data set! Click on the red ‘Test color data” to test your color data set. This will open a pop-up window.
In this pop-up window, the window will show you the actual color that your color sensors are detecting, the HSV value of the detected color, and a prediction of the name of the detected color. This prediction (or guess) is based off the color data set that you provided to Blockly.
The process that we went through previously of collecting samples of color data and giving it a name (labeling) is called “training”. You’re essentially telling the program (Blockly, in this case) that “these samples of color data that I collected should be considered as the color red” (or whatever color)! During the training phase, you can name the color any way you want, mahogany, orange, pink, etc. It all depends on the context, like the color of the surface you’re using to collect data from.
Additionally, if you were to place the drone on a surface that wasn’t used in the training phase, during the testing phase, Blockly will give you its closest guess on what the name of the detected color is.
Make sure you’ve tested your color data set to make sure it is providing the correct guesses by placing your drone on each color card.
If it isn’t giving correct guesses, click on the ‘X’ button on the top-right to modify your color data set. Otherwise, it is highly recommended to download your color data set with the gray button before moving on.
Let’s click Finish and create blocks! This will populate blocks in the “Colors” category located in the “Senior” tab.
If you forget to download your color data set, don’t worry! There’s a download button that will appear on the top-right side of the color training tool. Right next to the download button, there’s a trash can icon to remove the existing color data set and depopulate the “Colors” category.

Save your data!
Although Blockly will save your blocks in the workspace whenever possible, color data files cannot currently be saved in the browser. Download your color data if you want to reuse it in a later program.
Blockly will add new blocks for you in the “Colors” menu. There will be a new block available for every color that you trained. Open the menu now to see these blocks. Your color training is complete and ready to use!