As some of you may know, I’m a huge drone fan [pun intended], and as such I’m always experimenting with these wonderful flying machines and finding new uses for them, as well as new ways to have fun with them.
I have always wanted to control a drone with a PC, and later have a camera feed from the drone to the computer, to be able to do some kind of pattern matching and follow objects, without a huge budget and large and dangerous drones.
In this post I will show you how to control the world’s cheapest (but not the smallest) drone, the Eachine H8 Mini, using an Arduino Nano (any Arduino will do), the nRF24L01+ 2.4G Wireless communications chip, and a PC running Windows with Python installed.
Here’s what you will need, and the approximate costs:
Prices subject to change without notice, links include refferal codes, supplier Banggood
- Eachine H8 Mini – $12.99 – Banggood, 1 piece, RTF
- nRF24l01+ Chip – $3.45 – Banggood – COUPON 10% off: 637ccc, 3 pieces
- “Arudino” Nano – $2.39 – Banggood – 1 piece, Geekcreit brand
- mini USB cable – approximately $1, buy it in a local shop – 1 piece
- DuPont female-female cable – $1.49 – Banggood – COUPON 10% off: 15ACC, 40 pieces
You will need to solder the pins to the Arduino Nano clone, and maybe the nRF24L01+ clone, so you will need a soldering iron and some solder.
I linked clones from Banggood, as those were the ones I bought, but as far as I know they are fully compatible, and there are no datasheets for them implying they are compatible with the original components.
Reference guide for Nordic Semiconductors nRF24L01+ (and Semitek SI24R1) pinout
Reference guide for connecting 2.4G wireless module to Arudino Nano
|Meaning||Arudino PIN||nRF24l01+ PIN||Notes|
|3.3V||3V3||VCC||Please, Do not connect VCC to 5V, it will burn out the nRF24l01+ chip!|
|SPI CE||D5||CE||Special pin for nRF24l01+, control standby and RX/TX|
|SPI CSN||A1||CSN||SPI standard pin|
|SPI CSK||D4||SCK||SPI standard pin|
|SPI MO||D3||MOSI||SPI standard pin|
|SPI MI||A0||MISO||SPI standard pin|
IRQ is intentionally left unconnected (floating). The Pinout is silk-screened (written) onto the board itself.
Step 1: Download Arudino IDE
To program the Arudino Nano, even though it’s a clone, you will need the official Arduino IDE. I used the version 1.8.4 on Windows 10.
Use the Windows installer (.exe) file, don’t use the online app or the Windows Store application, they will not work.
Step 2: Install the Arduino IDE
Please refer to the video here for instructions, as I cannot go into details about the installation process, that is not the topic of this post.
Step 3: Connect the Arduino and nRF24l01+
Use the reference table above to know which is which.
Step 4: Plug in Arduino
Plug in the Arduino into the USB 2.0 port on your computer, preferably a back-panel one.
Step 5: Upload program code to the Arduino
Download my ZIP file and extract it to the Desktop. Enter the directory nRF24_multipro and double click nRF24_multipro.ino (you may not see .ino depending on your OS setup).
In the Arduino window, select Tools -> Board -> Arduino Nano, select the COM port (best to unplug your printer if you have one plugged in).
Then, go to Sketch and Upload.
Step 6: Test out your setup
Plug in the drone’s battery into the micro LOSI connector, make sure to get the polarity right, and set it on a flat level surface quickly.
Unplug and plug back in (or press the RESET button) the Arduino, and see if the LEDs on the drone start flashing quickly then stop flashing and stay lit.
If that happens, it means everything works. If not, unplug everything and retry.
Step 7: Control the drone
Install Python 2.7.x from here (I used 2.7.14).
Press Windows key on your keyboard and button R at the same time, and type in “cmd” without quotes.
Then run “cd C:\path\to\downloaded\files\” (put in the correct path, make sure there are no spaces in the path, if there are move the folder!) and finally run “python serial_test.py“.
You should see a screen similar to this one:
Controls are as follows:
- W to increase throttle, S to decrease
- A to yaw left, D to yaw right
- Arrow keys to move foward/backward and left/right
Pretty cool! If you have any issues, let me know in the comments below and I will try and help you.
Disclaimer: This code is based on work by goebish and perrytsao. I am not responsible for any damage, injury, or death resulting from your use of this code.
Edit: Seems like I’ve forgotten to include the download link for the firmware, so here it is: