couple of issues

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

couple of issues

Post by cherub »

first issue: I used the wizard to set up code. Set my port 1 to turn on during lights on mode. The problem is lights on mode doesn't show up at all on the menu on the controller.

Second issue: I have port 8 set to shut off during water change mode which is my ato pump. I hit the water change mode, start draining water and the pump turns on...

So the wizard isnt working for me. Here is the code, not sure what's wrong as it all looks accurate. I also have an issue with the ph calibration. I will post that after the code.

#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


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

// This should always be the last line
ReefAngel.Portal( "cherub" );
ReefAngel.ShowInterface();
}



As for the PH calibration I use 7 and 10 fluids. They dont settle on 7 or 10 though. 7 settles at 5.something and 10 settles on 7.something. I thought it was the probe and spent 50 bucks on a new one and get the same issue. I even bought new fluid. What is the deal? My PH reads 6.1 right now but when I use the drip tests its closer to 8.1...

One last thing, I bought a tunze cable and hooked it all up. I am not sure what I need to do to make it work as there is no tunze attachment option and the dimming menu doesn't come up either.

Sorry for posting all these at once but I need this stuff fixed. PH needs to be accurate of course. Waer change mode needs to work or I will end up ripping those cheap wires out unplugging the float switch anytime I need a water change. no good...

Thanks in advance!
Image
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

ok well I have my probe sitting in 7.1 waiting for a reply, sooner the better
Image
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

it's sitting at 4.7 in the 7.1 fluid by the way..
Image
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: couple of issues

Post by dmolton »

How are you attempting calibration? Are you using the "Ph Calibration" menu item on the controller?

When I did my 7/10 calibration using the menu item, my numbers came out to the whole numbers 507 and 782. It's like a mini wizard on the controller for calibration. It will ask you to dip your probe in 7 solution, the numbers will be all over the place for a few minutes and then settle down. Then you press the OK button then put the probe in the 10 solution and wait until they settle agian. If you're calibrating correctly using the ph calibration menu item on the controller, you shouldn't be seeing numbers like 4.7 and 7.1.. closer to 500 and 800 during calibration.. Once complete you can dip your probe back in the solutions and you should see 7.01 and 10.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: couple of issues

Post by mudcat1 »

cherub,
To get controllable Tunze powerheads working, first you will also need to make sure that you have the Analog version of the Relay box, there are two version Analog and PWM. I believe they put an Analog label somewhere on the Relay box. Next you can easily find many examples of the code used for controlling Tunze powerheads by searching the forum for the functions TunzeShortPulse or TunzeLongPulse. Assuming you have this all in place, the Tunze cable has a positive and negative lead so after you put the code in place if the powerhead is still not controllable try reversing the leads of the Tunze cable on the Relay box.

I don't have the PH probe so unfortunately I can't help you with the calibration issue.

I hope this helps,
John
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

thanks for the replies :) Yeah I do the on board calibration so I assume it's done properly. I waited the first time almost a half hour before giving up on waiting for it to hit 7. My old controller would let the probe actually get to 7 then hit continue then let the probe hit 10 then hit continue. This one is strange/disapointing that it will not hit the number it should as that really just defeats the purpose.

I will look for the short and long pulse settings to add but where in the code does it show what will show up on the menu? I updated my libraries again last night on the controller but loading the factory code set then reloading my custom code and the "lights on" mode still isn't there but now I will need there to be a tunze controller in the menu.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: couple of issues

Post by rimai »

What numbers are you getting on the screen when you enter pH calibration mode and place the probe into ph7 fluid?
You mentioned again that it hits 7 on the screen. The number on screen is not the pH value. It's a number from 0-1024, which is an 8 bit resolution number. The Analog-to-Digital converter (ADC) used has 8 bit resolution.
Again, it does not represent the pH scale.
To get the pH scale, the controller interpolates this raw number you get on calibration for pH7 and pH10 to calculate the actual pH scale you know and are familiar with.
To get the menu, you must use the standard menu instead of simple menu:
http://forum.reefangel.com/viewtopic.php?f=4&t=1444
Roberto.
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

well it sat in the 7.1 last night for about 2 hours and was at 4.71. I ended up canceling the calibration and just stuck it back in the tank and went to bed. I'm at work now but can try again when I get home
Image
cherub
Posts: 25
Joined: Fri May 25, 2012 11:15 am

Re: couple of issues

Post by cherub »

thanks for that link i will try that too. Where on the code is the set up section? Am I replacing the "void setup" with the standard menu code? Sorry I never coded before which is why I use the wizard.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: couple of issues

Post by rimai »

There is a section like this in the setup() section:
////// Place additional initialization code below here


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

Just place the line inside there.
Roberto.
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: 12857
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: 5422
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: 12857
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: 12857
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: 5422
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: 5422
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