This document aims to capture general procedures for the homecage_quantification project.
We are using FED3 devices to deliver food and quantify intake in the homecage
FED3 are devices were created by Lex Kravitz. If you want to buid one from scratch, here's the list of materials.
Luckily, you can get the electronics from Open Ephys Production site. Link here.
For now, you have to 3D print yourself. Printer quality is important for mechanical devices, it takes around one day to print one.
As of March 2020, Open Ephys is working on finding a 3D printing partner. To be updated.
On the heart of the FED3 devices, there's an Adafruit M0 board. This means you will be using the Arduino IDE for managing code and communicating with the device. Carefully follow the instructions on the hackaday page (link below).
You can find all the relevant information here
Please check the videos for FED device on YouTube
You can use this tool for data analysis.
FED3 devices are powered by batteries that take quite a long time to refill. Although they last for a bit more than a week during operation, they can take up to 2 days to fully charge.
The current solution is to have extra batteries charged. It's a good idea to have extra battery packs charging with this charger. Just swap them on the device when they get low.
FED3 devices ship with a real time clock that needs to be set to a proper time.
To flash/upload sketches, put the Adalogger it into "bootloader" by doing a "double-clicking" on the little reset button on the board. When it is ready to accept code, the red LED on the Adalogger should "breathe" like this: https://www.youtube.com/watch?v=-Ce02eltnIw
I tried to upload sketches in my Ubuntu machine but failed (even though the ports showed the feather m0 board, uploading code yielded "device not found"). I suspect that it has to do with root permissions but I didn't want to struggle for too long with it to find out.
Luckily I had a Windows machine available, so I:
Installed fresh arduino IDE 1.8 copied the libraries (following install guide on hackaday) Configured additional boards manager on Preferences (link to https://adafruit.github.io/arduino-board-index/package_adafruit_index.json) Installed Adafruit SAMD board 1.5.5 (following install guide on hackaday and recent issues) Java 8 (this machine didn't have Java and the first iteration returned a java error)
Uploaded the sketches with no problem. Clock updated, FED3 back to work. Your clock should be good to go until the next daylight savings time messes with your data or the clock's battery dies, whichever comes first!
Your questions will be probably answered if you visit these sites or contact these people.
-
Request access to the FED3 google groups. Group link here
-
Lex Kravitz
We are tracking activity using optic flow estimation and tossing all video.
Why?
- It gets the job done (general activity estimate).
- It's computationally inexpensive. As of 2020, DeepLabCut is still computationally expensive, we can't run it real time on a raspberry Pi 4.
We gain access to the raspberries through the local network (either ssh or vnc). You can find VNC Viewer [here]. If you are trying to use VNC viewer from an Android device, you can find it on the play store.
Our aim is to setup the raspberries in a way that allows us to always know the mac address and IP of each Raspberry Pi. Every Raspberry Pi is scheduled to send this information to the central computer. We can use that information to visualize the experiment and perform (see Video Stream).
The proper way to setup this is detailed on README.md for this repository. If you followed these steps, your configuration should be good to go.
The main script to control the cameras, run optic flow, and stream via IP is called main.py
.
- Check that the camera is OK.
cd homecage_quantification/
python3 preview_camera.py
After a couple of seconds you should see a window with camera preview. Press 'q' to quit the preview.
You can then trigger the program doing
python3 main.py
You should see pop-up windows with the cameras and optic flow.
To see feed connect to IP:5000
* Serving Flask app "main" (lazy loading)
...
Data will be saved on homecage_quantification/
folder. See Video Stream section for ways to access the stream.
The thermal camera will be running from an openMV board and a Lepton 3.5 module. We can trigger a run with
python3 start_thermal.py
The LED on the openMV board should go from blue to green and then start capturing images. Your data will be saved on the local SD card of the openMV board.
It is possible to stream to a local network to be visualized by other computers in the network (via IP). To accomplish this, proper setup is needed. Mainly:
- A raspberry Pi that was configured using
setup.sh
and will thus send MAC and IP address every minute to the central computer. - A "central" computer with static IP, henceforth "cohilab computer".
- A folder on choilab computer with the proper information for each raspberry (MAC address and IP).
- The
raspberry_IP/update_pi_info.py
script on the choilab computer.
To visualize the stream, on the choilab computer:
- Open a terminal (Ctrl + Alt + T)
- Navigate to the proper folder (
cd Raspberry_IP/
) - Run the python script
python3 update_pi_info.py
This will open many browser tabs. You will be prompted for username and password.
In principle, any computer connected to the network can check the stream from a web browser. It will need IPs to do so (found on the
raspberry_IP
folder on the choilab computer).
It might be necessary to record. For this, the main.py
script allows you to change the recording specifically on the camera object.
If you followed the installation properly, the raspberry should accept ssh and the choilab computer should have keys to do ssh. You can ssh into any raspberry pi doing:
ssh pi@ip_address
This will give you access to the terminal but you will not be able to visualize anything going on.
If you have a keyboard/monitor connected to the Pi, you can use VNC viewer to do remote control.
You can access any raspberry using VNC software. This can be used to:
- See the desktop/folders.
- Remotely control the raspberry.
- Transfer files (aka, send your data from the raspberry to another computer).