Without exaggeration, over 80% of the issues raised on the support forum and Telegram group can be traced back to improper wiring and/or shielding. To reduce the load on the team, please make sure you have followed the instructions in this chapter, we will point you here without much explanation if we suspect your problem is power or shielding related.
While it may seem like you could just connect the WiFi adapter to one of the USB ports, supply power to the raspberry pi and go fly, it's not quite that simple.
Some lower power WiFi adapter such as the TPLink 722n V1 may work out that way, but others may not. If your WiFi adapter needs more power than it is able to draw from the Raspberry Pi USB port, you will see "interference" that isn't really interference, dropped video frames, and potentially sudden video blackout. That could happen during flight if you don't take some simple steps to avoid it.
In addition, if the USB connection is briefly moved or subjected to vibration, it may cause the WiFi adapter to reset or disconnect from the system. This disruption might be just long enough to completely stop the connection between ground and air.
The solution for those kinds of problems is to solder power from a BEC or other 5v power supply, to the WiFi adapter(s).
It is also strongly recommended that you solder the USB data lines. On some WiFi adapters this is easy because they have ready to use solder pads, or have a mini-USB connector on the adapter (in which case you don't have to solder anything to the adapter itself, just the other end of the cable).
use short wires
use wires with at least 20AWG gauge (0.5mm²) for any power wires. Signal wires can be a lot thinner.
use a shielded USB cable with the shield soldered to ground. If you use unshielded cables, twist the signal wires.
solder everything, avoid any USB cables or plugs without a latching mechanism
use a quality BEC with at least 3A
consider adding low-ESR electrolytic capacitors near the WiFi adapters and the raspberry pi
do not use USB power banks
do not use the micro USB connection on the raspberry pi for power
do power the raspberry pi through the GPIO pins or by soldering power to the underside of the board
do make sure the camera cable is properly seated on both ends
On the raspberry pi zero, the camera connection is not very secure, especially if you have connected and disconnected it many times
You can secure the camera cable with some tape or a drop of hot glue
do make sure the raspberry pi and WiFi adapters don't get hot
Consider adding small heat sinks, but be sure they will remain firmly attached with strong thermal tape
Keep the antenna away from the camera and camera cable
If you see straight vertical lines in the video, you may need to use a shorter camera cable or shield it with foil
The system can potentially interfere with 433Mhz, 868Mhz LRS, or GPS
If you encounter problems like this, consider separating, shielding or changing some of the components (ask us for help)
In General plan to specifically allocate power to the PI and specifically to the Wifi Card
POWER PI options:
A micro usb (not recommended)
B solder wires from bec to micro usb points
C solder wires from bec to gpio (recommend)
AND
POWER WIFI options:
1 micro usb plugged into pi. No other wiring... (DOESNT WORK)
2 solder wires from the micro usb power point to the pi wifi usb power points (not recommended)
3 solder wires from bec to the pi USB Power points
4 solder wires from bec to wifi card (recommend)
Much like the Air SBC, the Ground SBC will likely be powered by a LiPo battery. The Raspberry Pi and the WiFi cards all use 5V, which is what most BEC's produce. So hook up one of your SBC's to a LiPo battery and use a multi meter to double-check the output is +5V.
The Raspberry Pi and most WiFi adapters actually like the voltage to be slightly higher than +5V, along the lines of 5.2V ~ 5.4V. If you have a variable output, best set it to +5.3V. Do not go higher than +5.4V or you will damage your Raspberry Pi and/or WiFi cards!
When you have verified the output of the BEC, you can connect it to the Raspberry Pi, to do this, you have two options. Soldering or using the GPIO Pin Header, for the Ground SBC it's OK to use the GPIO Pin Header, for the Air unit we recommend soldering. Connect the output from the BEC to the PI on pins 2 and 6 (or 4 and 6) according to this diagram:
This can be done easily by just plugging in the Servo header that comes with most BEC's into the Raspberry Pi Pin Header. Make sure the RED wire is connecting to Pin 2 or 4 and the BLACK wire is connecting to PIN 6. Now when you connect power to the BEC, the Raspberry Pi will power up!
The 3A BEC can also power a 7" HDMI screen with a micro USB connector.
Now that we have power going to the Raspberry Pi it's time to power the WiFi adapter(s). Due to the way the Raspberry Pi is designed the USB ports do not receive enough power to drive the WiFi cards, especially when connecting more than one WiFi card as is often the case on a ground station.
To mitigate this problem it is necessary to power the WiFi card(s) directly from the BEC as well. Please refer to the diagram below to see how. Please note that 5V and GND are NOT connected to the Raspberry Pi USB Port.
Soldering as much of these connections as possible will prevent accidental disconnects. On the Ground side, soldering might be optional, on the Air side it is mandatory as it is subjected to greater vibrations.
To monitor the power on the ground unit, please take a look at the Ground Power Monitoring section.
Much of the explanation for the Ground wiring also applies to the Air, except that where it is likely no problem to use USB adapters on the Ground, using them in the Air will absolutely cause problems. It is therefore absolutely recommended to solder as much as possible in the Air setup and if you want to use connectors, please use connectors that can withstand the vibrations and stresses of being in a vehicle.
JST connectors can be used as they lock into place and these can be had for quite cheap. The 4 pin variant can be used to replace the standard USB cords.
When using the Raspberry Pi Zero as an Air SBC you can solder the power and USB data lines to the points shown in this diagram:
With Power and WiFi connected the system basics should work, in most cases however, you will want to hook up some form of flight controller. While the setup of such a controller is covered in Software Setup, the physical connection also requires some special attention.
Several users are a member of the 'I fried my serial port and now I'm using a USB to Serial Adapter'-club. To prevent membership, please read how to properly connect your Flight Controller.
Most Flight Controllers will allow for Serial (UART) connections, while some may only output Telemetry, most modern Flight Controllers will allow true bi-directional communication, allowing the system to send commands to the Flight Controller as well.
In order to connect via Serial to a Flight Controller the following pins must be connected:
Refer to the schematics of your specific Flight Controller to find the right connections for the UART you want to use. Most Flight Controllers have more than one UART, so pay attention!
The Raspberry Pi uses 3.3V level for it's UART, like most Flight Controllers available today (including but not limited to: pixhawk v1, Cube black, Cube orange, Matek FC, holybro FC) while Micro controllers such as the Arduino use 5V. Directly connecting these to the Raspberry Pi will ensure membership of the aforementioned club. As with most issues there are two ways around this, a nice way and a cheap and easy way.
Use two resistors to create a voltage divider circuit on the INCOMING (RX) connection to the Raspberry Pi. This will scale the incoming 5V to a safer 3.3V(-ish). The outgoing 3.3V from the Pi's TX will in most cases still be recognized by the Flight controller. See the diagram below from OscarLiang.net for an example.
A better solution with more guarantees, but slightly more expensive and slightly more complex to wire up is an actual Logic Level Converter. These come in many forms, but in principle they all do the same. Make sure only 3.3V shows up at the Pi and making sure 5V is sent to the connected Flight- or Micro controller.
There are many different types of logic level converters out there, they are mostly very cheap and come with easy enough manuals. You don't need bi-directional logic level converters for serial communication since the flow only goes one way through the wires.
To see some background, please check this Sparkfun link.
It is certainly possible to extend CSI camera cables if needed. There are 2 type of cables: "Pi Zero" style with 22 pins and 0.5mm pitch and "normal" pi with 15 pins and 1mm pitch. Cables are usually available from Pi store or Ali Express 15 pin cable extension 22 pin cable extension 15 pin extension Aliepress 22 pin extension Aliexpress. Different lengths are available depending on the source. It is also possible to use adapters in order to use 15pin cables with 22 pin cables. This 15 pin to 22 pin adapter allow to convert Pi Zero cameras to normal Raspberry 15 pin connector or simply extend standard cable using 15 pin to 15 pin joyner or 22 pin to 22pin joyner. As a side note, the last 2 adapters cannot be used with cables with exposed pin on the same side because adapters mirror the pinout ( 1,2,...15 to 15,14,...1) so cables with pin on the opposite side must be use in order to restore correct pinout. In general nothing bad will happen if the wrong cable is used because there is built in protections but of course OpenHD will not complete the boot due to no camera being detected.
It is also important to advise that longer the cable is, the easier it is to absorb and transmit interferences. It is suggested to keep cables as short as possible and in case of interference on video or to other components (such as WiFi card, FC, servos etc) shield the cable using aluminium foil. Flat cables can be easy bed a fold to avoid loosing wires.
On the ground SBC you might want to attach an Antenna Tracker, most of these units require us to output the Mavlink data via Serial communication. When only connecting the TX from the Raspberry Pi to the RX of the Ground station no special consideration needs to be given to the voltage levels. Most Micro controllers will allow the 3.3V of the Raspberry Pi as a logic signal.
When connecting the RX on the Raspberry Pi as well, however, earlier warnings mentioned for the Flight Controller come into play. The Raspberry Pi uses 3.3V Serial, while most Micro controllers use 5V. Putting 5V on the Raspberry Pi RX pin will permanently damage the Serial controller. Please refer to the 'cheap' and 'good' solutions mentioned under the Flight Controller section.
Raspberry Pi | Flight Controller |
---|---|
TX (Pin 8)
RX
RX (Pin 10)
TX
GND (Any Ground)
GND