chicken coop door upgrade
Some Moons ago, I constructed a GNU Linux controlled chicken coop door that worked fairly well. Eventually, the coop was increased in size, and the small door was replaced by a door large enough for a full grown turkey. When the door size was increased, the motor was replaced with a much more powerful linear actuator. Through all of this, there were some problems with the configuration that caused much consternation:
- There was no way to manually open/close the door when the controller was off the network
- The BeagleBone Black controlling the door motor was continuously falling off of the network
Heading out to the shed on dark and stormy nights, to debug the damn chicken coop door, got old real quick
- A separate power supply for both the door and the controller felt inelegant
- There were too many different pieces of software involved:
- a cron task to set
- the motor controller
- a separate web server to provide an API to the controller
Fortunately, most of what was needed to upgrade the door controller was sitting in a spare parts drawer. Specifically, a LinkIt Smart 7688 microcomputer, a large blue button, an automotive 12 volt port, and a 5 volt USB adapter for a 12 volt automotive port.
Unlike the BeagleBone, the LinkIt Smart has both built-in wifi, and a plug for attaching an actual antenna; which will greatly increase the network connectivity. The blue button could be an open/close toggle, and adding the 12 volt port and the adapter will reduce the setup to just 1 power supply.
at daemon wasn't available in the OpenWRT software repository, and after my buddy was telling me about working with the Go programming language,
I thought the coop upgrade was a perfect opportunity to get aquainted with the Go language.
Now that a plan was forming, it was time to update some hardware…
Case sans BeagleBone
Add LinkItThe LinkIt is on a breadboard, glued to a piece of cardboard, glued to the base. Probably not the best insulator, but it works. :)
Add a 12V power portDamn, that Gorilla Glue is dreamy
Determine which pin to use for the toggle1. I went with GPIO 1
That "rustic" lookThe case and button were attached to a weathered piece of wood. Now iit is time to mount the computer in the coop, and connect the motor and power.
Strippin wireWhile setting everything up in the coop, I didn't notice that I wasn't alone until a *brok brok* started yelling at me.
Oh hey, time to collect some breakfast
The coop door code is available on gitlab.
At first, I was a bit concerned about being able to cross-compile on x86_64 to the MIPS platform, but woowee, the go compiler can cross-compile for a variety of architectures and operating systems.
Go's net/http package makes it quite easy to write a minimal webserver/API. Now that I have the basics down, I will certainly be using Go for some future API projects; after all, there is one more LinkIt Smart in the parts drawer that needs a project.