#Coding4Fun – How to control your #drone with 20 lines of code! (4/N)

Buy Me A Coffee

Hi!

The DJI Drone is a great device, you can have a lot of fun and also learn a lot. However, because the main way to interact with the device is via WIFI and UDP, you need to connect to the device WIFI. And, connecting and disconnecting to the is some times not a very happy moment.

So, there are 2 main tips to work in a more agile way with this.

Connect to the Drone WiFi via Command Line

You probably already know the command

netsh wlan connect name=<YOUR WIRELESS NAME> 

This is the quickest way to connect to a wireless. Once you have your DJI Tello name and your home / work / whatever network name in your Windows Terminal, just key up until you find it.

Bonus: If you want to know the names of the network, you may want to use the command

netsh wlan show profiles

As you can see in the following image, in my home computer I got several IoT Devices connections, my phone, the DJI Tello WiFi and my home one

The command to connect to my drone will be

netsh wlan connect name=TELLO-589327 

Once I want to connect to my default network, I simply disconnect from the drone and wait until my machine connect to the default Wireless Network. The command to disconnect is

netsh wlan disconnect

So, as a recap the only 2 commands you need are:

netsh wlan connect name=<TELLO-Your device number>
netsh wlan disconnect

Super easy!

Ping your drone to check when you are connected

Once you connect to your drone WIFI, it may take a couple of seconds or more to establish the connection. If during this time, you launch an app to interact with the device, be prepared to some funny results.

The way that I use to see when the Wireless connection is ready is as simple as to use a ping -t command with

ping 192.168.10.1 -t

This is the default drone IP, and you can run this in a separate window and you will know when the drone is ready.

Happy coding!

Greetings

El Bruno

References