Scratch and the TelloScratch is a programming language designed to teach children and teenagers the basics of coding in a fun and interactive way. It allows users to create games, stories and animations to develop their skills. Although targeted at kids, Scratch is a great way for anyone to take their first steps into coding, especially when combined with the Tello. In the case of the Tello, you have two options of control; create a pre-planned mission with actions that you can start with the touch of a button or manually control the Tello with a device in real-time. This is a fun and unique feature for all Tello pilots that can also be used as an educational tool to build your skills in coding. [caption id="attachment_12285" align="aligncenter" width="600"] Tello in Flight[/caption]
How to Use ScratchOnce you’ve got to grips with flying your Tello and using all of the different intelligent modes, it’s time to check out the Scratch coding functionality. We will walk you through the process of using Scratch with your Tello. First off, we will look at the tools required for the Tello.
Downloading SoftwareThere are several different components required to use Scratch with your Tello. We will be using a Windows device; however, we will also note any differences if you’re using Apple. First off, you need to start by downloading the Scratch Offline Editor from the Scratch website here. [caption id="attachment_12244" align="aligncenter" width="1000"] Download Scratch[/caption] Choose the correct version for the device you’re using. If using a Mac, you will also have to download Adobe AIR as seen below: [caption id="attachment_12245" align="aligncenter" width="1000"] Download Adobe AIR[/caption] Next, you should download Node.js, a supporting program for Scratch. Again, choose the appropriate version for your device. We selected the version recommended by Node which includes all of the required features to operate Scratch. [caption id="attachment_12246" align="aligncenter" width="1000"] Download Node[/caption] Finally, you will need to download a zip file from Ryze Robotics which includes the pre-set actions and allows you to communicate with the Tello. You will need to ensure the following files are downloaded:
Scratch SetupOnce you’ve downloaded all of the required programs and you’re ready to begin coding your Tello, open up Scratch. Its interface will be displayed as the below: [caption id="attachment_12247" align="aligncenter" width="1000"] Scratch Interface[/caption] Before you can start using Scratch, you need to install the blocks you have downloaded as part of the earlier stage. Hold down the 'Shift' key and click on 'File, then select 'Import Experimental HTTP Extension'. In the next menu select the 'Tello.s2e' file type. [gallery link="none" columns="2" size="large" ids="12248,12251"] Once selected, under the 'More Blocks' tag, options specifically for the Tello will appear as seen below: [caption id="attachment_12252" align="aligncenter" width="1000"] Scratch - More Blocks[/caption] The next stage to set the Tello up with Scratch is getting your computer to run the script you have downloaded. First off, press the Windows and 'r' simultaneous to open up a run window. In the window, type in 'cmd.exe' as shown below: [caption id="attachment_12269" align="aligncenter" width="394"] Run Box[/caption] You will then be presented with the below screen: [caption id="attachment_12273" align="aligncenter" width="973"] Windows[/caption] Next, open the Windows File Explorer and locate the files you have download. This will likely be in your downloads file or desktop depending on where you save your documents. Copy the address from the path bar as shown below: [caption id="attachment_12272" align="aligncenter" width="635"] Address[/caption] Return to the previous screen and type 'cd ' then paste the copied address. After this type in 'node tello.js' and hit enter. You will be given the screen below: [caption id="attachment_12274" align="aligncenter" width="982"] Windows[/caption] You may also have to authorise actions throughout this process. This process will be similar when using an Apple product but may differ with some steps.
Connect the TelloThe final stage in setting up the Tello with Scratch is to allow a connection to the Tello and connect via Wi-Fi to the drone. Turn on the Tello and enter your Wi-Fi settings. The Tello should appear as an option for you to select. [caption id="attachment_12275" align="aligncenter" width="369"] Tello Wi-Fi[/caption] Once you have completed each of these stages, the indicator on Scratch under the 'Tello Control' will turn from red to green, signifying it is connected. You're then ready to fly the Tello using Scratch. Please note, every time Scratch is closed, you will need to run the script, add the blocks and connect the Tello to Scratch again.
Using ScratchOnce you have everything installed and setup, you can begin using Scratch to control the Tello and create pre-planned flight. In this section, we will be looking at the Tello controls used for flights and showing you four examples.
Scratch ControlsWhen using Scratch with your Tello, there are three main categories of blocks you will need to use, dependent on your type of flight. Event - This is the block used as a trigger for something to happen. Flights are usually set to begin when the green flag is selected or space bar pressed. More Blocks - This section is the specific controls put in for the Tello such as take off, fly forwards and flip. Controls - This section allows you to add in instructions such as the duration of a move or repeat a move etc. Sounds - We've added in this extra category for its entertainment value, you can input different sounds into your flight. Sounds are played on the device used to control the Tello, in our case, the Windows laptop. [gallery columns="4" link="none" size="large" ids="12257,12259,12263,12260"] In order to input the controls, simply drag a block into the right-hand section of scratch. You should start with an event, then input your desired instruction for the Tello. Always assign the take off and landing before beginning any flight. We also recommend you create an option to land the drone when a button is selected. For this, we chose the space bar on all flights. This will give you the option to end the flight at any time, a useful option if an error occurs.
Basic Planned-FlightFor the first flight, we have planned a basic flight for the Tello using Scratch. It's recommended for your for your first flight, you create a similar flight in order to get used to the basic controls.
Scratch Controls[caption id="attachment_12277" align="aligncenter" width="1919"] Basic Flight Controls[/caption] We used the green flag to launch the Tello and start the set routine, then flew forwards, backwards and landed. When setting the duration, we recommend using at least five seconds as the Tello needs adequate time to perform the actions you have included.
Video ExampleNow the controls have been input, check them out in action in the video below: https://www.youtube.com/watch?v=BdtMweiKFos
Advanced Planned-Flight 1Once you've got used to basic flights as shown below, try moving on to more advanced flights with complex routines. You can incorporate flips, more difficult manoeuvres and incorporate sounds.
Scratch Controls[caption id="attachment_12278" align="aligncenter" width="1919"] Advanced Flight Controls[/caption] Like the basic flight, we started our flight with assigning the Tello take off to the green flag in order to begin the planned routine. We then added more advanced controls to the flight.
Video ExampleCheck out the example video of the more advanced flight: https://www.youtube.com/watch?v=keTh03BQB1s
Advanced Planned-Flight 2For this flight, we incorporated sound into the flight to show off this feature.
Scratch Controls[caption id="attachment_12289" align="aligncenter" width="1920"] Advanced Planned-Flight 2[/caption]
Video ExampleCheck out the example video below. Make sure your sound is on to hear this interesting feature: https://www.youtube.com/watch?v=IIugUu81LEA
In Air ControlOnce you've mastered the advanced flights, try the final option; in air control of the Tello. This is more complex as you have to assign different actions to buttons on your mouse and keyboard and maintain real-time control over the Tello. The layout will be different to pre-planned flights as two blocks are put together to stand alone with a trigger and action. [caption id="attachment_12279" align="aligncenter" width="1919"] In Air Flight Controls[/caption] Once we input the controls, we were able to take off the drone and control its movements using the keyboard.
Video ExampleCheck out the video of us controlling the Tello in real-time using Scratch. https://www.youtube.com/watch?v=2uPKENydcJw Please note, we had a dip in the performance and responsiveness of the Tello when battery levels were low. Make sure you monitor the Tello closely when the charge is depleted and stop using Scratch to charge the drone if acts outside your command.
SummaryThe option to use Scratch with the Tello is a great addition to the drone. The setup seems daunting at first but once you use the process a couple of times, it becomes second nature. It will be interesting to see if this is developed in the future by Ryze to include options like video record, take a picture or the intelligent flight modes. This would definitely improve the user experience. You can see that the use of Scratch with the Tello is primarily aimed at younger generations but it's still fun to use and a great educational tool to learn the basics of coding.
To discuss any information from the above post or any DJI or Freefly product, please give one of our team a call on 0191 296 1024 or email us at email@example.com.
Keep checking back to Heliguy’s Insider Blog for more announcements, insights into drones and, of course, the latest news from the drone industry.