19.04.2017, 22:22 by Mare

Smart nesting box is small wooden box for nesting birds. It is equipped with the live camera feed and some sensors. Four smart nesting boxes were made and three of them were placed in the wild. One was inhabited with the great tit in te early march 2017. After that, the bird laid 11 eggs. The bird then incubated eggs for 12 days. On the Easter Monday, the first shells cracked and newborns started poping out of the eggs.

I prepared the whole project for local school. The nesting boxes were made by 8 children aged from 11 to 14 during afternoon classes. It was great fun and the young scientists learned many new skills from electronics, materials, hand tools, crafting, programming, components, circuit design, biology, photography, physics, etc… The nesting box is described in detail here with all necessary production steps. Contact for further info is m@v4.si. The three nesting boxes placed in the wild have…

live video feed and sensor readouts available H E R E.

The concept

The base for construction was this drwaing which I found at the local ornithology site:

The nesting box without electronics will look like this:

When “normal” roof is removed, it can be replaced with smart roof:

and the electronics is attached to this smart roof:

New smart roof has semnsors, camera and the central unit for processing images and sending sensor readouts.

Mechanical construction

The mechanical construction consists of two main parts: the nesting box and smart roof with electronics:

Here is “Size A”, which is suitable for smaller birds. There are two roof options: 1. classic, which is used to cover the hole in the internal ceiling (where the camera and sensors fits in the interior) and 2. “smart” roof with sensors and camera with electronics. The interactive 3D model is hosted on 3DcontentCentral:

Download complete model…

Here is Construction animation:

::: Assembly instructions (PDF) :::

Front plates are made from sheet metal. I ordered laser cutting from local metal shop. They made it for free, because the project was not commercial.

Company Povše metal from local Šentrupert use high tech CNC laser cutters.

After assembly, use weather proof paint and protect the wood from the elements. Keep in mind the darker paint will get hot if the nesting box is placed on the open. It is now time to find the quiet place for the nesting box in the shadow: northern part of the house, remote tree with thick shadow, etc…

Make nesting box “smart”

Base for nesting box was Raspberry Pi. It is a well known “tiny and affordable computer that you can use to learn programming through fun, practical projects. Join the global Raspberry Pi …”

The block diagram:

Not all components from the diagram were assembled due to lack of time. Remember, the whole development and construction process was run by 8 young students from elementary school and the have to learn everything from scratch. Left side are sensors: illumination, RH/T/p, optical entrance barrier and camera (from top to bottom in the above drawing).

Illumination

The illumination sensor was not completed and was left for next generation nesting boxes.

Climatic sensor

Climatic sensor measuring humidity, temperature and air pressure was one of the earlier designs here with small modification. The RS485 was replaced with 3,3V serial interface on both sides (R.pi and sensor) due to short distance.

Optical barrier

The Optical barrier sensor was made with IR LED and PIN photodiode. The sensor performed excellent.

Complete photointerrupter documentation, schematic, altium files and toner transfer artwork for home production of the PCBs.

Camera

Camera for this project was Raspberry Pi NoIR camera. It is same as usual camera used for R.Pi with small exception. There is no IR filter on the top of the image sensor, which usually prevents IR light reaching the sensor. When dark scene is illuminated with IR light it can be observed in the darkness. It is also the only way to observe the interior of the nesting box without interfering with the birds daily routine. Birds are known to orientate their lives with the daylight.

Camera illumination was done with 9 IR LEDs:

There are two version of the housing with the IR LEDs, both available here. The final version of the ledp PCB is here.

Raspberry Pi breakout board

Finally, the raspberry pi needs breakout board with PoE for connection of all sensors and powering it up.

Software

Here is step-by-step for R.Pi configuration

Install R.pi + Raspbian Jessie Lite from https://www.raspberrypi.org/downloads/raspbian/

Use Win32DiskImager

R.Pi has no ssh enabled, so connect to hdmi/tv, log in and…

sudo raspi-config sudo raspi-config

expand file system

advanced, enable SSH

generate new ssh keys

sudo / bin / rm -v / etc / ssh / ssh_host_ * sudo ssh-keygen -t dsa -N "" -f / etc / ssh / ssh_host_dsa_key sudo ssh-keygen -t rsa -N "" -f / etc / ssh / ssh_host_rsa_key sudo ssh-keygen -t ecdsa -N "" -f / etc / ssh / ssh_host_ecdsa_key sudo ssh-keygen -t ed25519 -N "" -f / etc / ssh / ssh_host_ed25519_key sudo systemctl restart sshd.service sudo reboot sudo apt-get update sudo apt-get dist-upgrade sudo /bin/rm -v /etc/ssh/ssh_host_* sudo ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key sudo ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key sudo ssh-keygen -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key sudo ssh-keygen -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key sudo systemctl restart sshd.service sudo reboot sudo apt-get update sudo apt-get dist-upgrade

Y(es)

q(uit)

………. this may taaaaaakeeeee loooooonnggg

…. continue with ffmpeg installation

mkdir ffmpeg cd ffmpeg wget https: // github.com / ccrisan / motioneye / wiki / precompiled / ffmpeg_3.1.1- 1 _armhf.deb sudo dpkg -i ffmpeg_3.1.1- 1 _armhf.deb sudo apt-get install python-pip python-dev curl libssl-dev libcurl4-openssl-dev libjpeg-dev libx264- 142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5 mkdir ffmpeg cd ffmpeg wget https://github.com/ccrisan/motioneye/wiki/precompiled/ffmpeg_3.1.1-1_armhf.deb sudo dpkg -i ffmpeg_3.1.1-1_armhf.deb sudo apt-get install python-pip python-dev curl libssl-dev libcurl4-openssl-dev libjpeg-dev libx264-142 libavcodec56 libavformat56 libmysqlclient18 libswscale3 libpq5

Y(es)

sudo nano / etc / rc.local sudo nano /etc/rc.local

Sorry, this is for local ARNES academic and research network. Google around how to use youtube live event or youstream…

———8<——–/etc/rc.local———8<——–

raspivid -o - -t 0 -a 12 -a "Civ 1 %T %d.%m.%Y" --mode 4 -fps 25 -f | ffmpeg -re -i - -codec copy -f flv rtmp: // ARNESUSER:ARNESPASS @ prenosi.arnes.si / PRENOSVŽIVOIDENT / arnes & --------- 8 < -------- / etc / rc.local--------- 8 < -------- sudo usermod -a -G dialout pi sudo raspi-config raspivid -o - -t 0 -a 12 -a "Civ 1 %T %d.%m.%Y" --mode 4 -fps 25 -f | ffmpeg -re -i - -codec copy -f flv rtmp://ARNESUSER:ARNESPASS@prenosi.arnes.si/PRENOSVŽIVOIDENT/arnes & ---------8<--------/etc/rc.local---------8<-------- sudo usermod -a -G dialout pi sudo raspi-config

… IO…. disable console on uart

sudo nano / boot / config.txt sudo nano /boot/config.txt

check to have …….. enable_uart = 1

wget pavlin.si / krozek / sw / civ sudo mv civ / bin sudo chmod +x / bin / civ sudo apt-get install bc wget pavlin.si / krozek / sw / report.sh / ~ wget pavlin.si / krozek / sw / vhod.sh / ~ chmod +x report.sh chmod +x vhod.sh crontab -e wget pavlin.si/krozek/sw/civ sudo mv civ /bin sudo chmod +x /bin/civ sudo apt-get install bc wget pavlin.si/krozek/sw/report.sh /~ wget pavlin.si/krozek/sw/vhod.sh /~ chmod +x report.sh chmod +x vhod.sh crontab -e

confirm “nano”

add (every 2 minutes weather report, 10 minutes after 1AM a “preventive reboot”)……………

*/ 2 * * * * / home / pi / report.sh 10 1 * * * sudo / sbin / shutdown -r + 5 */2 * * * * /home/pi/report.sh 10 1 * * * sudo /sbin/shutdown -r +5

Install screen (GPIO for the entrance optical sensor operates from script running in screen shell):

sudo apt-get install screen sudo apt-get install screen

install gpio application

sudo apt-get install git-core git clone git: // git.drogon.net / wiringPi cd ~ / wiringPi git pull origin . / build sudo apt-get install git-core git clone git://git.drogon.net/wiringPi cd ~/wiringPi git pull origin ./build

……….check….>>>

gpio -v sudo apt-get install gpio gpio -v sudo apt-get install gpio

add in /etc/rc.local

———8<——–/etc/rc.local———8<——–

…

…

…

#start entrance detector script in detached screen session named 'vhod' su - pi -c "screen -dm -S vhod /home/pi/vhod.sh" #start entrance detector script in detached screen session named 'vhod' su - pi -c "screen -dm -S vhod /home/pi/vhod.sh"

…

———8<——–/etc/rc.local———8<——–

that’s about all. The application for reading the RH/T/p sensor is written in C using NetBeans. The instructions how to install netbeans remote debugging for R.Pi are here.

The complete source code for “civ” is at very early phase.

Placing the nesting box in the wild

The nesting box “Civ 2” was placed in the walnut tree, away from the houses at the edge of the vineyard.

And the final result…

Video moments from first month.

Video of both parents breeding

Some interesting findings (entrance crossing rate):

Please send email for complete data records.