auto-feed

Do you have a question on how to do something.
Ask in here.

Posts: 42
Joined: Thu Jul 21, 2011 6:09 pm
PostPosted: Wed Aug 03, 2011 2:26 pm
Hello, i just receive my new toy and already been playing with RAgen, with the help of Roberto i was able to setup wifi ;) now the big step the coding :roll: i read up on regarding the code but i think still need lots of help and input. i would like to setup Reef Angel something like this.

this feature will be use while I'm away for vacation :)

1. shut off wave maker pump and return pump
2. delay before feeding 10min. (i have an overflow box that suck fish food)
3. feed one per day at 6pm

i was hoping this feature will be a users choice, only when needed(like a on and off) ;)

thanks in adance

Note: RAgen and Reef Angel team support for me life is easier :)
Last edited by acabano on Wed Aug 03, 2011 4:40 pm, edited 1 time in total.
Image

Posts: 12445
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Aug 03, 2011 4:01 pm
If I understood correctly, you would like to shut off return and powerheads at 5:50pm then at 6pm, feed and the wait for how long?
How do you plan on feeding? Do you have a feeder? How does it work?
Curt, what memory setting do you think is best to use as a trigger for enabling/disabling this function?
My idea was to use one of the memory settings or if not a good idea, then use one of the unallocated spaces. Is it possible to assign values to unallocated spaces through built-in webserver??
This way, we could use the Client or webserver to enable/disable the feature.
Roberto.

Posts: 42
Joined: Thu Jul 21, 2011 6:09 pm
PostPosted: Wed Aug 03, 2011 4:37 pm
10 min would be sufficient enough for me.
I have a battery operated automatic fish food feeder, but i was looking for a feeder that runs on trigger only or both.

Thanks.
Image

Posts: 12445
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Aug 03, 2011 5:36 pm
Ok, so stop pumps at 5:50 and back on at 6?
Roberto.
User avatar
Posts: 2753
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Wed Aug 03, 2011 7:40 pm
The webserver/client have access to all the available memory in the internal eeprom. So there is no limitation, you just have to input the memory address you want to use and tell it if you want 2 bytes (ints) or 1 byte of storage space.

Here's my thoughts on how this could be done.
  • Store the On time (hour & minute)
  • Store the delay time (minutes)
  • Store the feeder run time (minutes)
  • Store the "enabling" of the mode in memory (0 false, 1 true, or something like this)
Then set the values via the client or webserver for the appropriate memory locations.
Have a check inside the PDE if the auto feed mode is enabled.
If it is enabled, then we check the current time minus the delay time (to allow the water level to drop down appropriately) versus the on time and shutoff the pumps if it's time to shut them off.
Then check if it's the on time and if it is the on time, turn on the auto-feeder port or start the feeding mode and run it for the feeder run time.
Once the feeder run time is expired, then we shutoff the feeder port and turn back on the pumps.
This scenario runs all the time until the mode is disabled by turning off the feature in the memory.

How does that sound?

curt

Posts: 42
Joined: Thu Jul 21, 2011 6:09 pm
PostPosted: Wed Aug 03, 2011 11:06 pm
1. stop pumps at 5:50
2. trigger feeder at 6 (if possible)
3. start pump at 6:10

thanks.
Image

Posts: 42
Joined: Thu Jul 21, 2011 6:09 pm
PostPosted: Fri Aug 05, 2011 2:21 pm
Curt, how do you implement this into a code. I have not done any coding my self, but maybe if you can gave me something to start with, maybe a step by step....

Thanks,
Image

Posts: 12445
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Aug 05, 2011 3:14 pm
I'll try to come up with something today.
Roberto.
User avatar
Posts: 2753
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Fri Aug 05, 2011 6:22 pm
rimai wrote:I'll try to come up with something today.

I can get something working Roberto. I already had some pseudo code written down that would work. It would be handled through the client suite first to enable....wouldn't have a menu entry yet though. but it would be a start.

curt
User avatar
Posts: 2753
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Fri Aug 05, 2011 8:39 pm
I've got some code for you to try out. This will work for you as long as you do not have the Wavemaker port running on the toggle. If you did, you may encounter a problem. There is probably a better way to handle this, BUT this is a good start and should handle most scenarios.

It's designed to work like I previously mentioned. You will have to specify the ports you want to turn off. It also assumes that your autofeeder is plugged into a port that just needs power to start it up.

The example I'm giving will turn off Port8 and Port4 the specified amount of time (PortDelay) before the Start time. Then it will run the autofeeder for the specified amount of time (FeedDelay) then shut off the feeder port (Port5) and turn back on Port8 and Port4. You can change the ports if you like, but I just picked a couple for the example.

Also, my example uses memory locations as follows:
700 - Enable / Disable the "vacation mode", 1 enables, all other values disable
701 - Start Hour for vacation feeding mode (in 24 hr format)
702 - Start Minute for vacation feeding mode
703 - Pump Delay in minutes (amount of time before vacation feeding mode that the pumps should be shutoff)
704 - Feed Delay in minutes (amount of time that the autofeeder will run for before getting shutoff)

You will need to set those values with the client or via the serial monitor or web interface get it to work properly. NOTE: You will probably need help setting this. If so, just ask.

Here's the complete code based:
Code: Select all
// RAMenus.pde
//
// This version designed for v0.8.5 Beta 10 and later

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

// Vacation autofeeder memory locations
#define Vacation         700
#define VacationEnable      Vacation
#define VacationStartHr      Vacation+1
#define VacationStartMin   Vacation+2
#define VacationPumpDelay   Vacation+3
#define VacationFeedDelay   Vacation+4


void setup()
{
    ReefAngel.Init();  //Initialize controller

    // Ports that are always on
    ReefAngel.Relay.On(Port8);
   ReefAngel.Relay.On(Port4);
}

void loop()
{
    ReefAngel.ShowInterface();

   if ( InternalMemory.read(VacationEnable) == 1 )
   {
      // Vacation mode is enabled
      /*
      Check if the current time is equal to the start time minus the pump delay.  The pump delay is the amount
      of time the pumps should be off prior to starting the feeding mode
      */
      if ( NumMins(hour(), minute()) == (NumMins(InternalMemory.read(VacationStartHr), InternalMemory.read(VacationStartMin))
                              - InternalMemory.read(VacationPumpDelay)) )
      {
         // Let's shutoff the ports
         ReefAngel.Relay.Off(Port8);      // return pump off
         ReefAngel.Relay.Off(Port4);      // wavemaker off
      }

      /*
      Check if the current time is equal to the start time, if it is, we need to start the feeding mode
      */
      if ( NumMins(hour(), minute()) == NumMins(InternalMemory.read(VacationStartHr), InternalMemory.read(VacationStartMin)) )
      {
         // turn on the auto feed ports
         ReefAngel.Relay.On(Port5);      // auto feeder port on
      }

      /*
      Check if the current time is equal to the feeding delay/run time, if it is we need to stop the
      auto feeder and then turn back on the pumps
      */
      if ( NumMins(hour(), minute()) == (NumMins(InternalMemory.read(VacationStartHr), InternalMemory.read(VacationStartMin))
                              + InternalMemory.read(VacationFeedDelay)) )
      {
         ReefAngel.Relay.Off(Port5);      // auto feeder port off
         ReefAngel.Relay.On(Port8);      // return pump on
         ReefAngel.Relay.On(Port4);      // wavemaker on
      }
   }
}


I tested it out on my end exactly like this and it works as designed. If modifications are needed, just ask and we can figure something out.

curt
Next

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 2 guests

cron