Arduino Chicken Coop Controller

Google+ Pinterest LinkedIn Tumblr +
I’ve included the code which hopefully learn with the next notes ought to make it self explanatory.

I used the most recent Arduino IDE 1.zero which I need to say has been sensible particularly as now you can programme utilizing the ISP programmer and never have to fret about USB dongles or circuitry.  One factor I’d say you continue to must burn the boot loader onto your clean ATmega328 chip in any other case debugging turns into a little bit of a problem because the Arduino setting hasn’t been arrange correctly!!!

The code I’ve compiled is eight,346 bytes in dimension so you should use the ATmega168 chip you probably have a couple of kicking round.

Libraries:

Arduino.h – the usual and really giant library
DS1302.h – Real time clock library
LCD4Bit_mod.h – Library provided to help the LCD/Keyboard – similar to the Standard library
OneWire.h – Provides communication to the temperature probe

Pinout Allocation and Global Variables:

This is the place it’s essential set your personal sundown and dawn relying in your location.  We have summer season financial savings right here within the UK however I made a decision to maintain my system on GMT which suggests once I have a look at the clock in the summertime saving time interval it’s an hour behind so the sundown and dawn instances must be set accordingly.

Setup()

  1. Sets the pinouts for the motor
  2. Sets the show again mild which is switched off on reset.  
  3. The present MotorState is about to STOP
  4. The high line of the show is initialised with the standing headings.  
  5. At this level we verify the temperature to initialise the min/min max settings and show it. 

In the code you’ll discover a commented out routine ‘set_time()’ to set the RTC.  This must be uncommented for the primary time programming so the clock will be set.  Comment it out and reprogramme the ATmega328 once more this manner if the board is reset or additional adjustments to the code are made the RTC all the time has the right time.

You must experiment  on setting the RTC in sync with the laptop computer time.  I found on a Mac setting it’s essential permit 40 seconds for compiling and importing to ensure the instances the place precisely synced.
 

Loop()

  1. Print the present time
  2. Pause for zero.5 second so the show will be learn.
  3. Print the bedtime which is in whole minutes with the ‘^’ image in entrance of it.
  4. Print the minimal temperature with the ‘v’ image in entrance of it.
  5. Pause for zero.5 second so the show will be learn.
  6. Print the wake time which is in whole minutes with the ‘v’ image in entrance of it.
  7. Print the utmost temperature with the ‘^’ image in entrance of it.
  8. Pause for zero.5 second so the show will be learn.
  9. Print the present time
  10. Check the door activation button (show on/off, shut door or open door manually)
  11. Change the Motor State in response to activation button
  12. Check to see whether it is wake time if that’s the case set Motor State to DoorUp
  13. Check to see whether it is mattress time if that’s the case set Motor State to DoorDown
  14. While the State Motor is not ‘Stop’ name door_change to both shut the door or open it and show standing on display screen

I’d counsel you familiarise your self with the code and hopefully you may perceive it sufficient to make your personal modifications, i.e. no temp probe however a LDR as an alternative.

As you may see from the code I’ve created a state motor variable which ensures actions are accomplished earlier than the primary loop code goes again on itself.

Read more

Share.

Leave a Reply

%d bloggers like this: