couple of issues

Post Reply
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

Sorry for the delay. Got super busy yesterday,

Ok so got the menu working thank you for that,

For the tunze I was unable to get the code working. All I did was paste it from someones post and I get an error.

a function-definition is not allowed here before '{' token

Really all I want to do is be able to set the speed. I don;t care about wavemaker and all that jazz. Just control the speed. Is there a simple code for that or instructions?
The wizard offers the AI cable support. Time to add the tunze option! You say it just needs a dimming port but there is no function built in to utilize that that I can find. Anyway here is the code I have now.

Code: Select all

#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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port3Bit | Port6Bit | Port7Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 808 );


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

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.StandardLights( Port1,9,0,21,0 );
    ReefAngel.SingleATO( true,Port8,30,0 );
    ////// Place your custom code below here
          ReefAngel.AddStandardMenu();


    ////// Place your custom code above here
     //Tunze short pulse functions
     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;
}

    // This should always be the last line
    ReefAngel.Portal( "cherub" );
    ReefAngel.ShowInterface();
}
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: couple of issues

Post by rimai »

You can just set the dimming channels to a specific %.

Code: Select all

#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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
  // This must be the first line
  ReefAngel.Init();  //Initialize controller
  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port6Bit | Port7Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port1Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = 0;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 808 );


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

  ////// Place additional initialization code below here
  ReefAngel.AddStandardMenu();


  ////// Place additional initialization code above here
}

void loop()
{
  ReefAngel.StandardLights( Port1,9,0,21,0 );
  ReefAngel.SingleATO( true,Port8,30,0 );
  ////// Place your custom code below here

  ReefAngel.PWM.SetActinic(100);
  ReefAngel.PWM.SetDaylight(100);

  ////// Place your custom code above here

  // This should always be the last line
  ReefAngel.Portal( "cherub" );
  ReefAngel.ShowInterface();
}
Roberto.
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

I would rather have the whole range to adjust from 0-100%. I dont want one setting set in stone. I want to be able to go in and adjust the speed whenever I want. What code what I need for that? I waited all day long for a generic answer like that :( Sorry if that sounds rude and I do appreciate you taking the time but who would buy a controllable pump to do that? I could have just bought a one speed pump if that's all I wanted.

That code in your reply gives me an error when I check it. Sketch too big.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

couple of issues

Post by lnevo »

How do you want to control it. You can use that code as a starting point. We can change that function to do many things...

1) time of day...cycle through different speeds at different times...(ie. night mode, feeding time, morning/afternoon)

2) change through wifi...you'll need a memory location that you can put the speed into and read that memory to set the ports

3) bell curve or slope. Similar to amthe lighting schedules and easy to sub in and create an increase decrease of the flow throughout the day

4) menu driven.. This is a little complex since the code as written doesn't really allow sub menus, but you could write a menu entry that cycles between percentages. So each time you click it increases 5 or 10% then wraps around whatever range you want.

So many option...thats why you got a generic answer when you asked how you can just set a speed...
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: couple of issues

Post by rimai »

In the standard RA, you have limited memory and having the wifi attachment and the standard menu loaded at the same time will consume a lot and it won't fit. You will need the RA+ for the additional memory.
Do you have the wifi attachment?
If you do, you can use the simple menu, which won't have the lights on menu, but you can override ports using the smart phone app.
So, here is a code where I disabled the wifi, but gave you the ability to change the PWM channel using the joystick.
You can go to setup led lights

Code: Select all

#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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
  // This must be the first line
  ReefAngel.Init();  //Initialize controller
  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port6Bit | Port7Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port1Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = 0;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 808 );


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

  ////// Place additional initialization code below here
  ReefAngel.AddStandardMenu();


  ////// Place additional initialization code above here
}

void loop()
{
  ReefAngel.StandardLights( Port1,9,0,21,0 );
  ReefAngel.SingleATO( true,Port8,30,0 );
  ////// Place your custom code below here

  ReefAngel.PWM.SetActinic(InternalMemory.LEDPWMActinic_read());
  ReefAngel.PWM.SetDaylight(InternalMemory.LEDPWMDaylight_read());

  ////// Place your custom code above here

  // This should always be the last line
  ReefAngel.ShowInterface();
}
Roberto.
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

Hey Roberto I appreciate your replies. Sorry i got super busy today with people in and out etc etc lol...

I do have the wifi attachment. So I guess I will have to go the basic menu :/

I imagine I can just cut and paste the part for the tunze into the wizard code? Just the part in the custom code section? Turned out I messed up labeling which port my heater was on so I will just need to paste it into my current code. The lights on/off didn't even work anyway in the standard menu. It was unresponsive so no real loss going to the mini menu.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: couple of issues

Post by rimai »

Yes, you can just copy and paste the part for your tunze.
Then you can change the % of the pump using one of the smart phone apps.
The memory location are these:
220 - LEDPWMDaylight
221 - LEDPWMActinic
Roberto.
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

very nice sir! I will try it when I get home from work. Thank you again for your time and efforts I am very grateful.

The ph probe still isn;t working though. When I calibrated I stuck it in the 7.1 solution and it read 6.3 and that's with the after market new probe. Is it possible the Reef Angel I got is faulty?
Image
dbmet
Posts: 235
Joined: Thu Nov 10, 2011 11:49 am

couple of issues

Post by dbmet »

What kind of numbers are you getting on the calibration screen when you calibrate the probe?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

couple of issues

Post by lnevo »

It sounds like you aren't using the calibration menu....you can't just stick it in the fluids...

You need to go into the menu and choose ph calibration. Follow the prompts to calibrate 7 then 10 the ok to save.

You might not have the menu item if you have a custom menu...I remember you had some space issues... If that's the case you'll need to load a smaller ino file. Calibrate, then go back to your custom version.

Lee
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

lnevo wrote:It sounds like you aren't using the calibration menu....you can't just stick it in the fluids...

You need to go into the menu and choose ph calibration. Follow the prompts to calibrate 7 then 10 the ok to save.

You might not have the menu item if you have a custom menu...I remember you had some space issues... If that's the case you'll need to load a smaller ino file. Calibrate, then go back to your custom version.

Lee
Yes I am aware. I stated that my results after calibrating were as such.
Image
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

dbmet wrote:What kind of numbers are you getting on the calibration screen when you calibrate the probe?
The 7.1 gives me 4.71 after sitting there for an hour during calibration. I didn't want to leave it there long but I wanted to see if it eventually would climb closer to 7.1 but it didn't. This is using the one time use packs that i ordered online which i only have 1 left.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: couple of issues

Post by lnevo »

cherub,

Your numbers do not correlate... this is why I said it doesn't sound like you are using the menu to go to ph calibration...

When you are int he 7.0 mode and you put it in the 7 fluid you should get a number in the hundreds.. I believe for mine I get like ~540. For 10 I get a number ~800. Unless you are interpretting 471 as 4.71 then something is not being done properly.

After the numbers for 7 and 10 are gotten they should be saved to memory, but you can write them down and we can hard code it in your code. Sorry if I'm beating a dead horse here or if I'm missing something...
Post Reply