how to override the lights for feeding time

Do you have a question on how to do something.
Ask in here.
Post Reply
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

how to override the lights for feeding time

Post by bigHUN »

several times got home late, the lights got off by the timer but the fish still need get food.
my best guess there are two ways to go:
1. to get a controllable timer, what is for now can't fit into budget...
2. somehow override the timer during feeding time, that means even after ie 8pm turn back the lights port 3-4 (or one light port #4) ON.
how this could be done?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: how to override the lights for feeding time

Post by rimai »

Try this:
You need to replace your StandardLights() function with the code below:

Code: Select all

  if (ReefAngel.DisplayedMenu==FEEDING_MODE) // Check for Feeding Mode
  {
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.Write();
  }
  else
  {
    ReefAngel.StandardLights(Port3);
  }
Change the Port3 to whatever Port you are using.
Roberto.
Sebyte

Re: how to override the lights for feeding time

Post by Sebyte »

Roberto

If you are using LEDs, and not to startle the fish by turning the lights on from dark, could you include a PWM slope function to bring the lights up gradually over say 5 mins, and ramp down at the end of the feeding period, again over 5 - 10 mins?

The only problem I can see for me is that I am using PWMParabola() and when under normal situation I go into feeding mode the LEDs might be change by the above routine.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: how to override the lights for feeding time

Post by rimai »

Pretty sure we can come up with something.
All we need to do is check for standardlights function.
If it is active, no need to override anything.
If the standardlights is inactive, we override the port and implement special parabola for 15min.
The standard parabola function would look choppy due to it being changed on minute basis and not seconds.
If you think you have space in your board, it is definitely doable. Open up a new thread and we can work on it :)
Roberto.
Sebyte

Re: how to override the lights for feeding time

Post by Sebyte »

Unfortunatly don't have the space, but it looks like an interesting feature to provide. I am not a fan of turning on lights during a period of darkness. A slow wake up for the fish would work, and stimulate feeding. You may need an extended (secondary) feeding mode, with a longer period of being on compared to the standard mode.

If I had the space I would give it a try, maybe I need the RA+ :D
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: how to override the lights for feeding time

Post by bigHUN »

bigHUN wrote:...........................................................
1. to get a controllable timer, what is for now can't fit into budget...
..............................
oh, sorry, just noticed my typo: I've meant "controllable feeder"
>>> I haven't found any yet what I could feed 2-3 times but controllable with RA or any ...like 12V
but I will try your sample definitelly
Sebyte

Re: how to override the lights for feeding time

Post by Sebyte »

It should be possible to rewire any auto feeder with batteries to be fed from a wall-wart of the same voltage. Then if the wall-wart were to be plugged into a spare port you could control the on/off periods.

I do a similar thing with my Kalkwasser reactor. The difference being that I did not have a spare relay port. So I built a small single relay box and control it from one of the ATO ports.

The circuit is small 10v dc relay which switches the mains voltage to a surface mounted receptacle set into the lid of a plastic project box.

The coil of the relay connects to one of the ATO ports on the RA, and I use the following code to turn thr relay on.

Code: Select all

// Kalk Reactor mixing 6 times per day - 01:30 to 2:00, 05:30 to 06:00, 09:30 to 10:00, 
  // 13:30 to 14:00, 17:30 to 18:00, 21:30 to 2:00.

  if (hour() % 4 == 1 && minute()>30) 
  {
    pinMode(highATOPin,OUTPUT);
    digitalWrite(highATOPin,HIGH); // Turn on Solid State Relay
  }
  else
  {
    pinMode(highATOPin,OUTPUT);
    digitalWrite(highATOPin,LOW); // Turn off Solid State Relay
  } 
This concept can be used for to provide an additional port if you need one and don't yet need to expand by another relay box.

If you are interested I will draw up a diagram for the circuit. As for the feeder, take it to pieces and solder leads direct to the motor bypassing any internal timing circuit.

I think I have a spare auto feeder somewhere, when I find it I will build this set-up as a test. ;)
rufessor
Posts: 291
Joined: Tue Oct 25, 2011 7:39 am

Re: how to override the lights for feeding time

Post by rufessor »

In terms of writing some code to implement a gradual increase in lighting. Unless your really at ZERO free space on the controller it should be pretty compact.

I have much more elaborate versions of this running in something else but know this will work with some possible issues listed below

Something like this as a basic idea to Trigger by toggle of feed mode
// unsure if its easy to tell if lights are OFF in your set up.. but assuming it is

long timerstart;
long elapsed;
float fraction;
if ((feedmode==off) && (lights are off){
timerstart=now()
}
else if ((feedmode==on) && (lights are off)){
elapsed=(now()-timerstart);
fraction=(float)(elapsed/300);
if (fraction>1) fraction=1;

for (a=0;a<6;a++){
ChannelValue[a]=(byte)(125*fraction);//this hard codes lights to a max output of about 50% in 5 minutes
}

Then when you reset feedmode to off or false, it would just go dark. Getting it to ramp back would require a bit more thought as you would need to track a variable state switch outside of feed mode but also not hard.
Post Reply