Eheim autofeeder

Request new hardware or ideas for the controller
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

Here's the function I just wrote up. My feeder is on order so I still have to modify it.

Code: Select all

void runFeeder() {
  static TimerClass afTimer;
  static time_t buttonPress;
  byte feederDelay=InternalMemory.read(Mem_B_FeederDelay);
    
  if(InternalMemory.read(Mem_B_AutoFeed)) {
    InternalMemory.write(Mem_B_AutoFeed,false);
    FeedingModeStart();
    afTimer.SetInterval(feederDelay*60);
    afTimer.Start();
  }
    
  if(afTimer.IsTriggered()) buttonPress=now();
  
  // Turn on feeder for 5 seconds.
  if (now()-buttonPress<5) 
    ReefAngel.Relay.On(Feeder);
  else
    ReefAngel.Relay.Off(Feeder);
}
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

If anyone sees any issues with that function as written, let me know :)
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Eheim autofeeder

Post by Piper »

Lee - Which method are you going to use to modify the feeder? There are a couple of different links at the beginning of this thread and I found another method somewhere else, I'll have to see if I can track down that link, that seemed a little easier for those of us that are not all that well versed in electronics like myself to follow.

I'd like to automate my feeder but I need the mod part to be *real* simple so I can follow it. And preferably with lots of pictures :)

~Charlie
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

I'm not concerned about batteries and don't want another power cord. I don't have an IO module so what I'm going to do is get the 5v dc micro relay from radio shack and connect it to one of those usb power jacks like you get with an iPhone. They are 5v also. They sell em at 7-11 now for a few bucks. I'm going to get a long enough usb cable and put a mono audio jack on it and put a mono port on the feeder. At least thats my plan. I figure this way I don't need any resistors capacitors or anything else...i hope :)
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Eheim autofeeder

Post by Piper »

Interesting. Can you post a couple of pics when you get done? I have the IO module and I was planning on using one of those ports to trigger the manual push button on the feeder. If I remember correctly I just need to tap into the button solder joints on the PCB. I need to go back and look closer at the directions I found for that to be sure though. There might be some other parts/pieces I need to get to make that work.

~Charlie
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

Im basically doing what Jon did without replacing the batteries you just need to connect the relay to the push button leads and the relay to your io module or ato port. All my ports are taken so ill drive the relay with the outlet power :)

I'll post pics of the build when i get everything together.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

Theres some good pics here of the process also.

http://wamas.org/forums/blog/13/entry-4 ... ontroller/

The circuit he uses though has a resistor and capacitor since the inferior apex controller only makes it easy to turn the port on for at least a minute I guess...

Since we have more fjne grained control i think i'll be fine with just the relay wired in. Anyone with electronics info that thinks Im going to kill something please let me know. :)
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: Eheim autofeeder

Post by jsclownfish »

Yep. BTW, I just used this bit of code to remotely trigger my feeder. It is really cool to send a quick signal to the feeder and then watch all the fish come up to feed on my webcam. ;)

Code: Select all

  if ( InternalMemory.read(VacationPulseFeed) == 1 ) // feeder trigger
	{
          Feed = 1;   // Turn on feeder and feedmode
          ReefAngel.Timer[FEEDING_TIMER].SetInterval(InternalMemory.read(FastFeed));  //shorter feed time for autofeeder			
          ReefAngel.FeedingModeStart();
          ReefAngel.Timer[FEEDING_TIMER].SetInterval(InternalMemory.FeedingTimer_read());   //reset normal feed time
          InternalMemory.write(VacationPulseFeed,0);          //reset pulse to 0 for a pulse effect
	} 
         else Feed = 0;
-Jon
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Eheim autofeeder

Post by lnevo »

Where do you do your "action" to push the button over the IO channel?
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: Eheim autofeeder

Post by jsclownfish »

I just send a byte over I2C to the IO and it triggers the relay for the feeder. I have inputs to the IO for the buzzer and feeder and outputs for the flow sensors, floats, and light sensors.

Let me know if you want me to post the code (I'm not at my PC at the moment).

-Jon
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Eheim autofeeder

Post by Piper »

jsclownfish wrote:Let me know if you want me to post the code (I'm not at my PC at the moment).

-Jon
That would be great if you could. That sounds like exactly what I want to do.

Thanks,
Charlie
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: Eheim autofeeder

Post by jsclownfish »

OK, so here is how I do it. I tried to simplify my ino files down to the autofeeder stuff. Also, you'll see I slowly added more options so there are 4 now:
1. feed once a day
2. feed twice a day
3. feed every hour during the day
4. feed on command with a memory location read to trigger the event.

Here is the relevant main code...

Code: Select all

// Vacation autofeeder memory locations
#define Vacation         100
#define VacationEnable      Vacation  //autofeeder on=1
#define VacationStartHr      Vacation+1  //1st hour
#define VacationStartMin   Vacation+2  //1st minute
#define VacationStart2ndHr      Vacation+3   //2nd hour
#define VacationStart2ndMin   Vacation+4   //second minute
#define FastFeed    Vacation+5  //Fast feeder timer
#define VacationPulseFeed    Vacation+6  //pulse signal from the internal memory function

byte Feed = 0;

void setup()
{
}
void loop()
{
//Autofeeder Mode
  if (  (InternalMemory.read(VacationEnable) > 0) || (InternalMemory.read(VacationEnable) <= 2)  ) // check for vacation mode 1 time a day
	{
         // Check if the current time is equal to the start time.
            if (NumMins(hour(), minute()) == (NumMins(InternalMemory.read(VacationStartHr), InternalMemory.read(VacationStartMin))))
            {
              if (second() == 0) 
              		{
			Feed = 1;   // Turn on feeder and feedmode
			ReefAngel.FeedingModeStart();
		        }   
            }
            else Feed = 0;
         }
  if ( InternalMemory.read(VacationEnable) == 2 ) // check for vacation mode 2 times a day
	{
         // Check if the current time is equal to the start time.
            if (NumMins(hour(), minute()) == (NumMins(InternalMemory.read(VacationStart2ndHr), InternalMemory.read(VacationStart2ndMin))))
            {
              if (second() == 0) 
              		{
			Feed = 1;   // Turn on feeder and feedmode
			ReefAngel.FeedingModeStart();
		        }   
            }
            else Feed = 0;
         }
  if ( InternalMemory.read(VacationEnable) == 3 ) // check for vacation mode hourly
	{
           if ((hour() >= 10) || (hour() <= 19)) //from 10a-7p 
             {
              if (minute() ==30 && second() == 0) //once an hour on the half hour
              		{
			Feed = 1;   // Turn on feeder and feedmode
                        ReefAngel.Timer[FEEDING_TIMER].SetInterval(InternalMemory.read(FastFeed));   //short feed timer		
                        ReefAngel.FeedingModeStart(); 
                        ReefAngel.Timer[FEEDING_TIMER].SetInterval(InternalMemory.FeedingTimer_read());  //reset original feed timer
		        }   
             else Feed = 0;
             }
         }
  if ( InternalMemory.read(VacationPulseFeed) == 1 ) // feeder trigger for remote feeding
	{
          Feed = 1;   // Turn on feeder and feedmode
          ReefAngel.Timer[FEEDING_TIMER].SetInterval(InternalMemory.read(FastFeed));	//short feed timer		
          ReefAngel.FeedingModeStart();
          ReefAngel.Timer[FEEDING_TIMER].SetInterval(InternalMemory.FeedingTimer_read());  //reset original feed timer
          InternalMemory.write(VacationPulseFeed,0);     //reset variable to 0 to mimic a pulse or button release   
	} 
         else Feed = 0;

//I/O module communication
  Wire.beginTransmission(7);      // transmit to device #7 (IO Module)
  Wire.write('$');         // send the $$$
  Wire.write('$');
  Wire.write('$');
  Wire.write(Feed);
  Wire.endTransmission();      // stop transmitting  
and here is the relevant IO code....

Code: Select all

#include <Wire.h>
#include <avr/wdt.h>

byte Feeder=0;   //autofeeder signal

void setup()
{
  Wire.begin(7);
  Wire.onReceive(receiveEvent);
  pinMode(10,OUTPUT);  //autofeeder pin
  digitalWrite(10,LOW); 
}

void loop()
{
  //feeder 
 if (Feeder == 0)
 {
   digitalWrite(10, LOW);
 }
 else if (Feeder == 1)
 {
   digitalWrite(10, HIGH);
 }
}

void receiveEvent(int howMany) 
{
  if (howMany==4)  // Our custom protocol is 4 bytes
  {
    byte cmd1,cmd2,cmd3,cmd4;
    cmd1=Wire.read();
    cmd2=Wire.read();
    cmd3=Wire.read();
    cmd4=Wire.read();  
    if (cmd1=='$' && cmd2=='$' && cmd3=='$') // the first 3 bytes of the custom protocol are $$$ to ensure it's coming from RA
    {
      Feeder=cmd4;
    }
  }
  else
    for (int a=0;a<howMany;a++)
      Wire.read(); // if the number of bytes is not 4, discard everything
} 

Hope that helps.
-Jon
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

So it looks like the button "press" is really just a momentary action. Was trying to figure out how much time I needed to "hold" the button down for..i

For the electronics part. You are just going from the io module to relay and relay to button?
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: Eheim autofeeder

Post by jsclownfish »

Yes. I just used a little plastic box to to hold the 5V relay from RadioShack http://www.radioshack.com/product/index ... Id=2062478.

Jon
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

That gives me a great idea... :)

Roberto can you sell me a small ReefAngel box with a mini usb port? i'm thinking like the pressure switch case. I can install the relay in that and run a mono audio cable up to the feeder :)

I could use the hole to mount the mono jack :) just need to make sure it'll be ok size wise...

If we can do something shoot me a PM with the options :)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Eheim autofeeder

Post by rimai »

Sure. It's very tiny though.
Roberto.
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: Eheim autofeeder

Post by jsclownfish »

I like that idea! I don't like that mine is hard wired now and I haven't taken the time to change it. The RadioShack plastic box is also too big. I'd think you would need a IO size box though.


Jon
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

Yeah The pressure switch may be too tiny...but io module size would work :) i've no idea how big the relay is.. :)
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: Eheim autofeeder

Post by jsclownfish »

the one I used was maybe 1" long and 1/4" around.
Jon
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

Just picked up the relay some mono ports and jacks. The relay is not the one linked but it should be fine. Pretty small.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

I found an old blackberry charger that is now modded with a mono jack and i wired up the relay to a mono port and its working :) now i just need my feeder. I actually want to see if i can find room inside the unit for the relay.
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Eheim autofeeder

Post by Piper »

lnevo wrote:I actually want to see if i can find room inside the unit for the relay.
I found an old 5v wall wart today so I'll either have to make or buy a step down converter to get down to 3.3v. I wanted to keep it all in the battery compartment of the feeder but I don't think I'll get away with it if I use a converter. I'll pick up a small RadioShack project box to put everything in then run a cable up to the feeder.

Let us know if you manage to stuff it all in the feeder. I'd like to see how you do it.

~Charlie
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Eheim autofeeder

Post by lnevo »

If it can't fit, I'll just put the relay it into a project box and swap the jack for a plug on the extension cable I made. :)
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Eheim autofeeder

Post by Piper »

I've been reading through the various mods and it should be easy enough to put the relay on a small board along with the components I need to bring the voltage down to 3.3v form 5v on the wall wart. I ordered a bunch of parts/pieces last week to build the projects from the book I'm reading and I'm just waiting for that to ship. I should have everything I need in that batch other than the relay. I'll pick up the relay from Radio Shack on the way home tonight.

Hopefully I can get this put together by next weekend and not turn my autofeeder into and expensive paperweight :)

~Charlie
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

Got my feeder today and got everything installed. Was no way to get it stuffed in without doing the battery mod. I put it all in a small take out plastic container. I'm just gonna grab a small project box tomorrow. I tested plugging it in and unplugging. It triggers immediately. Can't wait to get this hooked up.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Eheim autofeeder

Post by lnevo »

Connected the feeder up today. Had to cut the clamp out a bit so i could attach it to the cross brace instead of the rim. Works like a charm. Its connected to my WC pump extension cord for now until I start on the revamp and my new code...

Here's some pics:
Image
Image
Image
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Eheim autofeeder

Post by Piper »

All my electronics parts/pieces finally came in and I'm ready to get going in on this but I have a question before I start. From the PDF attached to the page in this link (http://www.manhattanreefs.com/forum/diy ... pex-3.html) he is using the following items to convert his 5v DC wall wart to 3.2v DC to power the feeder.
  • Supply List for building 5-­‐3.2V Converter.
  • 1-­‐330 Ohm Resistor
  • 1-­‐470 Ohm Resistor
  • 1-­‐4.875"x2.5"x1.5" Project Box
  • 1-­‐Dual Mini Board (213 Hole)
  • 1-­‐LM317T Adj. Voltage Regulator
  • 4-­‐DC Power Plug (Size-­‐N)
  • 4-­‐Coaxial Power Jack (Size-­‐N)
  • 1-­‐5v Power supply from around the house
For those of you that used this method over keeping the batteries to power the feeder have you had any problems with this? I'm still very new to electronics and I understand the *very* basics of this and how/why it works but in my research for DC to DC step-down converters I've read on many sites using this method is not all that great and/or "clean". Is there anything inherently wrong with going this route?

~Charlie
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Eheim autofeeder

Post by rimai »

I think you are just fine with that voltage regulator.
Roberto.
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Eheim autofeeder

Post by Piper »

I'll give it a shot. Thanks, Roberto!
Amos Poh
Posts: 107
Joined: Sun Jul 22, 2012 4:51 am
Location: Singapore

Re: Eheim autofeeder

Post by Amos Poh »

Hi Piper and Inevo,

I recently brought a battery powered auto feeder and was thinking of powering it up via the ReefAngel instead of batteries also would be best if i can trigger a feed wirelessly.

Found this thread with lots of information but i am a idiot when it comes to electrical stuff. Possible to teach me what to buy and how to assemble?

1) power up the feeder using RA
2) trigger a feed wirelessly

Autofeeder is using 2x 1,5v AA battery

Thanks in advance :)
Post Reply