Skip to content

mdtetlow/automated-habitat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Automated Habitat

Project to automate Rabbit hutch

Getting started

This project is using a Raspberry Pi 3. The Raspberry Pi 4 is available as we start the project, however it is overkill to spend out on new Pi 4 when a Pi 3 will suffice.

Raspberry Pi 3 setup:

Firstly, download and write rasbian buster lite. Install the following packages - official instructions:

Change user pi password

sudo passwd pi

Change hostname in the following files and then reboot:

/etc/hostname
/etc/hosts

Configure SSH:

sudo systemctl enable ssh
sudo systemctl start ssh

Generate SSH key pair for remote machine:

ssh-keygen -t rsa -b 4096 -C <some-tag-value-maybe-email>

Copy public key to Raspberry Pi for passwordless authentication. I didn't use this method but can do it like this:

cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

Install the following packages:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y vim
sudo apt-get install -y git

Enable camera modue:

sudo raspi-config

Scroll down to 5 Interfacing Options and click Enter. Select P1 Camera and click Enter. Click <Yes> to question: Would you like the camera interface to be enabled?. You will see The camera interface is enabled. Click <Ok> and <Finish>. Now the camera should be enabled so it's time to give it a test. Take a still picture and copy it off the pi to view on your favourite OS:

raspistill -o image.jpg

From another computer running Windows or MacOS:

scp pi@<pi-hostname>:/home/pi/image.jpg <local-path-destination>

Installing Motion package and activate official driver on Pi - reference:

sudo apt-get install motion
sudo modprobe bcm2835-v4l2

Persist the driver

sudo echo "bcm2835-v4l2" >> /etc/modules

Set camera as daemon process that starts automatically. Upate file /etc/default/motion by setting start_motion_daemon=yes.

Configure Motion by making the following updates to file /etc/motion/motion.conf:

# create a backup before we start
sudo cp /etc/motion/motion.conf /etc/motion/motion.conf.bak
daemon on
logfile /tmp/motion.log
stream_localhost off
output_pictures off 
ffmpeg_output_movies off
framerate 100
width 640
height 480
webcontrol_port 8081

Start the Motion service

sudo service motion start

Now the service should be running and a live feed should be available at: http://<service-ip-address>:8081. If it's notworking (as with my first 4 attempts), view the log file (/tmp/motion.log) and debug your motion configuration.

Update Message of the day using http://www.kammerl.de/ascii/AsciiSignature.php. Font: flowerpot Output:

.-------.       ____     _______    _______  .-./`) ,---------.            .-------. .-./`) 
|  _ _   \    .'  __ `. \  ____  \ \  ____  \\ .-.')\          \           \  _(`)_ \\ .-.')
| ( ' )  |   /   '  \  \| |    \ | | |    \ |/ `-' \ `--.  ,---'           | (_ o._)|/ `-' \
|(_ o _) /   |___|  /  || |____/ / | |____/ / `-'`"`    |   \  _ _    _ _  |  (_,_) / `-'`"`
| (_,_).' __    _.-`   ||   _ _ '. |   _ _ '. .---.     :_ _: ( ' )--( ' ) |   '-.-'  .---. 
|  |\ \  |  |.'   _    ||  ( ' )  \|  ( ' )  \|   |     (_I_)(_{;}_)(_{;}_)|   |      |   | 
|  | \ `'   /|  _( )_  || (_{;}_) || (_{;}_) ||   |    (_(=)_)(_,_)--(_,_) |   |      |   | 
|  |  \    / \ (_ o _) /|  (_,_)  /|  (_,_)  /|   |     (_I_)              /   )      |   | 
''-'   `'-'   '.(_,_).' /_______.' /_______.' '---'     '---'              `---'      '---' 

Create file /etc/motd containing the ascii text above.

Username: pi

Project overview

To start with this project will simply enable a standard (none night vision) camera with single lense. The camera feed needs to be made available to a web endpoint allowing any user on the home network to view the feed. However, the feed must not to be opened up to the internet other than via a VPN connection.

Any code required for this project as it progresses will be written in either Python or Ruby.

Later on in the project it may be necessary to connect external devices to the project. In which case the profered HW is an Arduino board (as I have several knocking around in drawers).

Wish list

  • configuration of Raspberry Pi using Chef Ansible

Releases

No releases published

Packages

No packages published