Sep 29, 2022

Public workspaceControl light cycle and measure temperature/humidity in animal housing using Raspberry Pi and Python

This protocol is a draft, published without a DOI.
  • 1Massachusetts Institute of Technology
Icon indicating open access to content
QR code linking to this content
Protocol CitationMatias Andina 2022. Control light cycle and measure temperature/humidity in animal housing using Raspberry Pi and Python. protocols.io https://protocols.io/view/control-light-cycle-and-measure-temperature-humidi-cg9ktz4w
License: This is an open access protocol distributed under the terms of the Creative Commons Attribution License,  which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited
Protocol status: Working
We use this protocol and it's working
Created: September 29, 2022
Last Modified: September 29, 2022
Protocol Integer ID: 70668
Keywords: python, light, temperature, sensor, rodent, housing
Abstract
Python Code and Protocol for controlling animal housing lights, and measure temperature and humidity, using a Raspberry Pi, and ANAVI-light HAT.

Order parts
Order parts
Order ANAVI LIGHT PHAT Advanced Kit (https://www.croCost49 USD wdsupply.com/anavi-technology/light-phat) and Raspberry Pi (compatible raspberry pi include RPi Zero W and RPi 3B+). This protocol has been tried using a Raspberry Pi 4.

Measure the length where you want to put your lights.
Order LED strip according to length. It is recommended that you order an RGBW LED strip, as the white leds will be better for light than generating white light by driving the RGB to full power.
Order OLED Display Module (Amazon Link)Cost20 USD, pack of 6

Order a power supply that can provide at least 8V to the ANAVI LIGHT PHAT.
Power supply can be fed through these DC adapter plugsCost5 USD pack of 10

Prepare and connect Hardware
Prepare and connect Hardware
Mount the ANAVI hat into the raspberry Pi
Feed the White wire from your RGBW into the BLUE socket of the ANAVI LIGHT PHAT. The code is expecting to output high through the blue pin. If you decide to go for the RGB version, you will need to modify the code.
Critical
Connect temperature, light sensor, and OLED display to the I2C ports on the ANAVI LIGHT PHAT.
Install software
Install software
Go to house code repository at https://github.com/matiasandina/house
Read instructions and follow setup on the raspberry pi
Prepare and connect Hardware
Prepare and connect Hardware
Position lights and sensors in their desired place
Test
Test
Test the functioning of the code (lights turn on, OLED display shows proper temperature and humidity). You can change default light hours and file issues to improve functioning. Inspect data folder to find the csv files with saved data