Scratch Programming for Tello

Just bought a Tello Drone from an online shop during Black Friday Sales in Taiwan. I was luck to get the Tello Boost Combo with 3 battery and a 3-in-1 charging hub for USD$110.2
「Tello 3-in-1 charging hub」的圖片搜尋結果
The photo above was from DJI website.

!!! Caution !!!

  • If this is your first try to program Tello with Scratch, please do this in door first!
  • There were few times where I placed wrong blocks and Tello just kept went up and stayed close to celling and I was unable to control it at all. This was caused by wrong command blocks I used. If I was outdoor that time, I didn't know where Tello would fly to.

Download & Install 

  1. Install Scratch 2.0 Offline Editor on your Mac or PC. Download it from here: https://scratch.mit.edu/download This is the Scratch program editor. You will write your code in this editor to control Tello. If you don't know how to use Scratch, here is a good place to learn: https://scratch.mit.edu/projects/editor/?tip_bar=getStarted
  2. Install Node.js from here: https://nodejs.org/en/ This program is simulate the Tello smartphone App that it allows you to communicate your PC/Mac to Tello. You do not need to know how Node.js works. Just run the Tello.js script and Tello will be controlled by Scratch.
    • Remember where Node.js is installed
    • $> Node.js v10.14.0 to /usr/local/bin/node
    • $> npm v6.4.1 to /usr/local/bin/npm
  3. Download Tello.js and Tello.s2e from https://dl-cdn.ryzerobotics.com/downloads/tello/20180910/scratch0907.7z
    • The scratch0907.7z requires 7zip to unzip it
    • Remember where Node.js is un-zipped
    • Tello.js is used by Node.js to communicate with Tello
    • Tello.s2e is Scratch extension block code that generate specific Tello Blocks
  4. A better version of Tello.s2e has been created by Yiupa. Down it from Git-Hub. https://github.com/yiupa/tello-scratch-extension/tree/English-version Download from Git-hub to replace Tello.s2e with the new Scratch Extension TelloKanji.s2e

Step by Step

  • Start Scratch 2.0. Hold "Shift" key and click "File" menu, then click "Import Experimental HTTP Extension" and select "Tello.s2e" file where you just downloaded. 

  • The Tello interface will be shown in Scratch under "More Blocks". All the Tello command blocks are placed below.

  • First, click "Events" and drag "When green flag clicked" block to the scripting area.

  • Then click "More Blocks" and drag all the blocks to scripting area according the graphic shown below. First, "Takeoff", then "fly up 50cm", "fly forward 50cm", "fly backward 50cm", "flip f", and last "land".  
  • These commands are quite self explanatory. You may change the numbers in the white oval area to change the fly distance.
  • The "flip f" block is tell Tello to perform a flip operation. "f" means forward and you can change to "b" for backward, "l" for left flip, and "r" for right flip.
  • Click "File"->"Save" this script for future use.

  • Next, connect your PC/Mac Wi-Fi to Tello. Usually, the Wi-Fi SSID is "Tello-XXXXXX"
  • Next start Node.js 
    • For PC, open windows command line window and execute node.js (Sorry, I didn't try this on PC)
    • For Mac, open a terminal and go to the directory where you unzipped Tello.js
    • $>cd 
    • $>cd ~/Download/scratch
    • $>~/Download/scratch$ node Tello.js
    • If you see "Data received from server: ok. Received 2 bytes from" Means the connection is ok!
  • Click the green flag and your Tello should be able to fly according to the command blocks you placed in the scripting area. Here I try to let Tello to fly in a square and then land.

  • From the terminal, you can see what actions have been performed and Tello responded with "OK". It means the communication is good!

  • You may also show Tello current status in the Scratch stage by click the option box in "More Blocks". See the screenshot below, such as showing height, battery %, and speed...etc.

  • Here is video of Tello followed commands from Scratch to share with you.

    That's it. I hope you enjoyed this tutorial and have a safe flight. 


====== 中 文 版 (Chinese Version)=========

最近在台灣黑色星期五銷售期間,從網上商店買了一台Tello 無人機! 我很幸運能夠買到 Tello 暢飛套組,包括了 3 個電池和3合1充電器,售價 NT$3400 元! 很超值!
「Tello 3-in-1 charging hub」的圖片搜尋結果

!!! 請 注 意 !!!

  • 如果這是您第一次嘗試使用Scratch 來控制 Tello,請先在室內中測試程式!
  • 有好幾次,我放置了錯誤的積木指令,Tello 繼續上升並且靠近天花板,我根本無法控制它。 這是由我使用的錯誤指令區塊造成的。 如果那時我在室外,我根本不知道 Tello 會飛往哪裡。


  1. 在Mac或PC上安裝Scratch 2.0 Offline Editor。 從這裡下載:https://scratch.mit.edu/download 這是Scratch程式編輯器。 您將在此編輯器中寫程式來控制Tello。 如果你沒有使用過 Scratch,可以先到這裡熟悉一下 Scratch: https://scratch.mit.edu/projects/editor/?tip_bar=getStarted
  2. 接著從這裡安裝 Node.js: https://nodejs.org/en/
    這是用來模擬 Tello 手機 APP,它可以您將您的PC / Mac與 Tello 連線。 您不需要知道 Node.js 的工作原理,只需運行 Tello.js 程式,Scratch 就可以控制 Tello。
    • 記下  Node.js 安裝的目錄
    • Node.js v10.14.0 安裝在  /usr/local/bin/node
    • npm v6.4.1 to 安裝在 /usr/local/bin/npm
  3. 從下列網址下載 Tello.js 以及 Tello.s2e https://dl-cdn.ryzerobotics.com/downloads/tello/20180910/scratch0907.7z
    • scratch0907.7z 這個檔案需要 7zip 才能解壓縮
    • 請記下 Node.js 及 Tello.js 解壓縮後的檔案位置
    • Node.js 使用 Tello.js 與 Tello 進行連線
    • Tello.s2e 是Scratch 擴展代碼,用來產生特定 Tello 程式區塊
  4. Yiupa 修正了一個更好的 Tello.s2e 版本,你可以從 Git-Hub下載。 https://github.com/yiupa/tello-scratch-extension/tree/English-version


  • 啟動 Scratch 2.0程式後,按住 “Shift” 鍵並點選 “File”,然後點 “Import experimental HTTP extension” 接著選擇剛剛下載的 “Tello.s2e”,即可以載入。

  • Scratch 界面將在"More Blocks"下,你可以看到所有的 Tello 命令區塊都放在下面。

  • 首先,點選 "Events" 並將 "When green flag clicked" 塊拖到右方的程式區域。

  • 然後點說"More Blocks"並如下圖所示,將所有你要使用的程式區塊拖動到右方程式區域。這裡我做的範例: 首先,“take off 起飛”,然後“fly up 50 cm”,“fly forward 50cm”,“fly backward 50cm”,“flip f”,最後“land 降落”。 
  • 這些命令非常的簡單易懂,而且您可以更改白色橢圓區域中的數字以變更飛行距離。
  • “Flip f”塊告訴 Tello 執行翻轉。 “f”表示向前,你可以改為“b”表示向後,“l”表示左翻,“r”表示右翻。
  • 最後別忘了點 “File” “Save”將此檔案保存。

  • 接下來,將您的PC / Mac Wi-Fi 連接到 Tello。通常,Tello Wi-Fi SSID 是 “Tello-XXXXXX”
  • 再來是執行 Node.js 
    • 使用PC的朋友,請打開 Command 視窗並執行node.js(對不起,我還沒試過PC,請你試試看)
    • 對於使用 Mac 朋友,請打開終端機並先到你到解壓縮Tello.js的目錄下
    • cd 
    • cd ~/Download/scratch
    • ~/Download/scratch$node Tello.js (執行 紅色指令)
    • 看到 Data received from server: Ok
      Received 2 bytes from 192.168.10:8889 表示連線已完成。
  • 接著,點下綠色𣄃誌,Tello 就應該能夠根據您放在程式區域中的指令區塊進行飛行。 在這裡,我試著讓特洛繞飛一個長方形的路徑,然後降落。

  • 從 Mac 終端機中,您可以看到被執行的區塊指令,Tello 回覆 “OK”。 表示連線沒有問題,指令收到!

  • 如果你點下 "More Blocks" 裡面有很多 Tello 的資訊可以顯示在 Scratch 的畫面裡(Scratch 左側有一雙猫的畫面) 請參閱下面截圖,例如顯示高度,電池百分比和速度等。
    這是我錄下 Tello 依照Scratch的指令飛行的影片,供您參考。