# Getting Started


This page shows how to set up the epc670 ToF HAT+ on a raspberry pi. The documentation will focus on the bare epc670 ToF HAT+ description for custom HW integration. For use with a Raspberry Pi it is recommended to proceed to the {external+epc670_starter_kit:doc}`epc670 starter-kit <index>` documentation after installing the epc670 ToF HAT+.

```{contents} Steps
:local:
:depth: 2
```

## Preparations
Make sure you have the following ready for access:
- epc670 ToF HAT+
- FFC Ribbon 22 pos. 0.5mm, 30 mm

## Connect HAT
1. Ensure raspberry pi has no power supply connected
2. Connect the bottom end of the FFC ribbon to Raspberry Pi
   - Open/Release the connector by lifting the black latch.
   - Insert ribbon with the blue stiffener facing the HDMI connectors on the raspberry pi ath the "CAM/DISP X"connectors.</br>For usage with the epc670-tofhat-rpi5 os image connect it to "CAM/DISP 1" connector.
   - Close/Fixate the connector by pressing the black latch.
3. Connect epc670 ToF HAT+ on the 40-Pin Connector so that it stacks with the Raspberry Pi
4. Connect the FFC ribbon top end to the epc670 TOF HAT+
   - Open/Release the connector by lifting the black latch.
   - Insert the ribbon with the blue stiffener facing the PCB on the epc670 ToF HAT+ at the connector next to the recess.
   - Close/Fixate the connector by pressing the black latch.
```{figure} _static/images/ribbon_on_annotated.jpg
:alt: Image of tofhat670 annotated with bring-up sequence
:figwidth: 60%
```
## Software Components
It is recommended to use the [epc670-tofhat-rpi5](https://storage.espros.com/modules/epc670_tofhat/images/rpi5/latest) os image as a starting point.
Refer to the {external+epc_user_guides:doc}`(SD-Card Flashing Guide)<user_guides/os_image_flashing>` for flashing and to the {external+epc670_starter_kit:doc}`epc670 starter-kit <index>` for an introduction to the os image.
Alternatively there are debian packages available for the following:
| Name           | Package Name         | Description                                                           |
| -------------- | -------------------- | --------------------------------------------------------------------- |
| epc670 TOF HAT | epc670-tofhat        | Device Tree, driver for epc670 TOF HAT+                               |
| epctofcam lib  | libepctofcam-dev     | ESPROS ToF Cam API(Python, C++) to grab images from the Device Driver |
| epc670 driver  | epc-drivers-dkms     | Device Driver for epc670 sensor                                       |

To get the packages refer to [Install Package Apt Repository](epc670-install-package-apt-repository) user guide.


## Disconnect HAT
1. Ensure Raspberry Pi has no power supply connected
2. Disconnect the FFC ribbon top end from the epc670 TOF HAT+
   - Open/Release the connector by lifting the black latch.
   - Remove the ribbon with the blue stiffener facing the PCB on the epc670 ToF HAT+ at the connector.
3. Disconnect epc670 ToF HAT+ on the 40-Pin Connector so that it stacks with the Raspberry Pi
4. Disconnect the FFC ribbon bottom end from Raspberry Pi
   - Open/Release the connector by lifting the black latch
   - Remove the ribbon with the blue stiffener facing the HDMI connectors on the Raspberry Pi at the "CAM/DISP X"connectors.
```{figure} _static/images/ribbon_off_annotated.jpg
:alt: Image of tofhat670 annotated with bring-up sequence
:figwidth: 60%
```