In case you alreay did it, you can skip this step. This manual was taken from the reptilearn project https://github.com/neural-electrophysiology-tool-team/reptilearn
- install arduino-cli (activate your python interpreter before running)
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=$(dirname $(which python)) sh- Once installed, run these commands to install the necessary Arduino libraries:
arduino-cli core update-index
arduino-cli lib install AccelStepper ArduinoJson OneWire DallasTemperature- Finally, install the software for your specific Arduino board model(s). For example for an Arduino Nano Every or UNO WiFi Rev 2 run:
arduino-cli core install arduino:megaavrFor other models, the following command will list all available board IDs:
arduino-cli core list --all - First, you need the arduino serial number
cd periphery
python main.py --list-ports- Get the serial number from the output and create a new item in Arena/configurations/periphery_config.json:
# example of adding an arduino for camera trigger of 30Hz
"camera trigger": {
"allow_get": true,
"fqbn": "arduino:megaavr:nona4809",
"interfaces": [
{
"name": "Camera Trigger",
"pin": 12,
"pulse_len": 33,
"pulse_width": 0.7,
"serial_trigger": false,
"type": "trigger",
"ui": "camera_trigger"
}
],
"serial_number": "<arduino_serial_number>"
}# example of adding an arduino for feeder, day lights, IR lights and temperature sensors
"arena": {
"allow_get": true,
"fqbn": "arduino:megaavr:nona4809",
"interfaces": [
{
"command": "dispense",
"icon": "gift",
"name": "Feeder 1",
"pins": [
10,
9,
8,
7
],
"type": "feeder",
"ui": "action",
"order": 1
},
{
"name": "day_lights",
"pin": 2,
"type": "line",
"ui": "toggle"
},
{
"name": "IR_lights",
"pin": 14,
"type": "line",
"ui": "toggle"
},
{
"icon": "thermometer-half",
"name": "Temp",
"pin": 5,
"type": "dallas_temperature",
"ui": "sensor",
"unit": "\u00b0"
}
],
"serial_number": "0E4273DD51534C5036202020FF072035"
}- Upload the code to the arduinos
cd periphery
python main.py --uploadNotice. This operation can disconnect the server from the internet.
- Build and Restart the periphery container The periphery docker container needs to be re-build for loading the new periphery.json file.
cd docker/
docker-compose up -d --build periphery- Restart PreyTouch