Once running, the homecage system should be simple to use. Yet, for this simple system to work, a number of independent components must each work and must communicate with each other. As is often the case, the implementation details to create a simple system is complex. Two cliches to describe this is 'you can't fly with half a wing' and 'the devil is in the details'.
We have about 15 components in use! Each component is developed independently and all are open source. It is amazing that this system works? What follows is a description of the different pieces of the homecage system with links to the source code and the components that are used.
Raspberry Pi system
This website is written in markdown. The markdown and a description of the contents using yaml are brought together, compiled, and a static site is generated by mkdocs. The final layout is controlled by an mkdocs theme called material.
home.py - The python back-end that runs everything. This includes controlling DIO pins to turn lights on/off, running bash scripts to start/stop the video and to convert .h264 video files to .mp4. This code provides a clearly defined application programming interface (API) to all these components such that the web server in
homecage_app.pyhas an easier job.
homecage_app.py - Python code that uses the Flask library to run the web-server and provide bi-directional control of the
home.pyback-end. In one direction, it accepts web url requests and sends them to the backend, in the other direction, it accesses the back-end and send information back out to the web clients. This primarily implements a REST interface so a client-side browser can get and set server values without explicitly logging in to the server.