## 2 Structure, Arrangement, and Mechanisms  
In this section, we briefly describe the structure and framework of CageView for food control and activity monitoring. Three components are required for such a system:  
1. Programmable food hopper;
2. On-line visual monitoring capability;
3. Motion sensing and tracking system. CageView accomplishes this with:  
1. An actuator for linear displacements of the food access door controlled by a custom-designed interface to set the feeding and fasting schedule;
2. A vision unit with visible and near-infrared cameras and a near mid-infrared LED for day and nighttime monitoring, which forms a video streaming and data transmission system using wireless or wired communication networks;
3. A trained convolutional neural network (CNN) that detects the animal position in the image which enables movement measurement. Figure 1 presents a schematic representation of CageView and the communication between its different subsystems. As shown in the figure, food access and animal activity data are transmitted from the laboratory location to the experimenter's desktop application through the communication network. In parallel, the experimenter can send control commands to the laboratory location where the mouse cage is housed. The placement of the feeding mechanism and the vision system is shown in Figure 1(a). The feeding mechanism is mounted on the food-holding portion of a standard wire cage rack and placed in a standard cage. The vision unit is placed next to the plastic cage to detect the animal and monitor and record its activity. Figure 1(b) shows the feeding mechanism, which can be mounted on or within a mouse cage and comprises a custom-designed prismatic mechanism for opening and closing the food access door. The actuation system embedded in the custom-designed prismatic mechanism generates the necessary inputs to drive the main shaft connected to the food access door, and a processing unit using a custom-designed electronic board is arranged to operate and control the actuation system of the prismatic mechanism. In Figure 1(c), the vision unit, which should be placed in proximity of a cage, is shown. The vision unit comprises a Raspberry Pi single-board computer, a visible-near infrared camera system to capture the animal's image, a sensory system, and a data transmission and video streaming system to send and receive the data, photos, and videos to and from the interface software through a wired or wireless connection, including Wi-Fi or Bluetooth. In the vision unit, the processing unit receives the sensory system data, controls the camera, and analyzes the light level. The feeding mechanism is designed to be mounted on conventional cages used in most research centers and has a sliding mechanism that can enable or disable the animal's access to food. The sliding mechanism operates based on a rack and pinion configuration attached to a 6-V geared DC motor. The DC motor is commanded by hardware located inside the feeder. The hardware is equipped with a Bluetooth Low Energy (BLE) module and a 10-12-V power supply. The BLE module is responsible for receiving the feeding and fasting schedule from the app and running the DC motor accordingly. Therefore, the feeder mechanism changes the food access according to the schedule set by the experimenter. The experimenter is also able to override the programmed food access by opening or closing the food access door using the built-in function override function of the interface program. The interface program can also provide the history of the animal's access to food and change the food access schedule conveniently and according to the experimenter's needs. The vision unit includes a set of light sensors, a camera, and a trained animal detection algorithm based on artificial intelligence or a neural network. The camera may be used for remote monitoring of the animal, which is needed in many applications such as post-surgical monitoring, humane endpoint monitoring, and pregnancy or mating strategy monitoring.