# FFC deployment guide

## Overview

OAK FFC baseboards and camera modules are great for prototyping flexibility. Since cameras are modular, you can place them at
various stereo baselines and select the camera module based on your project requirements (resolution, shutter type, FPS, optics).

### OAK FFC Baseboards

OAK FFC baseboards are OAK devices that have onboard VPU and have exposed FFC connectors, to which you can connect OAK FFC camera
modules. Additionally they expose interfaces like [UART](#FFC%2520deployment%2520guide-Extending%2520functionality-UART), so
further expansion is possible.

Here's the list of our current OAK FFC baseboards:

PoE devices:

 * [OAK-FFC 4P PoE](https://shop.luxonis.com/products/oak-ffc-poe-4p)
 * [OAK-FFC 1P PoE](https://shop.luxonis.com/products/oak-ffc-poe-1p)

USB devices:

 * [OAK-FFC 4P](https://shop.luxonis.com/products/oak-ffc-4p)
 * [OAK-FFC 3P](https://shop.luxonis.com/products/oak-ffc-3p)

### FFC Camera Modules

Here's the list of already built OAK FFC camera modules, which you can easily connect to any OAK FFC baseboard with a flat
flexible cable. We are working towards offering OAK FFC camera modules for all supported CCMs.

| OAK FFC Camera Module | Shutter | Resolution | Notes |
| --- | --- | --- | --- |
| [OAK-FFC-IMX378 (AF)](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-imx378) | Rolling | 12MP | Color,
Auto-Focus |
| [OAK-FFC-IMX378-FF](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-imx378-ff) | Rolling | 12MP | Color,
Fixed-Focus |
| [OAK-FFC-IMX378-W](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-imx378-w) | Rolling | 12MP | Color,
Fixed-Focus, Wide FOV |
| [OAK-FFC-OV9282](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-ov9282-pair) | Global | 1MP | Mono,
Fixed-Focus |
| [OAK-FFC-OV9282-M12](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-ov9282-22-pin) | Global | 1MP | Mono,
M12 mount |
| [OAK-FFC-OV9282-W](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-ov9282-w) | Global | 1MP | Mono,
Fixed-Focus, Wide FOV |
| [OAK-FFC-OV9782-M12](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-ov9782-22-pin) | Global | 1MP |
Color, M12 mount |
| [OAK-FFC-OV9782-W](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-ov9782-w) | Global | 1MP | Color,
Fixed-Focus, Wide FOV |
| [OAK-FFC IMX582](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-imx582) | Rolling | 32MP | Color, AF |
| [OAK-FFC-IMX577-M12](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-imx577-m12) | Rolling | 12MP | Color,
M12 mount |
| [OAK-FFC-IMX214-W](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-imx2147-w) | Rolling | 13MP | Color,
Fixed-Focus, Wide FOV |
| [OAK-FFC-AR0234-M12](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-ar0234-m12) | Global | 2.3MP | Color,
M12 mount |
| [OAK-FFC-IMX462 (M12)](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-imx462) | Rolling | 2MP | Color,
Fixed-Focus |
| [Arducam HQ Cam for RPi, IMX477](https://www.arducam.com/product/b0240-arducam-imx477-hq-quality-camera/) | Rolling | 12.3MP |
Color, CS mount lens |

#### Raspberry Pi Camera Modules

Raspberry Pi sells a [number of camera modules](https://www.raspberrypi.com/documentation/accessories/camera.html) that are
compatible with the OAK FFC baseboards. RPi cameras can be connected to the FFC baseboard via the [RPi Camera
Adapter](https://shop.luxonis.com/products/oak-ffc-2rpi-tbd).

| RPi Camera Module | Sensor | Shutter | Pixels | Notes |
| --- | --- | --- | --- | --- |
| [RPi Camera Module 3](https://www.raspberrypi.com/products/camera-module-3/) | IMX708 | Rolling | 12 MP | Color, Auto-Focus.
Initial (**WIP**) integration |
| [RPi Camera Module 2](https://www.raspberrypi.com/products/camera-module-v2/) | IMX219 | Rolling | 8 MP | Color, Fixed-Focus.
Requires `imx219` branch |
| [RPi High Quality Camera](https://www.raspberrypi.com/products/raspberry-pi-high-quality-camera/) | IMX477 | Rolling | 12 MP |
Color, C/CS mount |
| [RPi Global Shutter Camera](https://www.raspberrypi.com/products/raspberry-pi-high-quality-camera/) | IMX296 | Global | 1.6 MP |
Color, C/CS mount. Might have color artifacts, see [workaround
here](https://discuss.luxonis.com/d/2372-rpi-global-shutter-camera-imx296-module/7) |

> The UC-244 Adapter doesn't work out-of-the-box with the RPi HQ and Global Shutter cameras. Additional steps are
> [required and described here](https://discuss.luxonis.com/d/1460-rpi-high-quality-camera-with-oak-ffc-baseboard)
> .

If you just want to use IMX477, we suggest using [Arducam HQ Cam for RPi,
IMX477](https://www.arducam.com/product/b0240-arducam-imx477-hq-quality-camera/) that works directly with OAK FFC baseboards
(without the UC-244 adapter).

### FFC Camera Mounting

OAK-FFC Kit is a great way to mount your OAK FFC camera modules. It allows you to easily customize both horizontal and vertical
stereo baseline. You can buy it from [our shop](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-kit). For
usage, see [instruction
here](https://github.com/luxonis/oak-hardware/blob/master/oak-ffc-kit/OAK-FFC-Kit_assembly_instruction.pdf).

Mounting adapters can also be found [on Github](https://github.com/luxonis/oak-hardware/tree/master/adapters).

### M12 Mount Lenses

Some of the FFC camera modules above have M12 mount, so you can use a variety of different lenses (for custom FoV), for example:

 * Kit of [10 different M12 lenses](https://www.arducam.com/product/m12-mount-camera-lens-kit-arduino-raspberry-pi/) (for testing
   purposes),
 * [M25156H14 (HFoV: 141°)](https://www.arducam.com/product/M25156H14/),
 * [M40180H10 (HFoV: 100°)](https://www.arducam.com/product/M40180H10/),
 * [M2506ZH04 (HFoV: 33°)](https://www.arducam.com/product/M2506ZH04/),
 * and [others](https://www.arducam.com/product-category/lenses/m12-lens-arducam/).

### M12 Selectable FOV

Tests were done using 2x [OAK-FFC-IMX477-M12](https://shop.luxonis.com/collections/modular-cameras/products/oak-ffc-imx477) and
two different M12 lenses: [20°
FOV](https://www.arducam.com/product/arducam-telephoto-20-degree-1-2-3-m12-mount-with-lens-adapter-for-raspberry-pi-high-quality-camera/)
and [190° FOV](https://www.arducam.com/product/arducam-190-degrees-lens-for-hq-camera-ln074/).

Side-by-side comparison of narrow and wide FOV M12 lenses on OAK-FFC-IMX477-M12:

Test setup from birds view:

## Developing with the OAK FFC

### Installing requirements

Depending on which FFC device you are using, you can check the getting started guide for either:

 * [USB Deployment Guide](https://docs.luxonis.com/hardware/platform/deploy/usb-deployment-guide.md)
 * [PoE Deployment Guide](https://docs.luxonis.com/hardware/platform/deploy/poe-deployment-guide.md)

After installing the dependencies and depthai library, you can start developing with the OAK FFC devices.

### Testing the configuration

After connecting cameras to the baseboard, you can use the
[utilities/cam_test.py](https://github.com/luxonis/depthai-python/blob/main/utilities/cam_test.py) script to quickly test whether
cameras are working as expected. By default, it will try to run 2x mono cameras on 2-lane MIPI ports B (left) and C (right) and 2x
color cameras on port A (RGB) and D (4-lane MIPI ports).

If you have different cameras connected, you can specify which camera types to use with the --cameras argument:

```bash
cam_test.py [-h] [--cameras <BoardSocket>,<CameraType>]
```

For example, if you have 3x mono cameras connected to ports A, B, and C, you can run the following command:

```bash
python3 cam_test.py --cameras rgb,m right,m left,m
```

### Use cameras in code

Similarly, to add such configuration into your script you can use the following code:

#### Python

```python
cam_a = pipeline.create(dai.node.Camera)
cam_a.build(dai.CameraBoardSocket.CAM_A) # Same as CameraBoardSocket.RGB

cam_b = pipeline.create(dai.node.Camera)
cam_b.build(dai.CameraBoardSocket.CAM_B) # Same as CameraBoardSocket.LEFT

cam_c = pipeline.create(dai.node.Camera)
cam_c.build(dai.CameraBoardSocket.CAM_C) # Same as CameraBoardSocket.RIGHT

cam_d = pipeline.create(dai.node.Camera)
cam_d.build(dai.CameraBoardSocket.CAM_D)
```

#### C++

```cpp
auto cam_a = pipeline.create<dai::node::MonoCamera>();
cam_a->setBoardSocket(dai::CameraBoardSocket::CAM_A); // Same as CameraBoardSocket::RGB
cam_a->setResolution(dai::MonoCameraProperties::SensorResolution::THE_400_P);

auto cam_b = pipeline.create<dai::node::MonoCamera>();
cam_b->setBoardSocket(dai::CameraBoardSocket::CAM_B); // Same as CameraBoardSocket::LEFT

auto cam_c = pipeline.create<dai::node::MonoCamera>();
cam_c->setBoardSocket(dai::CameraBoardSocket::CAM_C); // Same as CameraBoardSocket::RIGHT

auto cam_d = pipeline.create<dai::node::MonoCamera>();
cam_d->setBoardSocket(dai::CameraBoardSocket::CAM_D);
```

## Extending functionality

### PSRBS Connector

The OAK-FFC-4P has a PSRBS connector, which allows users to easily connect the OAK camera to the external logic. You can use
[PSRBS cable](https://shop.luxonis.com/products/psrbs-cable) to connect to this connector.

| Pin | Name | Description |
| --- | --- | --- |
| 1 | VDD_5V | 5V power input/output |
| 2 | STROBE | Strobe signal output, can drive external lighting (projector, illumination lights, etc.) |
| 3 | MODULE_nRST | Allows resetting the OAK-FFC from an external source (GND will reset the
[RVC2](https://docs.luxonis.com/hardware/platform/rvc/rvc2.md), same as RST button) |
| 4 | BOOT_SEL | Allows selecting whether to boot into the
[bootloader](https://docs.luxonis.com/software-v3/depthai/depthai-components/bootloader.md) (1.8V will skip bootloader, same as
BOOT button) |
| 5 | COM_AUX_IO2 | 2-lane MIPI FSYNC signal input/output |
| 6 | FSIN_4LANE | 4-lane MIPI FSYNC signal input/output |
| 7 | GND | GND power input/output |

### Connecting an IR Module

If you have an [OAK-FFC-4P](https://docs.luxonis.com/hardware/products/OAK-FFC%25204P.md) R5 or newer and you wish to use the
[OAK-FFC-IR](https://shop.luxonis.com/collections/early-access/products/oak-ffc-ir) module, you must first configure which camera
will drive the STROBE signal to the connector to which you connect your IR module. The connector is located to the left of the
switch (J12, see the image below).

If you have a stereo pair on CAM_B and CAM_C and want to have a dot projector synced with the stereo pair, you should move the
switch 2 or 3 up (ON). Keep in mind that only one switch can be up at a time.

### UART

Some OAK FFC devices have UART exposed, so you can use it for communication with other devices. For example, you can connect a GPS
module to the UART port and get the GPS data in your application.

To use UART in your application, checkout the [UART Example](https://docs.luxonis.com/software/depthai/examples/script_uart.md).

#### UART Pinout

Pinout depends on the board you are using. Here are the UART pinouts for the OAK-FFC devices:

| OAK-FFC Device | TX | RX |
| --- | --- | --- |
| OAK-FFC-4P | 15 | 16 |
| OAK-FFC-4P POE | / | / |
| OAK-FFC-1P POE | 45 | 46 |
| OAK-FFC-3P | / | / |

### SD Card support

SD card functionality is community support only and should still work on separate [depthai
branch](https://github.com/luxonis/depthai-python/tree/sdcard_no_eth_updated) but won't be updated frequently.

You can use the SD card to store data (logs/images/configs) from the running device - see
[example](https://github.com/luxonis/depthai-python/blob/sdcard_no_eth_updated/examples/Script/script_jpeg_to_sdcard.py).

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
