|
1 | 1 | <!-- ToDo --> |
2 | 2 | # Raspberry Pi Setup Guide |
3 | 3 |
|
4 | | -This guide provides detailed instructions for setting up Ethopy on a Raspberry Pi device. |
| 4 | +This guide provides essential commands for setting up Ethopy on a Raspberry Pi device. |
5 | 5 |
|
6 | | -## Initial Setup |
7 | | - |
8 | | -1. Get the latest Raspberry Pi OS (Raspbian) |
9 | | - |
10 | | -2. Configure Raspberry Pi settings using `raspi-config`: |
11 | | - ```bash |
12 | | - sudo raspi-config |
13 | | - ``` |
14 | | - - Enable SSH |
15 | | - - Disable screen blanking |
16 | | - - Enable Desktop auto-login |
17 | | - |
18 | | -3. (Optional) Change hostname for easier identification: |
19 | | - ```bash |
20 | | - sudo sed -r -i s/raspberrypi/<<HOSTNAME>>/g /etc/hostname /etc/hosts |
21 | | - ``` |
22 | | -
|
23 | | -4. (Optional) Change default username: |
24 | | - ```bash |
25 | | - sudo useradd -s /bin/bash -d /home/<<USERNAME>>/ -m -G sudo <<USERNAME>> |
26 | | - sudo passwd <<USERNAME>> |
27 | | - mkhomedir_helper <<USERNAME>> |
28 | | - sudo userdel -r -f pi |
29 | | - ``` |
30 | | -
|
31 | | -## System Dependencies |
32 | | -
|
33 | | -1. Install required system libraries: |
34 | | - ```bash |
35 | | - sudo apt update |
36 | | - sudo apt install -y \ |
37 | | - python-dev \ |
38 | | - libatlas-base-dev \ |
39 | | - build-essential \ |
40 | | - libavformat-dev \ |
41 | | - libavcodec-dev \ |
42 | | - libswscale-dev \ |
43 | | - libsquish-dev \ |
44 | | - libeigen3-dev \ |
45 | | - libopenal-dev \ |
46 | | - libfreetype6-dev \ |
47 | | - zlib1g-dev \ |
48 | | - libx11-dev \ |
49 | | - libjpeg-dev \ |
50 | | - libvorbis-dev \ |
51 | | - libogg-dev \ |
52 | | - libassimp-dev \ |
53 | | - libode-dev \ |
54 | | - libssl-dev \ |
55 | | - libgles2 \ |
56 | | - libgles1 \ |
57 | | - libegl1 |
58 | | - ``` |
59 | | -
|
60 | | -2. Install Python packages: |
61 | | - ```bash |
62 | | - sudo pip3 install 'numpy>=1.19.1' pygame==1.9.6 cython pybind11 scipy datajoint omxplayer-wrapper imageio imageio-ffmpeg |
63 | | - ``` |
64 | | -
|
65 | | -## Hardware-Specific Setup |
66 | | -
|
67 | | -### 7" Raspberry Pi Touchscreen |
68 | | -
|
69 | | -Install multitouch driver: |
| 6 | +## SSH Setup |
| 7 | +Enable SSH service for remote access: |
70 | 8 | ```bash |
71 | | -git clone http://github.com/ef-lab/python-multitouch ~/github/python-multitouch |
72 | | -cd ~/github/python-multitouch/library |
73 | | -sudo python3 setup.py install |
| 9 | +sudo systemctl enable ssh # Enables SSH to start automatically at boot |
| 10 | +sudo systemctl start ssh # Starts SSH service immediately |
74 | 11 | ``` |
75 | 12 |
|
76 | | -### 3D Graphics Support |
77 | | -
|
78 | | -Install Panda3D for Raspberry Pi: |
| 13 | +## Ethopy Installation |
| 14 | +Τest database connection: |
79 | 15 | ```bash |
80 | | -wget ftp://eflab.org/shared/panda3d1.11_1.11.0_armhf.deb |
81 | | -sudo dpkg -i panda3d1.11_1.11.0_armhf.deb |
| 16 | +ethopy-db-connection # Tests database connection to verify setup |
82 | 17 | ``` |
83 | 18 |
|
84 | | -### GPIO Support |
85 | | -
|
86 | | -Enable pigpio service: |
| 19 | +## GPIO Hardware Support |
| 20 | +Enable pigpio daemon for GPIO control: |
87 | 21 | ```bash |
88 | | -wget https://raw.githubusercontent.com/joan2937/pigpio/master/util/pigpiod.service |
89 | | -sudo cp pigpiod.service /etc/systemd/system |
90 | | -sudo systemctl enable pigpiod.service |
91 | | -sudo systemctl start pigpiod.service |
| 22 | +sudo systemctl enable pigpiod.service # Enables pigpio daemon to start at boot |
| 23 | +sudo systemctl start pigpiod.service # Starts pigpio daemon for immediate GPIO access |
92 | 24 | ``` |
93 | 25 |
|
94 | | -## X Display Configuration |
95 | | -
|
96 | | -For running graphical applications via SSH: |
| 26 | +Install GPIO libraries: |
97 | 27 | ```bash |
98 | | -echo 'export DISPLAY=:0' >> ~/.profile |
99 | | -echo 'xhost + > /dev/null' >> ~/.profile |
| 28 | +pip install pigpio # Python library for pigpio daemon communication |
| 29 | +sudo apt-get install python3-rpi.gpio # Alternative GPIO library for Raspberry Pi |
100 | 30 | ``` |
101 | 31 |
|
102 | | -## Remote Control Setup (Optional) |
103 | | -
|
104 | | -If you want to use Salt for remote control: |
| 32 | +## Display Configuration |
| 33 | +Configure display settings for GUI applications via SSH: |
105 | 34 | ```bash |
106 | | -sudo apt install salt-minion -y |
107 | | -echo 'master: <<YOUR_SALT-MASTER_IP>>' | sudo tee -a /etc/salt/minion |
108 | | -echo 'id: <<HOSTNAME>>' | sudo tee -a /etc/salt/minion |
109 | | -echo 'master_finger: <<MASTER-FINGER>>' | sudo tee -a /etc/salt/minion |
110 | | -sudo service salt-minion restart |
| 35 | +export DISPLAY=:0 # Sets display to primary screen |
| 36 | +sed -i -e '$aexport DISPLAY=:0' ~/.profile # Persists DISPLAY setting in profile |
| 37 | +sed -i -e '$axhost + > /dev/null' ~/.profile # Allows X11 forwarding access |
111 | 38 | ``` |
112 | 39 |
|
113 | | -## Ethopy Installation |
114 | | -
|
115 | | -1. Install Ethopy: |
116 | | - ```bash |
117 | | - pip install "ethopy[obj]" # Includes 3D object support |
118 | | - ``` |
119 | | -
|
120 | | -2. Create configuration file at `~/.ethopy/local_conf.json`: |
121 | | - ```json |
122 | | - { |
123 | | - "dj_local_conf": { |
124 | | - "database.host": "YOUR DATABASE", |
125 | | - "database.user": "USERNAME", |
126 | | - "database.password": "PASSWORD", |
127 | | - "database.port": "PORT", |
128 | | - "database.reconnect": true, |
129 | | - "database.enable_python_native_blobs": true |
130 | | - }, |
131 | | - "source_path": "LOCAL_RECORDINGS_DIRECTORY", |
132 | | - "target_path": "TARGET_RECORDINGS_DIRECTORY" |
133 | | - } |
134 | | - ``` |
135 | | -
|
136 | | -3. Initialize database schemas: |
137 | | - ```bash |
138 | | - ethopy-setup-schema |
139 | | - ``` |
140 | | -
|
141 | | -## Running Experiments |
142 | | -
|
143 | | -You can run experiments in two modes: |
144 | | -
|
145 | | -1. Service Mode (controlled by database): |
146 | | - ```bash |
147 | | - ethopy |
148 | | - ``` |
149 | | -
|
150 | | -2. Direct Mode (specific task): |
151 | | - ```bash |
152 | | - ethopy --task-idx 1 |
153 | | - ``` |
| 40 | +## Screen Blanking Disable |
| 41 | +To prevent screen from turning off, run raspi-config: |
| 42 | +```bash |
| 43 | +sudo raspi-config |
| 44 | +``` |
| 45 | +Navigate to "Display Options" → "Screen Blanking" → Set to "No" |
154 | 46 |
|
155 | 47 | ## Troubleshooting |
156 | 48 |
|
|
0 commit comments