
Coding4Fun Drone 🚁 posts
- Introduction to DJI Tello
- Analyzing Python samples code from the official SDK
- Drone Hello World ! Takeoff and land
- Tips to connect to Drone WiFi in Windows 10
- Reading data from the Drone, Get battery level
- Sample for real time data read, Get Accelerometer data
- How the drone camera video feed works, using FFMPEG to display the feed
- Open the drone camera video feed using OpenCV
- Performance and OpenCV, measuring FPS
- Detect faces using the drone camera
- Detect a banana and land!
- Flip when a face is detected!
- How to connect to Internet and to the drone at the same time
- Video with real time demo using the drone, Python and Visual Studio Code
- Using custom vision to analyze drone camera images
- Drawing frames for detected objects in real-time in the drone camera feed
- Save detected objects to local files, images and JSON results
- Save the Drone camera feed into a local video file
- Overlay images into the Drone camera feed using OpenCV
- Instance Segmentation from the Drone Camera using OpenCV, TensorFlow and PixelLib
- Create a 3×3 grid on the camera frame to detect objects and calculate positions in the grid
- Create an Azure IoT Central Device Template to work with drone information
- Create a Drone Device for Azure IoT Central
- Send drone information to Azure IoT Central
Hi!
Today is code time also! And a continuation from my previous sample.
Yesterday I show how to read a static value: the battery. And, when you work with a device like a drone there are other important values to analyze in order to send commands to the drone. Like altitude, position, time of flight etc.
So, based on yesterday sample, I’ll show how to create a simple Python app, that will display the accelerator X value. In the following video you can see the how the value start “static” during the 1st couple of seconds, until I pickup the device and I moved it around.

Important: don’t blame me about the low battery. Playing with the drone drains the battery very fast!
Once again, the code is very straight forward. It runs a loop furing 10 seconds, showing the battery and accelX information.
Just as a reminder, this is the information we get from the drone:
pitch:0;roll:1;yaw:0;vgx:0;vgy:0;vgz:0;templ:79;temph:82;tof:10;h:0;bat:39;baro:50.42;time:0;agx:-8.00;agy:-17.00;agz:-999.00
As you can read, all the information is condensed in a single line and we can split and get:
- pitch
- roll
- yaw
- vgx
- vgv
- vgz
- templ (temperature low)
- temph (temperature high)
- tof (time of flight)
- h (height)
- b (battery)
- baro (barometer)
- time
- agx
- agy
- agz
Happy coding!
Greetings
El Bruno
More posts in my blog ElBruno.com.
More info in https://beacons.ai/elbruno