Updated to 1.0.4 libraries. Cannot control Tunze powerhead.

Related to the development libraries, released by Curt Binder
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Updated to 1.0.4 libraries. Cannot control Tunze powerhead.

Post by mudcat1 »

I am running Arduino on Ubuntu Linux version 10.04. I just upgraded from the 1.0.3 to 1.0.4 libraries as I was prompted to upgrade when I started Arduino. I copied the twi.c file into the ReefAngel-1.0.1\libraries\Wire\Utility directory. I removed all of the Wave Maker code from my sketch and compiled and uploaded it to my Reef Angel. Everything seems to work correctly except for my Tunze 6105 powerhead. It will not run the ReefCrest code as it did prior to the upgrade in version 1.0.3. The pump will only run now if I disconnect the Tunze controller cable.

When I look at the PWMD output on the web portal it appears to be operating correctly. See attached screenshot.

Did I miss something when performing the upgrade?
Attachments
Screenshot-3.png
Screenshot-3.png (42.72 KiB) Viewed 7618 times
johniii
Posts: 86
Joined: Sun Mar 03, 2013 8:37 am

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by johniii »

With the update. You No longer have to code the individual modes. Just need to call the function
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

johniii wrote:With the update. You No longer have to code the individual modes. Just need to call the function
Yes, that is what I did. I removed the wave code from the sketch and call the functions from the loop. Everything compiles correctly but it does not control the pump any longer in version 1.0.4.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

I just upgraded my libraries to version 1.0.5 and the Reef Angel still will not control my Tunze 6105. I may have to downgrade back to version 1.0.3, because it was working perfectly in that version. Any ideas? Has anyone else tried the new libraries with Linux?
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by enigma32 »

I will be receiving my RA+ in a few days and then building it from within Ubuntu 10.04, however I don't have a Tunze pump to test this with.

hmm. Why would running the arduino IDE in linux make a difference here? I don't think it would.
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

Can you post the code?
Roberto.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

rimai wrote:Can you post the code?
Roberto, Here's my code.

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 *******************

// define what each relay port is used for.
#define ATO_pump       Port1 // Auto Top Off
#define Dose_Alk       Port2 // Dosing Pump Alk
#define Dose_Ca        Port3 // Dosing Pump Ca
#define Dose_Mg        Port4 // Dosing Pump Mg
#define Powerhead      Port5 // Tunze 6105 Powerhead
#define Filtration     Port6 // Reef Octopus skimmer and Reactor
#define Heater         Port7 // Heater
#define Refugium_Light Port8 // Refugium LED Light

// define Internal Memory variables for the 3 dosing pumps
#define Dose_Alk_Seconds 100 // Number of seconds to dose Alk (byte value=300)
#define Dose_Ca_Seconds  101 // Number of seconds to dose Ca (byte value=300)
#define Dose_Mg_Seconds  102 // Number of seconds to dose Mg (byte value=85)

// define Internal Memory variables for Powerhead
#define DTime_MinSpeed   103 // Powerhead Day time Minimum Speed (byte value=36)
#define DTime_MaxSpeed   104 // Powerhead Day time Maximum Speed (byte value=75  )
#define DTime_Duration   105 // Powerhead Day time Duration (int value=4)
#define NTime_MinSpeed   106 // Powerhead Night time Minimum Speed (byte value=41)
#define NTime_MaxSpeed   107 // Powerhead Night time Maximum Speed (byte value=45)
#define NTime_Duration   108 // Powerhead Night time Duration (int value=3)
#define NTime_StartTime  109 // Powerhead Night Start time 8:00 pm (byte value=20) 
#define NTime_EndTime    110 // Powerhead Night End time 9:00 am (byte value=9)
#define PwrHead_Mode     111 // Powerhead Mode: LongPulse=0,Sine=1,ReefCrest=2,Nutrient Transport=3,Tide=4,Tidal Swell=5,ShortPulse=6 (byte value=0)
#define RC_WaveSpeed     112 // ReefCrest WaveSpeed (byte value=60)
#define RC_WaveOffset    113 // ReefCrest WaveOffset (byte value=20)
//#define TS_WaveMaxSpeed  114 // Tidal Swell Wave Maximum Speed (byte value=75)
#define TM_Speed         115 // Tide Mode Speed (byte value=50)
#define TM_minOffset     116 // Tide Mode miniumum offset (byte value=10)
#define TM_maxOffset     117 // Tide Mode maximum offset (byte value=50)
#define NT_Duration      118 // Nutrient Transport Duration in milliseconds (int value=4000)
#define buzzer_volume    119 // buzzer volume 100 = full volume (byte value = 100)

#define PI 3.141593 // for Tide Mode - added 3/26/13

// define Other Internal Memory variables
#define DelayFilter      120 // Delay Filters (Skimmer and Reactor) start timer (byte value=120)

// added buzzer 1-19-13
// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;
byte atoflag=0;
//byte PH_Mode=InternalMemory.read(PwrHead_Mode);

/* added 1-19-13 - Uncomment when I purchase the IO expansion module.
byte iochannel0flag=0;
byte iochannel1flag=0;
byte iochannel2flag=0;
byte iochannel3flag=0;
byte iochannel4flag=0;
byte iochannel5flag=0;
*/

// Define the custom menu descriptions.
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Feeding";
prog_char menu1_label[] PROGMEM = "Water Change";
prog_char menu2_label[] PROGMEM = "ATO Clear";
prog_char menu3_label[] PROGMEM = "Overheat Clear";
prog_char menu4_label[] PROGMEM = "PH Calibration";
prog_char menu5_label[] PROGMEM = "Sump Light On/Off";
prog_char menu6_label[] PROGMEM = "Powerhead On/Off";
prog_char menu7_label[] PROGMEM = "Filtration On/Off";
prog_char menu8_label[] PROGMEM = "Version";PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label, menu7_label, menu8_label };

void MenuEntry1()
{
//ReefAngel.DisplayMenuEntry("Feeding");
ReefAngel.FeedingModeStart();
}

void MenuEntry2()
{
//ReefAngel.DisplayMenuEntry("Water Change");
ReefAngel.WaterChangeModeStart();
}

void MenuEntry3()
{
ReefAngel.ATOClear();
ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}

void MenuEntry4()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}

void MenuEntry5()
{
//ReefAngel.DisplayMenuEntry("PH Calibration");
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void MenuEntry6()
{
// Clear the screen
ReefAngel.ClearScreen(DefaultBGColor);
// Display some text on the screen.
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 5, 10, "Sump Light On/Off");
// Determine whether the Sump Light is already on.
if (bitRead(ReefAngel.Relay.RelayData, Refugium_Light-1)) { // The relay controlling the sump light is on.
  // Toggle MaskOff for the light
  bitWrite(ReefAngel.Relay.RelayMaskOff, Refugium_Light-1, 1-bitRead(ReefAngel.Relay.RelayMaskOff, Refugium_Light-1));
} else { 
  // Toggle the MaskOn for the light.
  bitWrite(ReefAngel.Relay.RelayMaskOn, Refugium_Light-1, 1-bitRead(ReefAngel.Relay.RelayMaskOn, Refugium_Light-1));
}
ReefAngel.Relay.Write();
// Tell the controller to cleanup and return to the main screen.
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
// To return to the menu instead, comment out the above line and use this line instead.
//ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void MenuEntry7()
{
// Clear the screen
ReefAngel.ClearScreen(DefaultBGColor);
// Display some text on the screen
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 5, 10, "Powerhead On/Off");
// Determine whether the Powerhead is already on.
if (bitRead(ReefAngel.Relay.RelayData, Powerhead-1)) { // If relay controlling the powerhead is on.
  // Toggle MaskOff for the powerhead
  bitWrite(ReefAngel.Relay.RelayMaskOff, Powerhead-1, 1-bitRead(ReefAngel.Relay.RelayMaskOff, Powerhead-1));
} else { 
  // Toggle the MaskOn for the powerhead.
  bitWrite(ReefAngel.Relay.RelayMaskOn, Powerhead-1, 1-bitRead(ReefAngel.Relay.RelayMaskOn, Powerhead-1));
}
ReefAngel.Relay.Write();
// Tell the controller to cleanup and return to the main screen.
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
// To return to the menu instead, comment out the above line and use this line instead.
//ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void MenuEntry8()
{
// Clear the screen
ReefAngel.ClearScreen(DefaultBGColor);
// Display some text on the screen
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 5, 10, "Filtration On/Off");
// Determine whether the Filtration is already on.
if (bitRead(ReefAngel.Relay.RelayData, Filtration-1)) { // If relay controlling filtration is on.
  // Toggle MaskOff for the Filtration
  bitWrite(ReefAngel.Relay.RelayMaskOff, Filtration-1, 1-bitRead(ReefAngel.Relay.RelayMaskOff, Filtration-1));
} else { 
  // Toggle the MaskOn for the Filtration.
  bitWrite(ReefAngel.Relay.RelayMaskOn, Filtration-1, 1-bitRead(ReefAngel.Relay.RelayMaskOn, Filtration-1));
}
ReefAngel.Relay.Write();
// Tell the controller to cleanup and return to the main screen.
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
// To return to the menu instead, comment out the above line and use this line instead.
//ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void MenuEntry9()
{
//ReefAngel.DisplayMenuEntry("Display Version");
ReefAngel.DisplayVersion();
}

// ************ PLACE GLOBAL VARIABLE CODE ABOVE HERE *******************

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    // Initialize the menu - Added 1-7-13
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
//    ReefAngel.LightsOnPorts = Port8Bit;  // Removed 1-21-13 to stop the buzzer alarm when sump light was turned on (i.e. 20% Actinic)
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 820 );

    // Ports that are always on
    ReefAngel.Relay.On( Powerhead );  // Tunze 6105 powerhead 
    ReefAngel.Relay.On( Filtration ); // Reef Octopus skimmer and BRS reactor 
}

// ************ PLACE ADDITIONAL INITIALIZATION CODE BELOW HERE *******************

// Setup SMS alerts
void WifiSendAlert(byte id, boolean IsAlert)
{
  static byte alert_status;
  if (IsAlert) {
    if ((alert_status & 1<<(id-1))==0) {
      alert_status|=1<<(id-1);
      Serial.print("GET /status/alert.asp?e=123456789@vtext.com&id=");
      Serial.println(alert_status,DEC);
      Serial.println("\n\n"); 
    }
  }
  else {
    if (id==0) {
      alert_status=0;
      delay(900);
    }
    else {
      alert_status&=~(1<<(id-1)); 
    }
  }
}

// ************ PLACE ADDITIONAL INITIALIZATION CODE ABOVE HERE *******************

void loop()
{
// Get Powerhead Mode from Internal Memory
byte PH_Mode=InternalMemory.read(PwrHead_Mode);
       
//*** Heater *** added 12-27-12
   ReefAngel.StandardHeater( Heater,775,790 );

//*** Refugium Light *** added 12-27-12 - Turn light on at 8:00 pm and off at 8:00 am.
   ReefAngel.StandardLights( Refugium_Light,20,0,8,0 );

// ************ PLACE YOUR CUSTOM CODE BELOW HERE *******************
    
   ReefAngel.CustomVar[0]=InternalMemory.read(Dose_Alk_Seconds);
   ReefAngel.CustomVar[1]=InternalMemory.read(Dose_Ca_Seconds);
   ReefAngel.CustomVar[2]=InternalMemory.read(Dose_Mg_Seconds);
   ReefAngel.CustomVar[3]=ReefAngel.LowATO.IsActive();
   ReefAngel.CustomVar[4]=ReefAngel.HighATO.IsActive();
//  ReefAngel.CustomVar[5]=InternalMemory.read(PH_Mode); // added 3/26/13
   ReefAngel.CustomVar[5]=InternalMemory.read(PwrHead_Mode); // added 3/26/13
   ReefAngel.CustomVar[6]=InternalMemory.read(DTime_MaxSpeed);   
   ReefAngel.CustomVar[7]=InternalMemory.read(NTime_MaxSpeed);

// Added buzzer 1-19-13    
// Sound buzzer if any flag is set.
// Added 1-19-13 - Uncomment when I purchase the IO expansion module.
//   buzzer = overheatflag + atoflag + iochannel0flag + iochannel1flag + iochannel2flag + iochannel3flag + iochannel4flag + iochannel5flag;
   buzzer = overheatflag + atoflag;
   if ( buzzer >= 1 ){
     buzzer = InternalMemory.read(buzzer_volume); // Set value of buzzer volume.
 } else {
     ReefAngel.PWM.SetActinic(0);
   }  
//   Do not sound the buzzer for empty ATO reservior between 7:00 am and 10:00 pm.
   if (!ReefAngel.LowATO.IsActive() && ( hour() >= 7 && hour() < 22)) {
      ReefAngel.PWM.SetActinic( buzzer );
 } else {   
      ReefAngel.PWM.SetActinic(0);
      if (!ReefAngel.HighATO.IsActive()) { 
        ReefAngel.PWM.SetActinic( buzzer );
    } else {
        ReefAngel.PWM.SetActinic(0);
      }
   }    

// Determine which powerhead mode to use.
switch (PH_Mode) {

  case 0: // LongPulse
    if ( (hour() >= InternalMemory.read(NTime_StartTime)) || (hour() <= InternalMemory.read(NTime_EndTime)) ){ // If Night
       // Night mode for powerheads
       ReefAngel.PWM.SetDaylight(LongPulseMode(InternalMemory.read(NTime_MinSpeed),InternalMemory.read(NTime_MaxSpeed),InternalMemory.read(NTime_Duration),false) );
    } else {
       // Daytime mode for powerheads
       ReefAngel.PWM.SetDaylight(LongPulseMode(InternalMemory.read(DTime_MinSpeed),InternalMemory.read(DTime_MaxSpeed),InternalMemory.read(DTime_Duration),false) ); 
    } 
    break;
  case 1: // Sine
    if ( (hour() >= InternalMemory.read(NTime_StartTime)) || (hour() <= InternalMemory.read(NTime_EndTime)) ){ // If Night
       // Night mode for powerheads
       ReefAngel.PWM.SetDaylight(SineMode(InternalMemory.read(NTime_MinSpeed),InternalMemory.read(NTime_MaxSpeed),InternalMemory.read(NTime_Duration),false) );
    } else {
       // Daytime mode for powerheads
       ReefAngel.PWM.SetDaylight(SineMode(InternalMemory.read(DTime_MinSpeed),InternalMemory.read(DTime_MaxSpeed),InternalMemory.read(DTime_Duration),false) ); 
    } 
    break;
  case 2: // ReefCrest 
       ReefAngel.PWM.SetDaylight(ReefCrestMode(InternalMemory.read(RC_WaveSpeed), InternalMemory.read(RC_WaveOffset), true));
    break;
/*
  case 3: // Nutrient Transport
    if ( (hour() >= InternalMemory.read(NTime_StartTime)) || (hour() <= InternalMemory.read(NTime_EndTime)) ){
       // Night mode for powerheads
       ReefAngel.PWM.SetDaylight( NutrientTransportMode(InternalMemory.read(NTime_MinSpeed),InternalMemory.read(NTime_MaxSpeed),InternalMemory.read(NT_Duration),false) );
    } else {
       // Daytime mode for powerheads
       ReefAngel.PWM.SetDaylight( NutrientTransportMode(InternalMemory.read(DTime_MinSpeed),InternalMemory.read(DTime_MaxSpeed),InternalMemory.read(NT_Duration),false) ); 
    } 
    break;
  case 4: // Tide mode
       ReefAngel.PWM.SetDaylight(TideMode(InternalMemory.read(TM_Speed), InternalMemory.read(TM_minOffset), InternalMemory.read(TM_maxOffset))); 
    break;
/*
  case 5: // Tidal Swell Mode - Sketch too big for Reef Angel Standard.
       ReefAngel.PWM.SetDaylight(TidalSwellMode(InternalMemory.read(TS_WaveMaxSpeed), false));
    break;
  case 6: // ShortPulse
    if ( (hour() >= InternalMemory.read(NTime_StartTime)) || (hour() <= InternalMemory.read(NTime_EndTime)) ){
       // Night mode for powerheads
       ReefAngel.PWM.SetDaylight(ShortPulseMode(InternalMemory.read(NTime_MinSpeed),InternalMemory.read(NTime_MaxSpeed),InternalMemory.read(NTime_Duration),false) );
    } else {
       // Daytime mode for powerheads
       ReefAngel.PWM.SetDaylight(ShortPulseMode(InternalMemory.read(DTime_MinSpeed),InternalMemory.read(DTime_MaxSpeed),InternalMemory.read(DTime_Duration),false) );
    }
    break;
*/
  default:
    Serial.print(" PH Mode");
//    break;
  }  

/* **** DOSING ****
Added code to set the dosing time in secondes from a variable in the web portal or android application, so I don't have to 
upload code every time I want to make slight adjustments to the amount I dose.  BRS dosers dose 1.1 ml per minute.
*/
// Dose Alk one time per hour between 8:00 pm and 5:00 am.
// Note: Because this dosing occurs for less than 5 minutes it will not be recorded in the Relay activity view in the web portal
   if ( hour() >=20 || hour() <5) {
     ReefAngel.DosingPumpRepeat( Dose_Alk,0,60,InternalMemory.read(Dose_Alk_Seconds));  // Dose Alk for x number of seconds at the top of the hour.
 } else {
     ReefAngel.Relay.Off( Dose_Alk );
   }  

// Dose Ca and Mg one time per hour between 9:00 am and 6:00 pm.
// Note: Because this dosing occurs for less than 5 minutes it will not be recorded in the Relay activity view in the web portal.
   if ( hour() >=9 && hour() <18) {
     ReefAngel.DosingPumpRepeat( Dose_Ca,0,60,InternalMemory.read(Dose_Ca_Seconds)); // Dose Ca for x number of seconds at the top of the hour.
     ReefAngel.DosingPumpRepeat( Dose_Mg,10,60,InternalMemory.read(Dose_Mg_Seconds)); // Dose Mg for x number of seconds 10 minutes after the top of the hour.
 } else {
     ReefAngel.Relay.Off( Dose_Ca );
     ReefAngel.Relay.Off( Dose_Mg );
   }

/* **** SMS TEXT ALERTS ****
Future enhancement: Allow us to add custom text for SMS alerts.

 List of the possible alert codes.
   WifiSendAlert(0)="Nothing"
   WifiSendAlert(1)="Auto top-off timeout"
   WifiSendAlert(2)="Water temperature too high"
   WifiSendAlert(3)="Water temperature too low"
   WifiSendAlert(4)="Lights temperature too high"
   WifiSendAlert(5)="PH too high"
   WifiSendAlert(6)="PH too low Alert"

   Let's say you would like to receive a high water temperature alert.
   The line you have to add is:
   if (ReefAngel.Params.Temp1>820) WifiSendAlert(2);
*/
// Send SMS text message alert if temp1 is less than 74.5 degrees.    
   if (ReefAngel.Params.Temp[1]<745 && ReefAngel.Params.Temp[1]>0) WifiSendAlert(3,true); 
// Send SMS text message alert if temp1 is greater than 82 degrees.
   if (ReefAngel.Params.Temp[1]>820 && ReefAngel.Params.Temp[1]<1850) WifiSendAlert(2,false);

// *** ATO *** added 12-29-12
// Shutoff ATO pump if the ATO reservoir is empty or if the sump is going to overflow.        
   if (!ReefAngel.LowATO.IsActive() || !ReefAngel.HighATO.IsActive()){ // I had to flip the LowATO float switch to make this work correctly so the indicator would be green.
     atoflag=1;  // added 1-20-13 to start buzzer alarm.
     ReefAngel.Relay.Off (ATO_pump);
 } else {
     atoflag=0; // added 1-21-13 to reset buzzer.
     ReefAngel.Relay.On (ATO_pump);
   }

// ****** CUSTOM FEEDING MODE ******
// Added 1-28-13
    ReefAngel.Relay.DelayedOn(Filtration, DelayFilter); // Delay turning on the skimmer and reactor for 120 minutes.

  // Turn on Refugium light during feeding and water change mode
  if (ReefAngel.DisplayedMenu==FEEDING_MODE || ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
    ReefAngel.Relay.On(Refugium_Light);
  }

// ************ PLACE YOUR CUSTOM CODE ABOVE HERE *******************

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

mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

Roberto, I should also remind you that I have a Generation 1 Reef Angel with Analog Relay box.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by lnevo »

Well, one thing I see is that your switch statement is still referencing PH_Mode while your variable is now called PwrHead_Mode.

The other thign I would mention is that your functions are all using memory.. which is good, but hard for us to verify that the memory locations are all correct. Perhaps for some debug, you could try some hard-coding to eliminate that.

For that matter, I would recommend just commenting out the whole switch block and doing a SetDaylight to some hard-coded values to see what happens.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

lnevo wrote:Well, one thing I see is that your switch statement is still referencing PH_Mode while your variable is now called PwrHead_Mode.

The other thign I would mention is that your functions are all using memory.. which is good, but hard for us to verify that the memory locations are all correct. Perhaps for some debug, you could try some hard-coding to eliminate that.

For that matter, I would recommend just commenting out the whole switch block and doing a SetDaylight to some hard-coded values to see what happens.
Lee,
That is the first thing that I tried because I thought there might be an issue with the Android setting byte vs integer memory values. I commented out the switch section and replaced it with this hardcoded statement:

ReefAngel.PWM.SetDaylight(ReefCrestMode(60,20, true));

It gave me the same result, a non running pump. :cry:

I set the PH_Mode early in the loop with this statement:
// Get Powerhead Mode from Internal Memory
byte PH_Mode=InternalMemory.read(PwrHead_Mode);

Thanks for looking though.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

Does the screen show AP and DP values?
Roberto.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

rimai wrote:Does the screen show AP and DP values?
Yes, the AP and DP values are displayed and are changing as expected.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

Can you measure the voltage on the dimming channels?
Roberto.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

rimai wrote:Can you measure the voltage on the dimming channels?
Yes, I just measured the voltage on the Actinic port and it reads about 8 vdc, but the Daylight port reads less than 1 vdc (.04). The Tunze is currently connected to the daylight port. I temporarily switched the Tunze cable to the Actinic port and the pump turned on. Is there something in the 1.0.5 libraries that might affect the voltage to the Daylight port? I will check my wiring connection on the daylight port to make sure that is not the problem.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

Roberto, I switched the Tunze pump to the Actinic port and renamed the PWM.SetDaylight to PWM.SetActinic in my sketch and I moved my buzzer to the Actinic port. The Actinic port is controlling the Tunze 6105 correctly and ReefCrest is working again. :D

But now the buzzer is behaving strangely. When the float switch activates, the DP on the screen shows 100 as it should and the buzzer sounds normal. But now when the float switch is deactivated, the DP on the screen goes to 0 immediately but the buzzer continues to sound for several seconds and slowly goes silent. Do you think there is something in the 1.0.5 libraries that could affect the PWM.Daylight port or is this just a coincidence that my Daylight port on my Gen 1 (analog) Relay box started failing when I upgraded from version 1.0.3?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

It may just be coincidence.
The convertion of the gen1 box I did for you was to try to save it. That box wasn't really meant for it. So it was a hack that worked, but apparently not for long.
Roberto.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

rimai wrote:It may just be coincidence.
The convertion of the gen1 box I did for you was to try to save it. That box wasn't really meant for it. So it was a hack that worked, but apparently not for long.
Roberto,
Thanks the information. Do you think new analog relay box will be compatible with my Gen1 Reef Angel head unit? And can I use my gen1 relay box with the new relay expansion and analog relay box? In other words, are there any known compatibility issues with mixing a Gen1 relay box with the current relay box?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

That scenario would work the best for you :)
That way, you can use the new box as your primary with analog signal without the hack and still use the gen1 as expansion.
Roberto.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

Roberto,
I was having some problems after upgrading to the 1.0.7 libraries, so I decided to go back to version 1.0.3 and after the downgrade the PWM.SetDaylight is working correctly (controlling the Tunze powerhead) as it did before I upgraded to library versions greater than 1.0.4. I think there must be something wrong with the PWM.SetDaylight code in the new libraries. Let me know if there is anything that I can test for you to help you determine where the problem is. I can go between version 1.0.3 and 1.0.7 pretty quickly, if necessary.

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

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

Thanks for troubleshooting.
Let me try to find out what is wrong.
You are still using the same code you posted earlier in this thread, right?
Roberto.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

rimai wrote:Thanks for troubleshooting.
Let me try to find out what is wrong.
You are still using the same code you posted earlier in this thread, right?
Yes
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

Looking at the code, it is very hard to see what is wrong because you are using internal memory, but I do have one thing to point out.
The channels need to be set between 0-100. Anything over it is going to place the channel in override.
I noticed this in your code:

Code: Select all

buzzer = InternalMemory.read(buzzer_volume); // Set value of buzzer volume.
Make sure it is a value between 0-100.
Same thing for all the speed for pumps that are being stored in memory.
Roberto.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

Roberto,
I changed my code and removed most of the Internal Memory variables and hard-coded them to make it easier for you to diagnose. Here is my latest code:

Code: Select all

// For use with Reef Angel Libraries version 1.0.7 use hardcoded values instead of internal memory.
#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 *******************

// define what each relay port is used for.
#define ATO_pump       Port1 // Auto Top Off
#define Dose_Alk       Port2 // Dosing Pump Alk
#define Dose_Ca        Port3 // Dosing Pump Ca
#define Dose_Mg        Port4 // Dosing Pump Mg
#define Powerhead      Port5 // Tunze 6105 Powerhead
#define Filtration     Port6 // Reef Octopus skimmer and Reactor
#define Heater         Port7 // Heater
#define Refugium_Light Port8 // Refugium LED Light
/*
// define Internal Memory variables for the 3 dosing pumps
#define Dose_Alk_Seconds 100 // Number of seconds to dose Alk (byte value=300)
#define Dose_Ca_Seconds  101 // Number of seconds to dose Ca (byte value=300)
#define Dose_Mg_Seconds  102 // Number of seconds to dose Mg (byte value=85)

// define Internal Memory variables for Powerhead
#define DTime_MinSpeed   103 // Powerhead Day time Minimum Speed (byte value=36)
#define DTime_MaxSpeed   104 // Powerhead Day time Maximum Speed (byte value=75  )
#define DTime_Duration   105 // Powerhead Day time Duration (int value=4)
#define NTime_MinSpeed   106 // Powerhead Night time Minimum Speed (byte value=41)
#define NTime_MaxSpeed   107 // Powerhead Night time Maximum Speed (byte value=45)
#define NTime_Duration   108 // Powerhead Night time Duration (int value=3)
#define NTime_StartTime  109 // Powerhead Night Start time 8:00 pm (byte value=20) 
#define NTime_EndTime    110 // Powerhead Night End time 9:00 am (byte value=9)
*/
#define PwrHead_Mode     111 // Powerhead Mode: LongPulse=0,Sine=1,ReefCrest=2,Nutrient Transport=3,Tide=4,Tidal Swell=5,ShortPulse=6 (byte value=0)
/*
#define RC_WaveSpeed     112 // ReefCrest WaveSpeed (byte value=55)
#define RC_WaveOffset    113 // ReefCrest WaveOffset (byte value=20)
//#define TS_WaveMaxSpeed  114 // Tidal Swell Wave Maximum Speed (byte value=75)
#define TM_Speed         115 // Tide Mode Speed (byte value=50)
#define TM_minOffset     116 // Tide Mode miniumum offset (byte value=10)
#define TM_maxOffset     117 // Tide Mode maximum offset (byte value=50)
#define NT_Duration      118 // Nutrient Transport Duration in milliseconds (int value=4000)
#define buzzer_volume    119 // buzzer volume 100 = full volume (byte value = 100)
*/
#define PI 3.141593 // for Tide Mode - added 3/26/13

// define Other Internal Memory variables
//#define DelayFilter      120 // Delay Filters (Skimmer and Reactor) start timer (byte value=120)

// added buzzer 1-19-13
// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;
byte atoflag=0;

/* added 1-19-13 - Uncomment when I purchase the IO expansion module.
byte iochannel0flag=0;
byte iochannel1flag=0;
byte iochannel2flag=0;
byte iochannel3flag=0;
byte iochannel4flag=0;
byte iochannel5flag=0;
*/

// Define the custom menu descriptions.
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Feeding";
prog_char menu1_label[] PROGMEM = "Water Change";
prog_char menu2_label[] PROGMEM = "ATO Clear";
prog_char menu3_label[] PROGMEM = "Overheat Clear";
prog_char menu4_label[] PROGMEM = "PH Calibration";
prog_char menu5_label[] PROGMEM = "Sump Light On/Off";
prog_char menu6_label[] PROGMEM = "Powerhead On/Off";
prog_char menu7_label[] PROGMEM = "Filtration On/Off";
prog_char menu8_label[] PROGMEM = "Version";PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label, menu7_label, menu8_label };

void MenuEntry1()
{
//ReefAngel.DisplayMenuEntry("Feeding");
ReefAngel.FeedingModeStart();
}

void MenuEntry2()
{
//ReefAngel.DisplayMenuEntry("Water Change");
ReefAngel.WaterChangeModeStart();
}

void MenuEntry3()
{
ReefAngel.ATOClear();
ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}

void MenuEntry4()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}

void MenuEntry5()
{
//ReefAngel.DisplayMenuEntry("PH Calibration");
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void MenuEntry6()
{
// Clear the screen
ReefAngel.ClearScreen(DefaultBGColor);
// Display some text on the screen.
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 5, 10, "Sump Light On/Off");
// Determine whether the Sump Light is already on.
if (bitRead(ReefAngel.Relay.RelayData, Refugium_Light-1)) { // The relay controlling the sump light is on.
  // Toggle MaskOff for the light
  bitWrite(ReefAngel.Relay.RelayMaskOff, Refugium_Light-1, 1-bitRead(ReefAngel.Relay.RelayMaskOff, Refugium_Light-1));
} else { 
  // Toggle the MaskOn for the light.
  bitWrite(ReefAngel.Relay.RelayMaskOn, Refugium_Light-1, 1-bitRead(ReefAngel.Relay.RelayMaskOn, Refugium_Light-1));
}
ReefAngel.Relay.Write();
// Tell the controller to cleanup and return to the main screen.
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
// To return to the menu instead, comment out the above line and use this line instead.
//ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void MenuEntry7()
{
// Clear the screen
ReefAngel.ClearScreen(DefaultBGColor);
// Display some text on the screen
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 5, 10, "Powerhead On/Off");
// Determine whether the Powerhead is already on.
if (bitRead(ReefAngel.Relay.RelayData, Powerhead-1)) { // If relay controlling the powerhead is on.
  // Toggle MaskOff for the powerhead
  bitWrite(ReefAngel.Relay.RelayMaskOff, Powerhead-1, 1-bitRead(ReefAngel.Relay.RelayMaskOff, Powerhead-1));
} else { 
  // Toggle the MaskOn for the powerhead.
  bitWrite(ReefAngel.Relay.RelayMaskOn, Powerhead-1, 1-bitRead(ReefAngel.Relay.RelayMaskOn, Powerhead-1));
}
ReefAngel.Relay.Write();
// Tell the controller to cleanup and return to the main screen.
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
// To return to the menu instead, comment out the above line and use this line instead.
//ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void MenuEntry8()
{
// Clear the screen
ReefAngel.ClearScreen(DefaultBGColor);
// Display some text on the screen
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 5, 10, "Filtration On/Off");
// Determine whether the Filtration is already on.
if (bitRead(ReefAngel.Relay.RelayData, Filtration-1)) { // If relay controlling filtration is on.
  // Toggle MaskOff for the Filtration
  bitWrite(ReefAngel.Relay.RelayMaskOff, Filtration-1, 1-bitRead(ReefAngel.Relay.RelayMaskOff, Filtration-1));
} else { 
  // Toggle the MaskOn for the Filtration.
  bitWrite(ReefAngel.Relay.RelayMaskOn, Filtration-1, 1-bitRead(ReefAngel.Relay.RelayMaskOn, Filtration-1));
}
ReefAngel.Relay.Write();
// Tell the controller to cleanup and return to the main screen.
ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
// To return to the menu instead, comment out the above line and use this line instead.
//ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void MenuEntry9()
{
//ReefAngel.DisplayMenuEntry("Display Version");
ReefAngel.DisplayVersion();
}

// ************ PLACE GLOBAL VARIABLE CODE ABOVE HERE *******************

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    // Initialize the menu - Added 1-7-13
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
//    ReefAngel.LightsOnPorts = Port8Bit;  // Removed 1-21-13 to stop the buzzer alarm when sump light was turned on. (i.e. 20% Actinic)
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 820 );

    // Ports that are always on
    ReefAngel.Relay.On( Powerhead );  // Tunze 6105 powerhead 
    ReefAngel.Relay.On( Filtration ); // Reef Octopus skimmer and BRS reactor 
}

// ************ PLACE ADDITIONAL INITIALIZATION CODE BELOW HERE *******************

// Setup SMS alerts
void WifiSendAlert(byte id, boolean IsAlert)
{
  static byte alert_status;
  if (IsAlert) {
    if ((alert_status & 1<<(id-1))==0) {
      alert_status|=1<<(id-1);
      Serial.print("GET /status/alert.asp?e=1234567890@vtext.com&id=");
      Serial.println(alert_status,DEC);
      Serial.println("\n\n"); 
    }
  }
  else {
    if (id==0) {
      alert_status=0;
      delay(900);
    }
    else {
      alert_status&=~(1<<(id-1)); 
    }
  }
}

// ************ PLACE ADDITIONAL INITIALIZATION CODE ABOVE HERE *******************

void loop()
{
// Get Powerhead Mode from Internal Memory
byte PH_Mode=InternalMemory.read(PwrHead_Mode);  // Set to 2
       
//*** Heater *** added 12-27-12
   ReefAngel.StandardHeater( Heater,775,790 );

//*** Refugium Light *** added 12-27-12 - Turn light on at 8:00 pm and off at 8:00 am.
   ReefAngel.StandardLights( Refugium_Light,20,0,8,0 );

// ************ PLACE YOUR CUSTOM CODE BELOW HERE *******************
    
//   ReefAngel.CustomVar[0]=InternalMemory.read(Dose_Alk_Seconds);
//   ReefAngel.CustomVar[1]=InternalMemory.read(Dose_Ca_Seconds);
//   ReefAngel.CustomVar[2]=InternalMemory.read(Dose_Mg_Seconds);
   ReefAngel.CustomVar[3]=ReefAngel.LowATO.IsActive();
   ReefAngel.CustomVar[4]=ReefAngel.HighATO.IsActive();
//   ReefAngel.CustomVar[5]=InternalMemory.read(PwrHead_Mode); // added 3/26/13
//   ReefAngel.CustomVar[6]=InternalMemory.read(DTime_MaxSpeed);   
//   ReefAngel.CustomVar[7]=InternalMemory.read(NTime_MaxSpeed);

// Added buzzer 1-19-13    
// Sound buzzer if any flag is set.
// Added 1-19-13 - Uncomment when I purchase the IO expansion module.
//   buzzer = overheatflag + atoflag + iochannel0flag + iochannel1flag + iochannel2flag + iochannel3flag + iochannel4flag + iochannel5flag;
   buzzer = overheatflag + atoflag;
   if ( buzzer >= 1 ){
     buzzer = 100; // Set value of buzzer volume.
 } else {
     ReefAngel.PWM.SetActinic(0);
   }  
//   Do not sound the buzzer for empty ATO reservior between 7:00 am and 10:00 pm.
   if (!ReefAngel.LowATO.IsActive() && ( hour() >= 7 && hour() < 22)) {
      ReefAngel.PWM.SetActinic( buzzer );
 } else {   
      ReefAngel.PWM.SetActinic(0);
      if (!ReefAngel.HighATO.IsActive()) { 
        ReefAngel.PWM.SetActinic( buzzer );
    } else {
        ReefAngel.PWM.SetActinic(0);
      }
   }    

// Determine which powerhead mode to use.
switch (PH_Mode) {

  case 0: // LongPulse
    if ( (hour() >= 20) || (hour() <= 9) ){ // If Night
       // Night mode for powerheads
       ReefAngel.PWM.SetDaylight(LongPulseMode(41,45,3,false) );
    } else {
       // Daytime mode for powerheads
       ReefAngel.PWM.SetDaylight(LongPulseMode(36,70,4,false) ); 
    } 
    break;

  case 1: // Sine
    if ( (hour() >= 20) || (hour() <= 9) ){ // If Night
       // Night mode for powerheads
       ReefAngel.PWM.SetDaylight(SineMode(41,45,3,false) );
    } else {
       // Daytime mode for powerheads
       ReefAngel.PWM.SetDaylight(SineMode(36,70,4,false) ); 
    } 
    break;

  case 2: // ReefCrest 
       ReefAngel.PWM.SetDaylight(ReefCrestMode(55, 20, true));
    break;
/*
  case 3: // Nutrient Transport
    if ( (hour() >= 20) || (hour() <= 9) ){
       // Night mode for powerheads
       ReefAngel.PWM.SetDaylight( NutrientTransportMode(41,45,4000,false) );
    } else {
       // Daytime mode for powerheads
       ReefAngel.PWM.SetDaylight( NutrientTransportMode(36,70,4000,false) ); 
    } 
    break;
/*
  case 4: // Tide mode
       ReefAngel.PWM.SetDaylight(TideMode(50, 10, 50)); 
    break;
/*
  case 5: // Tidal Swell Mode - Sketch too big for Reef Angel Standard.
       ReefAngel.PWM.SetDaylight(TidalSwellMode(75, false));
    break;
  case 6: // ShortPulse
    if ( (hour() >= 20) || (hour() <= 9) ){
       // Night mode for powerheads
       ReefAngel.PWM.SetDaylight(ShortPulseMode(41,45,3,false) );
    } else {
       // Daytime mode for powerheads
       ReefAngel.PWM.SetDaylight(ShortPulseMode(36,70,4,false) );
    }
    break;
*/
  default:
    Serial.print(" PH Mode");
//    break;
  }  

/* **** DOSING ****
Added code to set the dosing time in secondes from a variable in the web portal or android application, so I don't have to 
upload code every time I want to make slight adjustments to the amount I dose.  BRS dosers dose 1.1 ml per minute.
*/
// Dose Alk one time per hour between 8:00 pm and 5:00 am.
// Note: Because this dosing occurs for less than 5 minutes it will not be recorded in the Relay activity view in the web portal
   if ( hour() >=20 || hour() <5) {
     ReefAngel.DosingPumpRepeat( Dose_Alk,0,60,255);  // Dose Alk for x number of seconds at the top of the hour.
 } else {
     ReefAngel.Relay.Off( Dose_Alk );
   }  

// Dose Ca and Mg one time per hour between 9:00 am and 6:00 pm.
// Note: Because this dosing occurs for less than 5 minutes it will not be recorded in the Relay activity view in the web portal.
   if ( hour() >=9 && hour() <18) {
     ReefAngel.DosingPumpRepeat( Dose_Ca,0,60,255); // Dose Ca for x number of seconds at the top of the hour.
     ReefAngel.DosingPumpRepeat( Dose_Mg,10,60,85); // Dose Mg for x number of seconds 10 minutes after the top of the hour.
 } else {
     ReefAngel.Relay.Off( Dose_Ca );
     ReefAngel.Relay.Off( Dose_Mg );
   }

/* **** SMS TEXT ALERTS ****
Future enhancement: Allow us to add custom text for SMS alerts.

 List of the possible alert codes.
   WifiSendAlert(0)="Nothing"
   WifiSendAlert(1)="Auto top-off timeout"
   WifiSendAlert(2)="Water temperature too high"
   WifiSendAlert(3)="Water temperature too low"
   WifiSendAlert(4)="Lights temperature too high"
   WifiSendAlert(5)="PH too high"
   WifiSendAlert(6)="PH too low Alert"

   Let's say you would like to receive a high water temperature alert.
   The line you have to add is:
   if (ReefAngel.Params.Temp1>820) WifiSendAlert(2);
*/
// Send SMS text message alert if temp1 is less than 74.5 degrees.    
   if (ReefAngel.Params.Temp[1]<745 && ReefAngel.Params.Temp[1]>0) WifiSendAlert(3,true); 
// Send SMS text message alert if temp1 is greater than 82 degrees.
   if (ReefAngel.Params.Temp[1]>820 && ReefAngel.Params.Temp[1]<1850) WifiSendAlert(2,false);

// *** ATO *** added 12-29-12
// Shutoff ATO pump if the ATO reservoir is empty or if the sump is going to overflow.        
   if (!ReefAngel.LowATO.IsActive() || !ReefAngel.HighATO.IsActive()){ // I had to flip the LowATO float switch to make this work correctly so the indicator would be green.
     atoflag=1;  // added 1-20-13 to start buzzer alarm.
     ReefAngel.Relay.Off (ATO_pump);
 } else {
     atoflag=0; // added 1-21-13 to reset buzzer.
     ReefAngel.Relay.On (ATO_pump);
   }

// ****** CUSTOM FEEDING MODE ******
// Added 1-28-13
    ReefAngel.Relay.DelayedOn(Filtration, 120); // Delay turning on the skimmer and reactor for 120 minutes.

  // Turn on Refugium light during feeding and water change mode
  if (ReefAngel.DisplayedMenu==FEEDING_MODE || ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
    ReefAngel.Relay.On(Refugium_Light);
  }

// ************ PLACE YOUR CUSTOM CODE ABOVE HERE *******************

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

The Tunze powerhead is still not running on the DayLight analog channel even though the DP status is changing correctly on the Reef Angel display.

I am also still receiving the "Error Uploading" message when performing an upload to the controller.
.
.
.
avrdude: Recv: . [10]
# | 100% 5.85s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x2e8d
0xe0 != 0xe2
avrdude: verification error; content mismatch
avrdude: Send: Q [51] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]

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

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

I'm still getting it to work just fine.
I've seen something similar happening before when umbutu was used. I can't remember the details. Something to do with Water Level sensor wasn't doing something.
lnevo would know. He was the one having problems.
I'm compiling on PC. Do you have PC to compile?
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Updated to 1.0.4 libraries. Cannot control Tunze powerhead.

Post by lnevo »

I had an issue with waterlevel needing to change to long instead of int. i believe it was related to the ide. The default arduino on ubuntu is 1.0.

Can you verify what version of the ide you are running. Also did you update the twi.c when you upgraded the libraries?
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

lnevo wrote:I had an issue with waterlevel needing to change to long instead of int. i believe it was related to the ide. The default arduino on ubuntu is 1.0.

Can you verify what version of the ide you are running. Also did you update the twi.c when you upgraded the libraries?
I did upgrade twi.c when I upgraded to version 1.0.4. I did not do anything else with twi.c for versions 1.0.5 to 1.0.7 because I was automatically prompted to upgrade when I started Arduino 1.0.1 in Ubuntu 10.04.

How do I determine what version of ide that I am running?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Updated to 1.0.4 libraries. Cannot control Tunze powerhead.

Post by lnevo »

There is an about option somewhere in the menu, but it may also say in the title bar.

The version on Mac was 1.0.1, I had 1.0.4 working for a bit but had problem with wizard and stuff so I went with curt's package. Not sure what fixes the twi.c has or not. But I would definitely try it with curt's bundle and see if any difference.
mudcat1
Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by mudcat1 »

lnevo wrote:There is an about option somewhere in the menu, but it may also say in the title bar.

The version on Mac was 1.0.1, I had 1.0.4 working for a bit but had problem with wizard and stuff so I went with curt's package. Not sure what fixes the twi.c has or not. But I would definitely try it with curt's bundle and see if any difference.
Lee,
I am assuming IDE is an Arduino term. I could not find a Arduino menu option that shows me what IDE version I am running. I do see Arduino 1.0.1 in the title bar though.

Roberto,
Do I have to copy twi.c after each Reef Angel library version is upgraded up to 1.0.7? Or was that only a requirement from 1.0.3 to 1.0.4?

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

Re: Updated to 1.0.4 libraries. Cannot control Tunze powerhe

Post by rimai »

If you already have updated, you are good.
Only required to do it once.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Updated to 1.0.4 libraries. Cannot control Tunze powerhead.

Post by lnevo »

The arduino app is the ide (integrated developmeny environment). You are good at 1.0.1. Not sure whats left :(
Post Reply