auto-feed

Do you have a question on how to do something.
Ask in here.
Post Reply
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

auto-feed

Post by acabano »

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
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: auto-feed

Post by rimai »

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.
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

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
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: auto-feed

Post by rimai »

Ok, so stop pumps at 5:50 and back on at 6?
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

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
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

1. stop pumps at 5:50
2. trigger feeder at 6 (if possible)
3. start pump at 6:10

thanks.
Image
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

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
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: auto-feed

Post by rimai »

I'll try to come up with something today.
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

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
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

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
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

Thanks guys for taking time on this.
Curt, i don't use a wavemaker so I'm OK, how do i setup with the use of serial monitor, looks like i have to used a command here.
also i am looking at the pde code, do i have to add a value or is there going to be a user menu that can be edited, do i have to upload auto_feed.pde before vacation?..totally nob on coding :)


Thanks.
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

acabano wrote:Thanks guys for taking time on this.
Curt, i don't use a wavemaker so I'm OK, how do i setup with the use of serial monitor, looks like i have to used a command here.
also i am looking at the pde code, do i have to add a value or is there going to be a user menu that can be edited, do i have to upload auto_feed.pde before vacation?..totally nob on coding :)


Thanks.
What I would suggest is that you take the pde I created and then merge your existing pde into it. This way you have the "vacation mode" ready to go whenever you wanted. In fact, you may even decide you want it to always be enabled so you never have to worry about feeding (or rushing home to feed or whatever).

Right now, there is no menu option to enable this mode for you. It would have to be enabled via the wifi or serial interface and enabled manually UNLESS you set the memory values via a pde similar to the set internal memory pde.

Currently, the client suite will not enable you to modify memory locations outside of the standard ones very easily. I've asked Dave to add in an"on the fly" type of reading/writing memory locations to make this simpler. So for now, it must be done manually.

Do you have a WIFI module?
This will simplify things and make it easier to update the values from memory. Plus, it will make enabling the vacation mode very simple. If not, we will just have to program them and then re-upload the controller code.

If you don't have WIFI, then we will want to set the memory values using arduino.

Let me know the answers to this. Also, if you could post your PDE file (attach it to a post) then we can merge the vacation mode code into your pde file so it would always be there for you whenever you needed (long weekends, vacations, late night at the office, etc).

curt
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

Hi Curt, i do have a wifi attachment. below is my pde file.

// Autogenerated file by RAGen (v1.0.4.92), (08/05/2011 19:08)
// RA_080511_1908.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File:
#define ATOSetup
#define MetalHalideSetup
#define DirectTempSensor
#define wifi
#define StandardLightSetup
*/


#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>


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

ReefAngel.FeedingModePorts = B11000000;
ReefAngel.WaterChangePorts = B11000000;
ReefAngel.OverheatShutoffPorts = B00000000;
ReefAngel.LightsOnPorts = B00001011;

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

void loop()
{
ReefAngel.ShowInterface();

// Specific functions
//ReefAngel.StandardLights(Port1);
ReefAngel.MHLights(Port2);
ReefAngel.StandardHeater(Port3);
ReefAngel.StandardLights(Port4);
ReefAngel.StandardFan(Port5);
ReefAngel.StandardATO(Port6);

// LED Ramp
// Have PWM on from 1pm to 11pm, with gradual 60 minute ramp up and down starting at the given times
// From 1pm to 2pm, actinic and 2pm to 3pm daylightthe PWM will slowly ramp from 0% to 80%
// From 9pm to 10pm, daylight and 10pm to 11pm actinic the PWM will slowly ramp from 80% to 0%
ReefAngel.PWM.SetActinic(PWMSlope(13,0,23,0,0,80,60,ReefAngel.PWM.GetActinicValue()));
ReefAngel.PWM.SetDaylight(PWMSlope(14,0,22,0,0,80,60,ReefAngel.PWM.GetDaylightValue()));

}



Thanks,
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

Cool. This will be simple to merge together. Once I get it merged, I'll post the PDE file for you and then the commands you will need to enter to set the values in the memory (and how to change them) plus how to enable and disable the vacation mode.

curt
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

thanks, can't wait to try it. :)
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

what ports do you want shutoff 10 minutes before?

what ports do you want turned on for the autofeeder?

curt
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

i want to shutoff Port 7 and 8 10 minutes before.
for autofeeder port 1.


Thanks
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

acabano wrote:i want to shutoff Port 7 and 8 10 minutes before.
for autofeeder port 1.
Thanks
Ok. Attached is the PDE file for you. I have it set to turn ports 7 & 8 off at the specified interval before starting the feeding mode. I also have port1 only turn on at the given feeding mode time then run for the specified amount of time and shutoff.

I would upload the code to the controller first before proceeding. It doesn't matter if you do or not, just makes things easier knowing that it's all ready to go.

Now, here comes the "fun stuff". We must add the values to memory so the controller can read them and use them.

Open up a web browser and type these in the URL / location box. I'm going to use my wifi module's IP address as an example (10.0.42.40). So where you see that IP address, you must replace it with your own IP address or else the command will not work.

Here's the commands you need to use to set the Start Hour and Minutes:

Code: Select all

// Set the start hour to 6 pm (18 hours)
http://10.0.42.40:2000/mb701,18
// Set the start minute to 0
http://10.0.42.40:2000/mb702,0
Here's the command to set the pump delay (minutes before the start time to shut off the pumps)

Code: Select all

// Set the delay to be 10 minutes before the start time
http://10.0.42.40:2000/mb703,10
Here's the command to set the run time for the auto feeder

Code: Select all

// Set the run time to be 10 minutes
http://10.0.42.40:2000/mb704,10
Lastly, here's the command you will use to enable/disable the auto feeding mode.

Code: Select all

// enable auto feed mode
http://10.0.42.40:2000/mb700,1
// disable auto feed mode
http://10.0.42.40:2000/mb700,0
Once you issue the first 4 commands, you won't have to use them again unless you need to change the values. The last 2 commands for enabling/disabling the auto feed mode are the ones you would use "often", aka whenever you want to turn it on or off. Now, there is no visual indicator on the display if you are in auto feed mode or not. This can be corrected if you want it to be. It will require the use of the Custom Main Screen to get things to work properly. Let me know if you would like this done as well. It won't take very long to get that working because I already did that in my testing.

curt
Attachments
autofeed.pde
auto feed mode
(3.42 KiB) Downloaded 477 times
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

Hi Curt, Can you please add a visual indicator, that way its easy for the user to check if the auto feed function is enabled. i will upload this pde later today and try it, thanks for the help.
Image
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

Hi Curt, it works like a charm :) exactly what i want... again thank you for your support.
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

That's great. I'm working on the visual indicator for you right now. I've got something created but haven't tested it. I was going to put a "V" to the left of the relay box to indicate it's in "vacation mode" or "A" for the "auto feed" mode. I'm thinking more of an "A" now that I think about it. I'll post once I get it tested and confirm. Also, you can change the letter to be whatever you want but I'd suggest just keeping it as 1 letter for simplicity.

curt
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

This should work for you. It shows the indicator to the left of the relay box.

curt
Attachments
autofeed.pde
(4.09 KiB) Downloaded 521 times
astralmind
Posts: 99
Joined: Fri Apr 01, 2011 10:53 am

Re: auto-feed

Post by astralmind »

that's pretty awesome, I was looking for something very similar to this. I'm leaving too early for work in the morning but would like to feed twice a day so this piece of code should come in handy soon enough.

On that very topic, any recommendations on "auto feeders" that actually do work ? I'm feeding NLS sinking pellets, 1mm. Now that the RA side of thing works I'm more concerned with the device dumping a whole bucket in my tank!
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

I modded my auto feeder, to trigger only when power is applied. so far it works but no guarantee...
Last edited by acabano on Fri Aug 12, 2011 10:58 am, edited 1 time in total.
Image
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

Curt, can you verify my pde if its correct, cuz i did not see the autofeed indicator. also i use simple menu for
space, is that affecting the code?


Thanks.
Attachments
Golden.pde
(5.42 KiB) Downloaded 476 times
Image
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: auto-feed

Post by acabano »

just found out i was using simple menu instead of custom menu... :)
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: auto-feed

Post by binder »

acabano wrote:just found out i was using simple menu instead of custom menu... :)
cool. Glad you got it figured out. :-)

curt
Post Reply