# Raspberry Pi Configuration

Please see the [Raspberry Pi](https://khalil-lab.gitbook.io/evolver/hardware/raspberry-pi) infrastructure page for additional information on the RPi we use for the eVOLVER.

{% hint style="danger" %}
Be sure to [update the server code](https://khalil-lab.gitbook.io/evolver/guides/updating-the-evolver-server) on the RPi after following this guide, or you will have issues communicating with the server through the DPU or with actuating/sensing connected components!
{% endhint %}

[RPi Imager Guide](#using-raspberry-pi-imager) - **Recommended**

[Command Line Guide (Mac/UNIX only)](#using-command-line-utilities-mac-unix-only)

### Using Raspberry Pi Imager

**1.** Download the pre-configured eVOLVER RPi image [here](https://drive.google.com/file/d/1yDQ_HLA8o-DooAyxWKPMJJNqN8z-LEy3/view?usp=sharing).

**2.** Download and install the [Rapberry Pi Imager Tool](https://www.raspberrypi.com/software/).

![](https://3394537773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYy5AdmKzUTn7D8n357Md%2Fuploads%2FXRkDackXHwuhfq1Wf0aA%2FScreen%20Shot%202022-05-31%20at%201.30.16%20PM.png?alt=media\&token=a9fe6126-8100-4d4c-89fd-b02cd018c4e9)

**3.** Plug an 8GB micro-SD for the RPi into an adapter, then into a the computer.

**4.** Click the `Choose OS` button, then scroll to the bottom and click `Use Custom`.

![](https://3394537773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYy5AdmKzUTn7D8n357Md%2Fuploads%2Fes67FaWQXgVpTXTaPVKD%2FScreen%20Shot%202022-05-31%20at%201.37.44%20PM.png?alt=media\&token=fc9d618c-0217-46ce-8bc8-c0d6e84305cd)

![](https://3394537773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYy5AdmKzUTn7D8n357Md%2Fuploads%2FgcCdApqkTN3Gxil2F7jb%2FScreen%20Shot%202022-05-31%20at%201.38.41%20PM.png?alt=media\&token=e4894452-968f-46e2-a682-bbd9f2d27590)

**5.** In the popup at the dropdown at the bottom of the window, select `All files(*.*)`. Then select the image file downloaded in Step 1.

![](https://3394537773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYy5AdmKzUTn7D8n357Md%2Fuploads%2FS7rKBwtvv8ay6RQ2LQHo%2FScreen%20Shot%202022-05-31%20at%201.42.01%20PM.png?alt=media\&token=733ce44e-3aa5-4295-ab03-5262c79b6c64)

**6.** Click the `Choose Storage` button and select the SD Card.

![](https://3394537773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYy5AdmKzUTn7D8n357Md%2Fuploads%2Fwcd3Rq5zioaxrmMpyjqh%2FScreen%20Shot%202022-05-31%20at%201.58.53%20PM.png?alt=media\&token=8dedf0f5-77da-4571-b3c3-4278fd969ea9)

**7.** Click the `Write` button. A notification might appear warning about erasing all existing data on the card. Click `Yes`. If it asks for your computer password afterwards, enter it. It might take a while to finish (\~40m).&#x20;

**8.** When it completes, you can plug the SD card into the RPi. You will need to [update the server code](https://khalil-lab.gitbook.io/evolver/guides/updating-the-evolver-server) and potentially the `conf.yml` with the latest code from GitHub.&#x20;

### Using command line utilities (Mac/UNIX only)

**1.** Download the pre-configured eVOLVER RPi image [here](https://drive.google.com/file/d/1yDQ_HLA8o-DooAyxWKPMJJNqN8z-LEy3/view?usp=sharing).

**2.** Plug the SD card into the computer.

**3.** Open a terminal of your choice (I recommend [iTerm2](https://iterm2.com/)).

**4.** Run the following command:

`diskutil list`

Identify the SD card name from this (it should be obvious). Next run:

`diskutil unmountdisk <diskname>`

where \<diskname> is the name you identified from the previous command - it should look like

`/dev/disk3/` or something similar.

**5.** Use the `dd` command to copy the image onto the SD card:

`sudo dd bs=4m if=<diskimage.img> of=<diskname>`

{% hint style="warning" %}
Be sure to change the two arguments above! `if` should point to the image you downloaded from step 1, and `of` should be the diskname.
{% endhint %}

This command can take a while, and it doesn't show any status or progress updates - be patient. If it fails, try decreasing the `bs` argument to `1m` instead of `4m` - this will slow things down but will decrease the chance of failure. If you still have issues reach out on the [forum](https://www.evolver.bio/).

**6.** When it completes, you can plug the SD card into the RPi. You will need to [update the server code](https://khalil-lab.gitbook.io/evolver/guides/updating-the-evolver-server) and potentially the `conf.yml` with the latest code from GitHub.

## Backing Up Raspberry Pi (Make a Custom Image)

Writing an image to save your full Raspberry Pi configuration.&#x20;

Useful to save time when reimaging your Raspberry Pi if you want to go back to your custom Python code and calibrations as quickly as possible.&#x20;

Follow this guide: <https://www.tomshardware.com/how-to/back-up-raspberry-pi-as-disk-image>
