Creation 2014-06-30 : System description
For those of you who understand French, "PAPA" ("Daddy") stands for "Portier Anti Prédateurs Automatique".
In other words, "let your hens sleep quietly, Daddy is watchful"
We have just adopted 3 nice hens which will spent some time in a fence in our garden. We've bought them a nice henhouse to protect them from bad weather. However, even if they are hidden in their house, predators are never far. Foxes, Rats or Martens are their biggest enemies.
A conscientious master would close their door every evening and open it at dawn but...
I suggest to develop a system which will do this for me, this could be a funny project I think!
Let's set down the first requirements :
- Able to open henhouse door at dawn and close it at twilight
- Opening/Closing driven by ambient luminosity or at fixed hours
- Lock the door when closed
- 100% autonomous in energy Hens wouldn't understand mains failure or dead battery...
- Waterproof design
- Fully configurable motor drive to support most mechanical configurations.
I have in mind a photovoltaic supplied system aided with a rechargeable lithium battery. A great effort on current consumption is essential of course. Main door will be pulled by a sailwinch servomotor (servos with up to 2160° of revolution). A smallest one will act as a lock even when unpowered. It is impossible to rely on the main servo continuously powered for this role. A RTC and a LDR will be embedded too. The configuration is performed through a classical LCD. I will use a capacitive rotor + button to allow for easy selection and waterproof design.
Interested in this project ? Just keep in touch, more news soon !
Update 2014-07-02 : Functional Architecture Added
Update 2014-07-11 : Schematics completed !
I've just attained a big step in the project: the schematics is done! It's not a huge project, all functional blocks stay on 2 pages but they are quite crowded though.
I'm still surprised on how the microcontroller is wired. All its 44 pins are used! :-/ I expect some layout issues, it should be a hard job to fit all on a 2-sided board...
1st Page :
On the first page, you will notice the "power" functions, starting with the photovoltaic cell dc dc converter (top left). It uses a MPPT algorithm which allows to pull the maximum available power from the cell even when ambient luminosity is changing.
Just below is the shunt lithium battery charger which takes the 5Vdc to charge a single cell AA-format. The big advantage of "shunt" chargers is that they have a variable charge current depending on how much power is available at the input. The more the sun shines, the quicker the battery recharges! This block also integrates a low-voltage protection to avoid pulling energy to a discharged cell (mandatory for battery life expectancy).
Most of parts are powered directly with this battery voltage comprised between 3.2 and 4.2V. However, power functions needed a regulated 5V, that's what does the latest block on the left. This converter can, of course, be disabled to reduce battery drain.
On the right, you will find input/output stages. The top ones are servo driving outputs with current measurement. This will allow blocked motors monitoring.
On bottom right are 3 pairs of switch inputs/LED outputs. They will be used to lit some parts of the henhouse when cover is opened (useful to take eggs in winter evenings).
2nd Page :
The biggest block contains the microcontroller, an ATmega164PA in 44 leads package. I chose to use a crystal to keep accuracy in servo driving signals (which are pulse length modulated)
on the bottom left is a small block: this is the capacitive sensing keys interface. Simple isn't it ?
Just on the right of this small block is a header for ribbon cable. This will be tied to LCD and capacitive keys which are deported on the enclosure's lid.
On top right stands an integrated crystal RTC. It will wake the system up every minute to keep current consumption as low as possible. The time is maintained during around 1 week even if the battery is low thanks to a 0.22F capacitor.
The last block is the light measurement photo cell. I first wanted to use a LDR but I discovered they are not distributed any more by Farnell and Co. They all are non-RoHS parts, I guess this is the reason... The photo detector is a kind of diode sinking a current directly related to the luminous flux received. The problem is that luminous intensity varies from several decades between sunlight and night. I added a kind of 2 step AGC (Adjustable Gain Control) to extand a bit the measuring range.
That's the first draw, just finished. I already have some details to correct (I want to add two leds), but that's enough for the moment.
Feel free to comment this schematics!
Update 2014-07-24 : LayoutS completed !
After two more weeks of evening work, I've completed mechanical integration and layout(s).
The project is designed to fit in a Hammond - 1554F2GYCL enclosure which is a bit thick but offer IP54 protection. Thanks to its clear lid, the LCD won't need any machining, you'll only need a few drills for LED light pipes.
Thanks to capacitive sensing, the user interface will simply be glued on the back of the lid, the sensing will operate through the 3mm thick polycarbonate. In this case, capacitive sensing is perfect for waterproofness !
The main board embedds all SMD parts. I used 1206 passive components and tried to avoid fine pitchs to allow for hand soldering. The placement is crowded as I expected, but all fits on a 2 layer board. The bottom layer has the less nets as possible to allow for a big plain ground plane, always better for EMC considerations.
The LCD and the capacitive wheel will not be soldered on the board, they are connected with a flat ribbon cable.
All external connections are tied on screw headers and will all go out from the enclosure through a single hole.
Update 2015-12-14 : Prototype Assembled
Hi All! It's been a long time since last update, I've had al ot of personnal projects to achieve before going on Papa's development.
I have completed board assembly. The MPPT for solar panel works great and correctly charges the 1-cell Lithium battery.
I've started software development. Capacitive sensing begins to work but I'm not completely satisfied with sensitivity, I guess there could be some capacitance perturbation in the 12-wire flat cable I used. I'll have to do some measurements to check this point.
I've had a new application idea for this project. We adopted a big rabbit which must be fed twice per day. I could use PAPA's servo outputs to design an automatic rabbit food feeder... More information soon! :-)