First, lets begin with the main parts that will be needed to build on your LTE controlled Quadcopter.
See the required parts below
- Raspberry Pi (Amazon Link) price ~$40
- F450 Quadcopter Kit (Ebay Link) price ~$80
- LTE Dongle (Amazon Link) price ~$50
- Battery Pack (Lipo) (Ebay Link) price ~$18
- Lipo Charger (Ebay Link) price ~$25
- Flight Controller CC3D (Ebay Link) price ~$13
- PC Gaming Joystick (Amazon Link) price ~$29
Some BackgroundA Quadcopter consists of four arms with a motor and propeller on the end of each arm. Two propellers are turning clockwise and the other two are turning counter-clockwise. There is a flight controller which keeps it leveled and converts your input commands into motion which it needs to fly. There are many cheap flight controllers available in the market. The one I used is called Open Flight CC3D. It costs only $13. Some other popular alternatives are
- Hobbyking KK2.1.5 Flight controller
- APM2.6 Ardupilot Flight Controller
Main parts of Quadcopter consists of a frame, a receiver, a flight controller, electronic speed controls, motors, and propellers. See below for complete picture
The output of the receiver is in the form PWM signals. PWM stands for Pulse Width Modulation. PWM is a technique used to transmit data in the form of a varying pulse width. In the case of R/C electronics this time is usually 1-2 milliseconds. For example, full throttle on your transmitter will send a 2 ms pulse to flight controller while zero throttle means puls of width 2 ms. Same rule applies to other controls on your transmitter. PWM pulse frequency is 20ms. The image below represents a typical PWM frame
|PWM Signal output from RC Receiver|
Replacing UHF Radio Link with IP CommunicationMain objective here is to replace the UHF radio link (2.4 Ghz) with IP communication network. Instead of using RC Transmitter we will use a regular PC gaming joystick to send control commands to Quadcopter through IP network. The commands are received by LTE dongle connected to Raspberry pi computer which converts these commands to PWM signals. The PWM signals are then used by CC3D flight controller to control the motion of flight. See the below figure for end to end communication path
|Raspberry Pi 2|
Installing LTE modem on Raspberry Pi
How to communicate with LTE Dongle Private IPOne of the issue with LTE modem (dongle) is that it will be assigned private IP and will use Network Address Translation (NAT) to communicate to external world. NAT is the process where firewall assigns a public address to a network device inside private network. NAT save on the IP addresses as every network device (LTE dongle in our case) does not need a public address, and also it would hide these private devices from the outside world. For our quadcopter LTE dongle, it means that we wont be able to use the IP which is assigned to it in order to establish any IP communication to it. To overcome this problem we have to use our home Wifi router's port forwarding feature (application of NAT). Since our router's public IP is known to us ,therefore forwarding packet to our home PC coming from LTE quadcopter will not be an issue.
Let's assume that LTE dongle is assigned private IP 10.10.10.50 by the LTE network, Let's also assume our home computer has private of 192.168.10.44 which was assigned by the Wifi router. Secondly our Wifi router has public IP of 18.104.22.168 which is known to us. We use TCP port 50050 for any communication from LTE quadcopter to Home PC. Now all we have to do is defining port forwarding table in our home wifi router. The basic rule that needs to be defined is to forward all incoming TCP packet with destination port of 50050 to our controller PC which has IP 192.168.10.44 and you are all set to have IP communication between Quadcopter and our home PC
- Using Python's socket module function, Raspberry Pi (with LTE modem connected) will open a TCP connection to a port 50050 and IP 22.214.171.124.
- Python Socket Module on our home pc waits until a client connects to the port you specified
- Our home router forwards all incoming TCP packet with destination port of 50050 to our controller PC which has IP 192.168.10.44
- Once a socket is open, you can read from it like any IO object.
Below is the very basic python code that I used to do the communication between Raspberry Pi and home Computer as explained above. The code is just to give you a starting point while you can optimize the code below to have much better stabilized flight :)