Automated Chicken Door code
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
src
.gitignore
README.md
deploy

README.md

Raspberry Pi Automatic Chicken Door controller software

Features

  • hardware interleave gravity lock mechanism
  • instant-read photoresistor poll door actuation trigger
  • photoresistor signal analog to digital conversion
  • worm gear 12V DC motor controlled via L9110 motor driver chip
  • dual hall-effect magnetic door position sensors
  • fallback door status mitigating magnetic sensor failure
  • night-vision wide-angle camera with motion-triggered video capture
  • C + bash + python polyglot control code with standardized output convention
  • offline operation with 2.4Ghz wifi for monitoring and maintenance

This repository

This code is deployed onto the chicken coop raspberry pi computer.

Edit code, commit/push, then deploy with ./deploy. The deploy script also documents summaries, source, and destination for all code deployed to the pi.

Use tree Chicken bin on the Pi to see all deployed code.

Hardware

Raspberry Pi 3 Model B v1.2. Bought off Amazon.com.

  • 1.2GHz 64-bit quad-core ARMv8 CPU
  • 1 GB RAM
  • 802.11n Wireless LAN, 10/100Mbps Lan Speed
  • Bluetooth 4.1, Bluetooth Low Energy
  • 4 USB ports, 40 GPIO pins, Full HDMI port, Combined 3.5mm audio jack and composite video
  • Camera interface (CSI), Display interface (DSI), Micro SD card slot (now push-pull rather than push-push), VideoCore IV 3D graphics core
  • 32 GB SD card

Operating system

The operating system (raspbian jesse with PIXEL desktop, v2017-04-10) was written to a 32GB SD card using Etcher following this install guide. Something doesn't seem to work with 64GB SD cards... I bricked one before I got it to work on a 32GB SD card.

gpio

The pre-installed gpio program can read and manipulate general purpose IO pins.

NOTE: sudo is not required to run gpio (Adeept_Starter_Kit_for_RPi_User_Manual.pdf is out of date in this regard).

pi@raspberrypi:~ $ gpio -v
gpio version: 2.44
Copyright (c) 2012-2017 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Embest
  * Device tree is enabled.
  *--> Raspberry Pi 3 Model B Rev 1.2
  * This Raspberry Pi supports user-level GPIO access.

Watch GPIO pin status, highlighting cumulative differences (this is an undocumented feature of watch). 1-second resolution.

watch -dc -n 1 gpio readall

NOTE: this didn't work for checking mag (hall effect) sensors, I had to use Python code for that. See ./src/scripts/hall-effect-sensor.py . Well, it sorta worked, just not reliably. During testing I noticed the mag sensor values reading incorrect values frequently.

Other dependencies

Build-time dependencies:

  • git v2.x
  • GNU system / POSIX
  • rsync
  • ssh
  • FIXME: complete this list (maybe containerize)

Runtime dependencies:

  • Python v2.7.x
  • Imgur client library: sudo pip install imgurpython
  • FIXME: complete this list (maybe containerize)

Forums

EE basics

  • Ohm's law calculator
  • anodes and cathodes
    • Current enters a device via anode. Mnemonic: ACID - anode current into device.
    • Current leaves a device via cathode. Mnemonic: CCD - cathode current departs.

More Links

Secrets formats

chicken-secrets.json

{
  "imgur": {
    "album_id": "xxx",
    "client_id": "yyy",
    "client_secret": "zzz",
    "refresh_token": "mmm"
  },
  "slack": {
    "chickenbotWebhookUrl": "https://hooks.slack.com/services/nnn/rrr/sss" 
  }
}

client-secrets.json

See https://developers.google.com/youtube/v3/guides/uploading_a_video.

youtube-upload.py-oauth2.json

See https://developers.google.com/youtube/v3/guides/uploading_a_video.