Controllable Pumps - Tunze?

Basic / Standard Reef Angel hardware
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Controllable Pumps - Tunze?

Post by najluni15 »

Hi,

Does anyone know how to control Tunze pumps with the Reef Angel via PWM? I read a thread a while back that said it can be done. Would this be worth it, instead of going with Ecotech pumps? I am starting a 120 build and would like to use Tunze if I can to save a little money.

Let me know if it is possible, and if so, how?

Thanks

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

Re: Controllable Pumps - Tunze?

Post by rimai »

It is possible. You need the analog type and not PWM signal.
The cable can be purchased at the webstore.
You need the controllable tunzes though, which are about the same price I think.
Roberto.
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Re: Controllable Pumps - Tunze?

Post by najluni15 »

So I need the analog reef angel? I currently have the pwm reef angel. Is there some sort of adapter? Sorry if it's a stupid question, in not all that good with that type of stuff. I appreciate the awesome support as always Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

no, there is not, sorry :(
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

You can get the dimming module if you need analog signal or get a spare relay box. The relay box is what defines which signal it will output.
Roberto.
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: Controllable Pumps - Tunze?

Post by wijigong »

I need a controller Tunze or just tunze pump???

thank you
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

You need the controllable tunze pump.
Roberto.
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

Re: Controllable Pumps - Tunze?

Post by wijigong »

heheh good

and do you have exemple of code

i need ra+ or juste ra

thank you
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

Any one of them as long as it is the analog version.
The pumps work just like LED lights.

Code: Select all

ReefAngel.PWM.SetActinic(60);
This will put them at 60%
Roberto.
tang185
Posts: 8
Joined: Thu Oct 18, 2012 10:25 am

Re: Controllable Pumps - Tunze?

Post by tang185 »

Hi Roberto,

1. Is there a list of codes (or a tutorial on creating codes) for controlling the Tunze pumps?

2. Where and how does one enter the codes to control the pumps through the dimming ports?

3. Any plans to offer pump control as an alternative to the lighting controls in the setup Wizard?

Thanks,

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

Re: Controllable Pumps - Tunze?

Post by rimai »

No, there is nothing right now, but we can start creating them.
Controlling tunzes is no different than controlling LED lights.
Here is an example:

Code: Select all

ReefAngel.PWM.SetActinic(60);
This code will put the tunzes at 60%
Eventually, if we get functions created, it will get merged into the wizard, but we need to create them first.
There aren't many that use Tunzes, but if you want to help create them, it would be super cool :)
What functions do you have in mind?
Roberto.
sebimme
Posts: 26
Joined: Sat Jan 07, 2012 12:56 am

Re: Controllable Pumps - Tunze?

Post by sebimme »

i will help you.

first: tunze pump can't go under 30% so the interval set will be from 30 to 100%. we have to set the min power (exp. 45% )and the maximum power (exp. 87%)
second: we have to set the pulse time from 0,1 sec to 8 sec .this is the time the pump to to max and the return to min. example if you set pulse time in 2,2 second pump will stay 2,2 second to max preset power and than 2,2 s to min preset power
third: the controller have 4 basic function: -Pulse program: the pumps only increase and decrease the speed according to min and max preset and pulse time preset. -Interval 1 program: in this case while one pump channel cycle between min and max respecting the pulse time the other channel pump will stay off.(we have to set the last parameter: the interval time from 1 second to 12 hour....this is good to simulate the tidal) exp. if you set as interval time 6 hours after the first six hours fist channel go off and second channel start to pulse according to min and max preset. - Interval 2 Program: while the first channel pump pulse according to pulse time and min-max preset the second channel pump stay stable at min value(no pulse only 30% power), after the preset interval time finish the second channel pump start to pulse according to pulse time and min-max preset while the first pump stop to pulse and go stable to 30%. -Sequential program: The pumps connected are switched on one after each other at an adjustable time (3), and subsequently they are switched off again, with the exception of the first pump.
Fourth: night mode. all the pump go to the min value 30%.

i hope this will help you to programming a new wizard submenu' to set our tunze pump.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

Awesome.
Shall we create some functions? :)

Short Pulse:

PulseMinSpeed - % for minimal speed
PulseMaxSpeed - % for maximum speed
PulseDuration - Duration (milliseconds) in which each pulse will be held. The pump will stay at minimal speed for PulseDuration and will stay at maximum speed for PulseDuration.
PulseSync - true if you want to sync pumps to same cycle. false if you want to anti-sync pumps.

Code: Select all

byte TunzeShortPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
  byte tspeed=0;
  PulseMinSpeed=constrain(PulseMinSpeed,0,100);
  PulseMaxSpeed=constrain(PulseMaxSpeed,0,100);
  tspeed=(millis()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
  if (PulseSync)
    return tspeed;
  else
    return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
}
LongPulse:

PulseMinSpeed - % for minimal speed
PulseMaxSpeed - % for maximum speed
PulseDuration - Duration (seconds) in which each pulse will be held. The pump will stay at minimal speed for PulseDuration and will stay at maximum speed for PulseDuration.
PulseSync - true if you want to sync pumps to same cycle. false if you want to anti-sync pumps.

Code: Select all

byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
  byte tspeed=0;
  PulseMinSpeed=constrain(PulseMinSpeed,0,100);
  PulseMaxSpeed=constrain(PulseMaxSpeed,0,100);
  tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
  if (PulseSync)
    return tspeed;
  else
    return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
}
So, to have 2 pumps connected to the standard dimming ports where they both pulse in sync, you would use this code:

Code: Select all

  ReefAngel.PWM.SetActinic( TunzeLongPulse(30,87,2,true) ); 
  ReefAngel.PWM.SetDaylight( TunzeLongPulse(30,87,2,true) ); 
This will create a pulse of 2 second duration with speed between 30% and 87%, where they both pulse together.

If you want them to pulse in opposite to each other, you would use this code:

Code: Select all

  ReefAngel.PWM.SetActinic( TunzeLongPulse(30,87,2,true) ); 
  ReefAngel.PWM.SetDaylight( TunzeLongPulse(30,87,2,false) ); 
This will create a pulse of 2 second duration with speed between 30% and 87%, where they both pulse in opposite to each other.

The full code is here, if you want to just upload and test it:

Code: Select all

#include <Salinity.h>
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

void setup()
{
  ReefAngel.Init();  
}

void loop()
{
  ReefAngel.PWM.SetActinic( TunzeLongPulse(30,87,2,true) ); 
  ReefAngel.PWM.SetDaylight( TunzeLongPulse(30,87,2,true) ); 
  ReefAngel.ShowInterface();
}

byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
  byte tspeed=0;
  PulseMinSpeed=constrain(PulseMinSpeed,0,100);
  PulseMaxSpeed=constrain(PulseMaxSpeed,0,100);
  tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
  if (PulseSync)
    return tspeed;
  else
    return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
}
Roberto.
symon_say
Posts: 119
Joined: Sun Oct 09, 2011 6:04 am
Location: Dominican Republic
Contact:

Re: Controllable Pumps - Tunze?

Post by symon_say »

Roberto you should built the attachment to convert PWM to analog for tunze control, i think there are some people like me how just want to control pump and don't need to control lights, from what i have read this is easy to do but i don't have the knowledge to do it.

An it should work for people how need 0-10v, but already have PWM.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

It is easy.
The problem is that I can't just make one or two. I have to make a whole batch and if I factor the cost of producing the batch of boards and enclosure, manufacturing and storage, it would end up costing just as much as the dimming module, so why not just get the dimming module, which gives you 6 more channels and will accomplish just that?
Or you could even get a spare relay box for a few bucks more.
Roberto.
sebimme
Posts: 26
Joined: Sat Jan 07, 2012 12:56 am

Re: Controllable Pumps - Tunze?

Post by sebimme »

perfect roberto!
but to improve the program you must add also interval time: this can set from 1 second to 12 hours....it's very important to simulate tidal, because when a pump channel stay active the other channel have to stay inactive or in min. speed( inteval program 1 or 2). so if i set interval time to 6 hour i can simulate tide. because if i place a pump(channel 1) in the right corner and another pump(channel 2) in the left corner when the channel 1 pump work(for six hour)according to your shor or long pulse program the channel 2 pump stay off(interval 1 program) or stay min speed(interval 2 program). after six hour the pump work is reversed: pump 2 work according to short or long pulse program and pump 1 stay off or stay min speed according to program(interval 1 or 2).
I hope you understand my explanation.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

Yeah, I understand that part, but let's test these functions first.
Do they work?
Roberto.
sebimme
Posts: 26
Joined: Sat Jan 07, 2012 12:56 am

Controllable Pumps - Tunze?

Post by sebimme »

I didn't test it yet!
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Re: Controllable Pumps - Tunze?

Post by najluni15 »

Any update? I would love to try this out with the tidal changes if it works. Anyone have a code for this?
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Re: Controllable Pumps - Tunze?

Post by najluni15 »

I have been messing with the code and have not gotten it to work. Here is what I have:

// Autogenerated file by RAGen (v1.2.1.158), (11/13/2012 21:28)
// RA_111312_2128.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File:
#define DisplayImages
#define ATOSetup
#define DisplayLEDPWM
#define RelayExp
#define InstalledRelayExpansionModules 8
#define PWMEXPANSION
*/


#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>



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

ReefAngel.FeedingModePorts = Port2Bit | Port4Bit | Port6Bit;
ReefAngel.WaterChangePorts = Port2Bit | Port4Bit | Port6Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;

// Ports that are always on
ReefAngel.Relay.On(Port2);
ReefAngel.Relay.On(Port4);
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.On(Port6);
}

void loop()
{

ReefAngel.PWM.SetChannel(1,PWMSlope( TunzeLongPulse(30,87,2,true) );
ReefAngel.PWM.SetChannel(0,PWMSlope( TunzeLongPulse(30,87,2,true) );

ReefAngel.StandardLights(Port1,8,0,22,0);
ReefAngel.StandardHeater(Port3,778,782);
ReefAngel.StandardATO(Port7,15);
ReefAngel.StandardLights(Port8,21,0,8,0);
ReefAngel.PWM.SetDaylight(PWMSlope(11,30,21,0,0,70,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(11,0,22,0,0,90,180,0));
ReefAngel.ShowInterface();
}


byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
byte tspeed=0;
PulseMinSpeed=constrain(PulseMinSpeed,0,100);
PulseMaxSpeed=constrain(PulseMaxSpeed,0,100);
tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
if (PulseSync)
return tspeed;
else
return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;

I am trying to run two Tunze pumps on channels 0 and 1 of my pwm/analog expansion. I am not sure how to add this into my code because pin 0 and 1 are analog.....Also, is there a way to add interval time as suggested?

I think the tidal flow would be really cool if someone could figure out how to get it to work...Also, anyone know why my file seems so big? I get the sketch too big error a lot

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

Re: Controllable Pumps - Tunze?

Post by rimai »

It was almost there.

Code: Select all

// Autogenerated file by RAGen (v1.2.1.158), (11/13/2012 21:28)
// RA_111312_2128.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
 #define DisplayImages
 #define ATOSetup
 #define DisplayLEDPWM
 #define RelayExp
 #define InstalledRelayExpansionModules 8
 #define PWMEXPANSION
 */


#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>



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

  ReefAngel.FeedingModePorts = Port2Bit | Port4Bit | Port6Bit;
  ReefAngel.WaterChangePorts = Port2Bit | Port4Bit | Port6Bit | Port7Bit;
  ReefAngel.LightsOnPorts = 0;

  // Ports that are always on
  ReefAngel.Relay.On(Port2);
  ReefAngel.Relay.On(Port4);
  ReefAngel.Relay.On(Port5);
  ReefAngel.Relay.On(Port6);
}

void loop()
{

  ReefAngel.PWM.SetChannel(1,TunzeLongPulse(30,87,2,true)); 
  ReefAngel.PWM.SetChannel(0,TunzeLongPulse(30,87,2,true)); 

  ReefAngel.StandardLights(Port1,8,0,22,0);
  ReefAngel.StandardHeater(Port3,778,782);
  ReefAngel.StandardATO(Port7,15);
  ReefAngel.StandardLights(Port8,21,0,8,0);
  ReefAngel.PWM.SetDaylight(PWMSlope(11,30,21,0,0,70,180,0));
  ReefAngel.PWM.SetActinic(PWMSlope(11,0,22,0,0,90,180,0));
  ReefAngel.ShowInterface();
}


byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
  byte tspeed=0;
  PulseMinSpeed=constrain(PulseMinSpeed,0,100);
  PulseMaxSpeed=constrain(PulseMaxSpeed,0,100);
  tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
  if (PulseSync)
    return tspeed;
  else
    return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
}
Roberto.
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Re: Controllable Pumps - Tunze?

Post by najluni15 »

Thanks. Im trying it out
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Re: Controllable Pumps - Tunze?

Post by najluni15 »

So this is what I have uploaded:
Autogenerated file by RAGen (v1.2.1.158), (11/13/2012 21:28)
// RA_111312_2128.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File:
#define DisplayImages
#define ATOSetup
#define DisplayLEDPWM
#define RelayExp
#define InstalledRelayExpansionModules 8
#define PWMEXPANSION
*/


#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>



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

ReefAngel.FeedingModePorts = Port2Bit | Port4Bit | Port6Bit;
ReefAngel.WaterChangePorts = Port2Bit | Port4Bit | Port6Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;

// Ports that are always on
ReefAngel.Relay.On(Port2);
ReefAngel.Relay.On(Port4);
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.On(Port6);
}

void loop()
{

ReefAngel.PWM.SetChannel(1,TunzeLongPulse(30,87,2,true));
ReefAngel.PWM.SetChannel(0,TunzeLongPulse(30,87,2,true));

ReefAngel.StandardLights(Port1,8,0,22,0);
ReefAngel.StandardHeater(Port3,778,782);
ReefAngel.StandardATO(Port7,15);
ReefAngel.StandardLights(Port8,21,0,8,0);
ReefAngel.PWM.SetDaylight(PWMSlope(11,30,21,0,0,70,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(11,0,22,0,0,90,180,0));
ReefAngel.ShowInterface();
}


byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
byte tspeed=0;
PulseMinSpeed=constrain(PulseMinSpeed,0,100);
PulseMaxSpeed=constrain(PulseMaxSpeed,0,100);
tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
if (PulseSync)
return tspeed;
else
return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
}

When I plug the pump control wires into the pumps and into the pwm expansion's analog ports, the pumps turn off entirely....Am I missing something in my code?

Please let me know...Once we know these work, itll be awesome

thanks Roberto
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

Does it show on the screen that channels 0 and 1 are alternating?
Roberto.
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Re: Controllable Pumps - Tunze?

Post by najluni15 »

On what screen? On my reef angel head unit there is a DP and AP value? Not sure what that is....Besides that, I dont know where it would show up...I dont think my code is set correctly....Any ideas?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

Oh sorry...
You seed a custom main screen.
Let's use the default from the PWM module example code.

Code: Select all

// RA_111312_2128.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define DisplayImages
 #define ATOSetup
 #define DisplayLEDPWM
 #define RelayExp
 #define InstalledRelayExpansionModules 8
 #define PWMEXPANSION
 */


#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>

byte x,y;
char text[10];

void DrawCustomMain()
{
  // the graph is drawn/updated when we exit the main menu &
  // when the parameters are saved
  ReefAngel.LCD.Clear(BtnActiveColor,5,0,127,11);
  ReefAngel.LCD.DrawText(DefaultBGColor,BtnActiveColor,30,3,"My Reef Angel");
  ReefAngel.LCD.DrawDate(6, 122);
  pingSerial();
  ReefAngel.LCD.DrawMonitor(15, 20, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
  pingSerial();
  ReefAngel.LCD.Clear(DefaultFGColor,5,52,127,52);
  ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,30,55,"PWM Expansion");
  x=15;
  y=68;
  for (int a=0;a<6;a++)
  {
    if (a>2) x=75;
    if (a==3) y=68;
    ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :");
    ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a);
    ConvertNumToString(text, ReefAngel.PWM.GetChannelValue(a), 1);
    strcat(text,"  ");
    ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,text);
    y+=10;
  }
  pingSerial();
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 103, TempRelay);
}

void DrawCustomGraph()
{
}



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

 ReefAngel.FeedingModePorts = Port2Bit | Port4Bit | Port6Bit;
 ReefAngel.WaterChangePorts = Port2Bit | Port4Bit | Port6Bit | Port7Bit;
 ReefAngel.LightsOnPorts = 0;

 // Ports that are always on
 ReefAngel.Relay.On(Port2);
 ReefAngel.Relay.On(Port4);
 ReefAngel.Relay.On(Port5);
 ReefAngel.Relay.On(Port6);
}

void loop()
{

 ReefAngel.PWM.SetChannel(1,TunzeLongPulse(30,87,2,true)); 
ReefAngel.PWM.SetChannel(0,TunzeLongPulse(30,87,2,true)); 

ReefAngel.StandardLights(Port1,8,0,22,0);
 ReefAngel.StandardHeater(Port3,778,782);
 ReefAngel.StandardATO(Port7,15);
 ReefAngel.StandardLights(Port8,21,0,8,0);
 ReefAngel.PWM.SetDaylight(PWMSlope(11,30,21,0,0,70,180,0));
 ReefAngel.PWM.SetActinic(PWMSlope(11,0,22,0,0,90,180,0));
 ReefAngel.ShowInterface();
}


byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
 byte tspeed=0;
 PulseMinSpeed=constrain(PulseMinSpeed,0,100);
 PulseMaxSpeed=constrain(PulseMaxSpeed,0,100);
 tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
 if (PulseSync)
 return tspeed;
 else
 return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
}
Roberto.
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Re: Controllable Pumps - Tunze?

Post by najluni15 »

Hi Roberto,

Thanks for the help, but I was unable to get this to work.... here is the code I tried with the added PWM module example inserted:

// Autogenerated file by RAGen (v1.2.1.158), (11/15/2012 23:52)
// RA_111512_2352.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File:
#define DisplayImages
#define DisplayLEDPWM
#define wifi
#define RelayExp
#define InstalledRelayExpansionModules 8
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 1
#define PWMEXPANSION
#define CUSTOM_MAIN
*/


#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <ReefAngel.h>

#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Item 1";
PROGMEM const char *menu_items[] = {
menu0_label };

void MenuEntry1()
{
ReefAngel.DisplayMenuEntry("Item 1");
}

void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}

void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph(5, 5);
}


void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));

ReefAngel.FeedingModePorts = Port2Bit | Port4Bit | Port6Bit;
ReefAngel.WaterChangePorts = Port2Bit | Port4Bit | Port6Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;

// Ports that are always on
ReefAngel.Relay.On(Port2);
ReefAngel.Relay.On(Port4);
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.On(Port6);
}

void loop()
{

ReefAngel.PWM.SetChannel(1,TunzeLongPulse(30,87,2,true));
ReefAngel.PWM.SetChannel(0,TunzeLongPulse(30,87,2,true));

ReefAngel.StandardLights(Port1,8,0,22,0);
ReefAngel.StandardHeater(Port3,778,782);
ReefAngel.StandardATO(Port7,15);
ReefAngel.StandardLights(Port8,21,0,8,0);
ReefAngel.PWM.SetDaylight(PWMSlope(11,30,21,0,0,70,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(11,0,22,0,0,90,180,0));
ReefAngel.ShowInterface();
}


byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
byte tspeed=0;
PulseMinSpeed=constrain(PulseMinSpeed,0,100);
PulseMaxSpeed=constrain(PulseMaxSpeed,0,100);
tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
if (PulseSync)
return tspeed;
else
return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
}

I generated the pwm expansion with regen. I also tried the code you gave. Neither worked in displaying anything besides what is normally displayed. The code I tried made a custom item 1 menu that didnt have anything in it....
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

Use the one I posted without modification.
What libraries version are you using?
Are you sure the code is being uploaded?
RAGen is very old and deprecated.... Should not be used.
Reef Angel Wizard is the new tool to generate codes, if you wish to do so.
http://forum.reefangel.com/viewtopic.php?f=8&t=1297
Roberto.
najluni15
Posts: 60
Joined: Sat Mar 10, 2012 6:47 pm

Re: Controllable Pumps - Tunze?

Post by najluni15 »

I keep getting an error...Sorry to be a pain

The following features were automatically added:
Watchdog Timer
Version Menu

The following features were detected:
Dimming Expansion Module
Dimming Signal
Custom Main Screen
Simple Menu
Binary sketch size: 22,488 bytes (of a 32,256 byte maximum)
C:\Program Files\Reef Angel Controller\hardware/tools/avr/bin/avrdude -CC:\Program Files\Reef Angel Controller\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM3 -b115200 -D -Uflash:w:C:\Users\Nick\AppData\Local\Temp\build6969436314062034834.tmp\sketch_nov16a.cpp.hex:i

avrdude: Version 6.0, compiled on Apr 6 2012 at 19:29:19
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "C:\Program Files\Reef Angel Controller\hardware/tools/avr/etc/avrdude.conf"

Using Port : \\.\COM3
Using Programmer : arduino
Overriding Baud Rate : 115200
Rebooting Reef Angel Controller
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: 0 [30]
avrdude: stk500_getsync(): not in sync: resp=0x30

avrdude done. Thank you.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Controllable Pumps - Tunze?

Post by rimai »

Can you check if you have the correct serial port and the correct board?
Roberto.
Post Reply