Never too late for Santa!
The project based on M5stack devices (Grey Core + Faces +RFID) is a wifi controller for Dji Tello Drones. (some specs here)
Below an extract
Yes there are a lot of apps for smartphone and PC software, but it was for me nice to try to control through a very compact unit for basic movements only.
I'm currently studying the Tello SDK to work with Python and Open CV for Face Detection (and, why not, for mask wear or not detection on this pandemic era) and my idea is to separate movement control from video recognition.
In my idea (for joke) Santa can use a drone to give the gifts away, and to access to the drone need a personal ID tag (RFID)
So after the authorization, starts the sequence (with the underlined state by changing the rgb color at the base of Faces module) to take off and perform some movements before land
First of all you can retrieve info on Tello sdk 1.3 (not for Tello EDU) here
Tello act as Soft AP mode WI-FI, (his ip is 192.168.10.1) and the M5 Core take the ip 192.168.10.2 All the commands must be sent in UDP, there are interesting features to retrieve some information as Battery level, Barometric pressure, altitude, dinstance etc, but it require to execute a webserver to listen the answer on to another port than the 8889
Using Python is quite easy to retrieve a lot of projects based on this SDK, but using micropython and ESP32 is rare, I found only a great example on https://github.com/plugowski/micropython-tello (i would thanks him) that inspired me, and I decide to try to make a porting to M5Stack devices.
This is my fork from his code i'm evolve
The first step was to add a working lib (with Tello commands) to the M5 Grey structure (i'm using UiFlow firmware v 1.6.3), after some fails, I have success using a trick with Thonny Ide, simply rename the lib "__init__.py" to "tello.py" and transfer it on M5 Core at root level (not /apps !) of Uiflow structure. The main program (i simply named Tellorun.py) once tested, has been transferred to /apps path of M5 Core.
Once M5 core starts, you can select Tellorun.py from apps menu, after few second show a picture and code wait for a RFID tag near the sensor to start sequence to join wifi of drone (remember to light on Tello :-) )
Enjoy the demo!
This is part of the code in Tellorun.py:
from m5stack import *
from m5ui import *
from uiflow import *
import tello
import time
import network
import wifiCfg
import face
wifi = network.WLAN(network.STA_IF)
wifi.active(True)
setScreenColor(0xe9efd9)
image1 = M5Img(2, 12, "res/santa_m5.jpg", True)
label0 = M5TextBox(120, 140, "Status:", lcd.FONT_DejaVu24, 0xFF0000, rotate=0)
label1 = M5TextBox(90, 190, "", lcd.FONT_DejaVu24, 0xFF0000, rotate=0)
label2 = M5TextBox(50, 18, "SANTA FLY DRONE", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label1.setColor(0xFF0000)
label1.setText('Preparing..')
time.sleep(6)
rgb.setColorAll(0x000099)
# Wait for a RFID tag near sensor
faces_rfid = face.get(face.RFID)
while True:
if faces_rfid.isCardOn():
label1.setText('Fly Authorized..')
break
wait_ms(500)
rgb.setColorAll(0xFFFF99)
wait_ms(500)
rgb.setColorAll(0x00FF99)
# RFID tag recognized, start WIFI connection to Tello drone (light on before!)
rgb.setColorAll(0xFFFF00)
wifiCfg.doConnect('TELLO-xxxxx', '') #Check your Tello ssid
# wait for wifi connection and retrieve ip address from drone
attempt = 1
while not wifi.isconnected():
label1.setText('Connecting...'+ str(attempt))
attempt += 1
time.sleep(0.5)
# link to drone made, start to send commands
drone = tello.Tello('192.168.10.2', 8888)
drone.command('command')
label1.setText('Initialized')
rgb.setColorAll(0xff0000)
time.sleep(6)
drone.takeoff()
label1.setText('Takeoff')
time.sleep(7)
label1.setText('Rotate LEFT')
drone.rotate_ccw('30')
time.sleep(4)
drone.land()
label1.setText('Landing')
time.sleep(2)
label1.setText('Landed!')
rgb.setColorAll(0x000099)
time.sleep(3)
Comments