Sensors and Components

In the previous chapter I have worked on the Beagle Bone Blue as Flight Controller Unit (FCU) which is the brain and the most critical part of drone design. All sensors and components work around the choice of FCU, type of frame, type of mission and the overall budget. In this chapter I have focused on the sensors connected directly to FCU namely:

  • Integration of GPS with compass with FCU
  • Radio Controller (RC) Receiver integration with FCU
  • LIDAR integration with FCU
  • Power Module integration with FCU

Ardupilot autopilot application that we successfully compiled on Linux board Beagle Bone Blue supports a wide variety of sensors from many different manufacturers. Being an open source application, it is supported by developers all across the world and its scope of sensor integration is ever increasing. The application supports multiple communication protocols such as I2C, SPI, UART (or Serial) and CANBUS (in particular UAVCAN) protocols. Beagle Bone Blue provides hardware support for all these communication protocols. However, in the course of making our drones, I have utilized UART and I2C communication protocols only.

A brief introduction to all the supported protocols is as under:

I2C

  • one master, many slaves possible
  • a relatively simple protocol which is good for communicating over short-distances (i.e. less than 1m).
  • bus runs at 100kHz or 400kHz but the data rate is relatively low compared to other protocols.
  • only 3 pins are required (GND, SDA, SCL). VCC is only to power the sensor. [3]
I2C Protocol
I2C Protocol

SPI

  • works in one master, one slave configuration
  • The clock speed of 20Mhz+ speed much faster than I2C
  • short distances protocol upto 10cm max
  • requires at least 4 pins namely GND, SCLK, Master-Out-Slave-In, Master-In-Slave-Out + 1 slave select pin per slave. VCC is only to power the sensor. [3]
SPI protocol
SPI protocol

Serial / UART

  • works in one master, one slave configuration
  • being a character based protocol. Better than I2C and SPI for long distance communication (i.e. 1m)
  • it is relatively fast at 57Kbps ~ 1.5Mbps
  • it requires at least 3 pins (GND, TX, RX) Two pins (Clear-To-Send, Clear-To-Receive) are optional. VCC is only to power the sensor. [3]
UART protocol
UART protocol

CAN bus with UAVCAN

  • works in multimaster bus architecture as any node can initiate transmission of data as per need to do basis
  • being a packet based protocol, its useful for very long distances
  • can achieve high speed of the order of 1 Mb but only 50% of the bus bitrate is usable without major collisions
  • requires at least 3 pins (GND, CAN HI, CAN LO). VCC is only to power the sensor.
  • Recommended for point-to-point topology and not Star or stubs topology
  • All end of busses need to be terminated [3]
CAN Protocol [3]
CAN Protocol [3]

Broad overview of code for sensor integration

            An important concept adopted by Ardupilot autopilot application as part of its sensor driver architecture is the front-end and back-end split mode of implementation. The main Ardupilot code only calls into the front end libraries i.e front end sensor drivers. When the system starts up, the front-end creates one or multiple instances of back-ends based either on

  • Automatic detection of the sensor (i.e., probing for a response on a known I2C address)
  • Using the user defined _TYPE params (i.e. RNGFND_TYPE, RNGFND_TYPE2).

Pointers to each back-end is maintained by front-end. It is held within an array named drivers and incase of user settable parameters; it is always held within front-end. [3]

Overview of code interaction
Overview of code interaction

Understanding the back-end working of code which runs in background. Sensor raw data is collected and converted to standard units and then the values are held in buffers within drivers. Incase of copters, the vehicle main code thread runs regularly at 400Hz. It accesses latest available data through methods in drivers’ front-end. For example , the AHRS/EKF pulls the latest accelerometer, gyroscope and compass information from the sensor drivers’ front-ends. The running of background threads ensure that the high-rate communication with the sensor as it does not affect the main loop’s performance. Serial (i.e UART) interfaced sensor codes are safe to run in the main thread as the underlying serial driver collects data in the background and includes a buffer. It does not affect the main vehicle code. Hence, I have preferred UART as the interface of choice for most sensors.[3]

Driver code interaction flowchart
Driver code interaction flowchart

Connecting GPS using UART and Compass (inbuilt with GPS) using I2C

GPS with Compass features

  • The GPS is driven by Ublox Neo-M8N module
  • It has navigation sensitivity of 167 dBm
  • It takes 26secs for GPS Cold starts
  • Utilizes Low Noise Amplifier MAX2659ELT+
  • Supported by a ceramic patch of 25 x 25 x 4 mm
  • Supported with 3.3V low noise  voltage regulator
Block diagram of UBlox module as per datasheet
Block diagram of UBlox module as per datasheet
Pix Hawk4 GPS with compass pinout
Pix Hawk4 GPS with compass pinout

The connectivity diagram for GPS (with Compass) to Beagle Bone Blue as Fight Controller Unit (FCU)

Connectivity diagram for physical integration of GPS with compass with Beagle Bone Blue which is the FCU
Connectivity diagram for physical integration of GPS with compass with Beagle Bone Blue which is the FCU

Connecting Radio Controller (RC) receiver on SBUS

GPS with compass is the bare minimum sensor required for reliable and stable flight operation of a drone. Now for a drone to be manually controller we need a controller. Incase of drones we have a Radio Controller (RC) Transmitter available in various channel configurations to control the drone operations manually from ground station. The RC transmitter is binded to a RC receiver on radio link. The RC receiver present onboard the drone is connected to Flight Controller over wired link running the option of multiple communication protocols.

            RC Receiver protocols enable communication with the Flight Controller Unit (FCU). Some communication protocols are proprietary and some are non-proprietary. The list of protocols are PWM (universal), PPM or CPPM (universal), SBUS (Futaba, Frsky), IBUS (Flysky), XBUS (JR), MSP (Multiwii), CRSF (TBS Crossfire), SPEKTRUM1024 (Spektrum DSM2), SPEKTRUM2048 (Spektrum DSMX), FPort (Frsky). I am using the SBUS protocol for the choice of RC receiver i.e X8R. It is connected to SBUS interface on Beagle Bone Blue incase of all three drones i.e X-Type, V-Type and Hexacopter.  It requires The 5V and 1-2 Amp power is provided separately through DC convertor and the overall connectivity diagram in Figure 3.10. SBUS is a bus protocol utilized by receivers in order to send commands. Its a digital loss-less bus architecture protocol which uses only 3 wires (signal, power, ground) for multiple channels. Compared to commonly used PPM which is a signal in time domain, SBUS  protocols is digital and requires a serial port on the flight controller i.e UART. A single serial line supports upto 16 channels with each receiving a unique command. This SBUS protocol uses an inverted serial logic. It has a baud rate of 100000, 8 data bits, even parity, and 2 stop bits. The packet size of SBUS is 25 bytes and contains:

Byte[0]: SBUS header, 0x0F

Byte[1 -22]: 16 servo channels, 11 bits each

Byte[23]

Bit 7: channel 17 (0x80)

Bit 6: channel 18 (0x40)

Bit 5: frame lost (0x20)

Bit 4: failsafe activated (0x10)

Byte[24]: SBUS footer

            RC Transmitter protocols enable communication with the RC Receiver onboard drone over radio link. Its communication protocol for radio transmitter and receiver (two way link). Some communication protocols are proprietary and some are non-proprietary. The list of protocols are ACCST (Frsky), ACCESS (Frsky), DSM (Spektrum), DSM2 (Spektrum), DSMX (Spektrum), AFHDS (Flysky), AFHDS 2A (Flysky), A-FHSS (Hitec), FASST (Futaba), Hi-Sky (Deviation / Devo), Frsky’s TX Protocols. Frsky has two TX protocols, ACCST and ACCESS. I have utilized Frsky RC transmitter.

Connectivity diagram for physical integration of Radio controller (RC) Receiver with Beagle Bone Blue which is the FCU. The Radio controller (RC) transmitter is connected to RC receiver over radio link
Connectivity diagram for physical integration of Radio controller (RC) Receiver with Beagle Bone Blue which is the FCU. The Radio controller (RC) transmitter is connected to RC receiver over radio link.

Connecting LIDAR as proximity sensor on UART

A2 RP LIDAR Model: A2M3, A2M4 was integrated with the Hexacopter. Its a 360-degree 2D laser scanner (LIDAR) with 6 meter range. It supports up to 4000 samples of laser ranging per second with high rotation speed. It performs 360-degree 2D to generate 2D point cloud data which is used for mapping, localization and object/environment modeling. The  scanning frequency is 10hz (600rpm) with best resolution of 0.9-Degrees. It adopts low-cost laser triangulation measurement system. It emits modulated infrared laser, during its ranging process.  The signal and the laser signal is reflected by the object in its field of view. The reflected signal is sampled by vision acquisition system and then the embedded DSP starts processing the sample data with distance and angle between object and RPLIDAR through communication interface. The motor system, drives the range scanner core which rotates clockwise to perform the 360-degree scan.

Pictorial representation of LIDAR working as per datasheet
Pictorial representation of LIDAR working as per datasheet

The light source of  LIDAR system is a low power infrared laser. It drives the system by using modulated pulse. The duration of laser light emission is very short and complies with Class I laser safety standard as per product datasheet. The sample point data contains the information as shown in picture below:

Distance and angle information sent as part of data sample as per datasheet [6]
Distance and angle information sent as part of data sample as per datasheet [6]
Rotation and angle calculation philosophy in LIDAR
Rotation and angle calculation philosophy in LIDAR
Operating values of LIDAR as per datasheet
Operating values of LIDAR as per datasheet
Pinout details of LIDAR connector as per datasheet
Pinout details of LIDAR connector as per datasheet

LIDAR Connectivity diagram

The LIDAR on drone has to be mounted horizontally. It could be on the top or bottom. The black cable must point towards the rear of the vehicle. The field of view of the sensor must remain unobstructed which includes the , drone frame parts like legs, GPS mast or any other component.

Connectivity diagram for physical integration of LIDAR with Beagle Bone Blue which is the FCU
Connectivity diagram for physical integration of LIDAR with Beagle Bone Blue which is the FCU

Connecting power module to ADC of Beagle Bone Blue

Power Module              

The APM power Module is connected to ADC port of the Beagle Bone Blue. The power module sits between Input from battery and power distribution for drone components with XT60 Connectors, Male and Female connectors on respective sides. The APM module provides clean power from battery and also provide voltage measurement between 6-28V (upto 6s battery) and 90 Amps of current. The signal output for voltage measurement is 5V while ADC input range is 1.8V max. Thus, we use 1k and 2k resistors to keep signal voltage less than 1.8V. The pinout and connection details are in the connectivity diagram below:-

Power module pinout
Power module pinout
Power module pinout
Figure 3.19: Connectivity diagram for physical integration of power module with Beagle Bone Blue which is the FCU
Figure 3.19: Connectivity diagram for physical integration of power module with Beagle Bone Blue which is the FCU

Connecting Electronic Speed Control (ESC) and motor to PWM input of Beagle Bone Blue

Electronic Speed Control (ESC) and Motors         

The connectivity of Electronic Speed Control with motors and Flight Controller Unit i.e Beagle Bone Blue is illustrated in picture below.

Connectivity diagram for physical integration of Electronic Speed Control (ESCs) and motors with Beagle Bone Blue which is the FCU
Connectivity diagram for physical integration of Electronic Speed Control (ESCs) and motors with Beagle Bone Blue which is the FCU

We have utilized the Brushless DC motors procured off the shelf. The motor and ESC make and model details are available in figure above. The BLDC motor meets the requirement for a mechanical commutator as required in drone application by reversing the motor set-up. As a result, the windings become the stator and the permanent magnets therefore become part of the rotor. These BLDC motors are powered by MOSFET bridge controllers popularly known as ESCs using pulse-width modulation (PWM). The windings are commutated in a controlled sequence. As a result of that, it produces a rotating magnetic field which “drags” the rotor around and consequently drives the attached load which in our case our propellers.

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may also like these