Automatic Chicken Door Opener With PICAXE

by Charlie Godfrey in Living > Pets

13239 Views, 115 Favorites, 0 Comments

Automatic Chicken Door Opener With PICAXE

551474dd2f7cc6bbf9000086.jpeg

Using the superb PICAXE 08M2 chip I put together an automatic coop door opener (named the Cluck-O-Matic) so I did not have to get up so early in the morning to let the chickens out from their coop. This cheap chicken door opener only opens the door of their coop and the control electronics are kept in my garden shed but could just as easily be mounted on or inside the coop itself. An alarm clock is used to trigger the door opener so it is an inexpensive device that can help keep your chickens safe.

Things needed:
PICAXE 08M2 Chip (£1.80 from the PICAXE site)
08M2 Prototype board AXE021 (£2.39 from the PICAXE site)
Download cable AXE027 (£11.99 from the PICAXE site)

Soldering Iron

5 volt supply (Could be USB supply, solar panel, batteries or mains transformer)

Cheap electrical alarm clock (I purchased mine from a pound shop)

RC Servo (Can be purchased off Ebay. I would choose a larger one because it must be able to apply enough force to operate the locking system of the door.)

A lock or bolt for your chicken door that could be modified so it can be operated by a servo.

A container for the control electronics (Would have to be weather proof if kept outside, I used a seal-able lunchbox)

Assembling the PICAXE Circuit

Thumbnail.jpg
5volt transformer.JPG

When you get your PICAXE proto-board kit the first step is to solder it together. This is fairly straightforward if you know how to solder. PICAXE revolution education provides a PDF in which it describes where all the components go. I have attached it onto this Instructable if that makes it easier. However if you used a 5 volt transformer like I did, then you will need to cut off the plug and strip the wires before soldering them into the PICAXE board.

Finally plug in your 08M2 IC and then install the PICAXE editor 6 and follow the instructions on how to install the appropriate drivers for your USB download cable. Here is the link for PICAXE editor software: http://www.picaxe.com/Software/PICAXE/PICAXE-Edito.. And here is the link for the drivers and information for the cable: http://www.picaxe.com/Hardware/Cables/PICAXE-USB-D...

The next stage is to attach the servo and alarm clock.

Downloads

Finishing Off the Electronics

Alarm clock.JPG
proto-board_drawing.png
futabaconnector.png

This handy proto-board produced by PICAXE revolution education will be the bare bones of our door opener. However to actually make this useful we must add the input and output devices for the door opener.

First open the back of your alarm clock to reveal the innards of the device, usually this is a case of undoing several screws and opening pesky clips in the casing. You should be able to see a brass disk behind the noise holes at the back of the alarm clock. This is the piezo transducer which makes the noise. We are going to harness the signal that the timing chip in the alarm clock gives to the piezo to trigger the PICAXE chip. First while keeping the red and black wire attached to the piezo (the audible alarm is useful for testing and can always be removed later in you desire), solder on your own red and black wires from the connection on the piezo (about 150mm long).

Then file two small grooves in the casing to allow your wires to come out of the case and allowing the case to screw shut again.

Now you will have to attach the wires from the alarm clock and the servo as shown in the diagram above.

Programming and Testing

Screen shot.png

Below I have included the code which will hopefully allow the hardware you have just created to make it work. Of course there are many improvements that can be made to the code but this seems to work. To program the chip you will have to ensure that the board is plugged into a supply and that the download cable is also plugged in. The 3 pin download header on the board also needs to have the black connector in download mode. Copy and paste the code into the code editor and change the chip type to PICAXE 08M2. Then press the download button on the toolbar.

'Chicken door opener

#PICAXE 08M2 ' sets the chip type to picaxe 08m2 only

Chickentimer:

readadc10 c.4, w1 'read the voltage across the piezo tranducer

If w1 > 50 then goto open ' If this value is bigger than 50 the alarm clock must be going off so the program will goto a subroutine which will open the door and loop back around.

goto Chickentimer

open:

servo 1,250 ' This line is the line that controls the position of the servo to open the door, you will have to fiddle around with the positioning value (75 - 250) to allow the door to open with your particular mechanism.

Wait 50 ' pauses 50 seconds to let the servo finish positioning and to ensure that it has fully opened while preventing repeat openings until the alarm has finished beeping.

servo 1,off 'switches off the servo to save power

goto Chickentimer 'Loop back around

After you have programmed the device you will want to test it by connecting the power to the circuit and setting the alarm 1 minute in the future. If you move the servo to the middle of it's travel you should see the servo move to one end of it's travel when the alarm goes off.

Installing

Locking mechanism.JPG

This will all depend on the type of mechanism that you had in mind and this will of course depend upon your chicken coop. I took a picture of the locking mechanism but I am sure that you can think of a much more ingenious method. If you want to keep the control electronics away from the coop you will have to make some extension wires.

Happy chicken keeping!