Page 1 of 1

Buzzer for High and Low alarm

Posted: Sun Oct 27, 2024 1:51 am
by Appleseed
Mornign,

My 2 heaters failed 3 days ago and i didnt notice until yesterday. Luckily the tempos only dropped to 22 so maybe dodged a bullet there.

Anyhow I was trying to setup an audiable alarm but cant get it to compile.

I have tried adding the following to my code but get an error

boolean buzzer=false;
if (ReefAngel.Params.Temp[T1_PROBE] >= 300 || ReefAngel.Params.Temp[T1_PROBE]<= 230) buzzer=true;
if ( buzzer ) ReefAngel.BuzzerOn(2); else ReefAngel.BuzzerOff();

The compile error is
Compilation failed for Appleseed.ino: Details: Appleseed.ino: In function 'void setup()': Appleseed.ino:139:25: error: 'class ReefAngelClass' has no member named 'BuzzerOn' Appleseed.ino:139:53: error: 'class ReefAngelClass' has no member named 'BuzzerOff'

I am using an RA Plus.

The entire code is as follows

Thanks
Andy

Code: Select all

// 07-08-2024 editied names and set port 3 to auto on

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.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 <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <RF.h>
#include <ReefAngel.h>


//#include <RA_ATO.h>
//#include <Wire.h>
//#include <OneWire.h>
//#include <RA_PWM.h>
//#include <Salinity.h>
//#include <IO.h>
//#include <ORP.h>
//#include <AI.h>
//#include <DCPump.h>


////// Place global variable code below here
// Globals Needed for RF Mode on Custom Main
//byte vtechmode;
//byte vtechspeed;
//byte vtechpercent;

boolean bFeeding = false;


byte x = 6;
byte y = 2;
byte t;
char text[7];

//Custom Main, Graph & Menu

void DrawCustomMain()
{
  //      ReefAngel.LCD.DrawDate(6, 2);
  ReefAngel.LCD.DrawText(3, 255, 6, 2, " Reef of Low");

  ReefAngel.LCD.DrawDate(7, 120);
  ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
  pingSerial();

//  vtechmode = ReefAngel.RF.Mode;
//  vtechspeed = ReefAngel.RF.Speed;
//  vtechpercent = ReefAngel.RF.Duration;

  ReefAngel.LCD.Clear(255, 35, 20, 20, 85);

 // ReefAngel.LCD.DrawText(0, 255, 18, 21, "EcoSmart Mode");
 // if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN, 255, 25, 31, "Constant");
 // else if (vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_GOLD, 255, 25, 31, "Lagoonal");
 // else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD, 255, 25, 31, "Reef Crest");
 // else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE, 255, 25, 31, "Short Pulse");
 // else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK, 255, 25, 31, "Long Pulse");
 // else if (vtechmode == 5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA, 255, 25, 31, "STM_NTM.");
 // else if (vtechmode == 6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA, 255, 25, 31, "Tidal Swell");
 // else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE, 0, 45, 31, "Night");
  //
  char text[10];

//  ReefAngel.LCD.DrawText(2, 255, 32, 42, "Speed");
//  ConvertNumToString(text, vtechspeed, 1);
//  if (vtechspeed )ReefAngel.LCD.DrawLargeText(0, 255, 35, 51, text);

//  ReefAngel.LCD.DrawText(23, 255, 32, 62, "Duration");
//  ConvertNumToString(text, vtechpercent, 1);
//  if (vtechpercent) ReefAngel.LCD.DrawLargeText(0, 255, 35, 70, text);
  //
  ReefAngel.LCD.DrawText(0, 255, 10, 80, "T1");
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(COLOR_BLACK, 255, 10, 88, text, Num8x8);
  pingSerial();

  ReefAngel.LCD.DrawText(0, 255, 50, 80, "T2");
  ConvertNumToString(text, ReefAngel.Params.Temp[T2_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(COLOR_BLACK, 255, 50, 88, text, Num8x8);
  pingSerial();

  ReefAngel.LCD.DrawText(0, 255, 100, 80, "pH");
  ConvertNumToString(text, ReefAngel.Params.PH, 100);
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO, 255, 85, 88, text, Num8x8);
  pingSerial();
  //
  pingSerial();
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 100, TempRelay);
  //
}
void DrawCustomGraph()
{
}


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


void setup()
{
  // This must be the first line
  ReefAngel.Init();  //Initialize controller
  ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port4Bit; //| Port6Bit | Port7Bit;
  
  // Ports toggled in Water Change Mode
  // ReefAngel.WaterChangePorts = Port4Bit | Port7Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = 0;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 280 );

boolean buzzer=false;
if (ReefAngel.Params.Temp[T1_PROBE] >= 300 || ReefAngel.Params.Temp[T1_PROBE]<= 230) buzzer=true;
if ( buzzer ) ReefAngel.BuzzerOn(2); else ReefAngel.BuzzerOff();

  // Ports that are always on
  ReefAngel.Relay.On( Port3 );
  ReefAngel.Relay.On( Port4 );
 // ReefAngel.Relay.DelayedOn( Port4 );
  ReefAngel.Relay.On( Port5 ); //MP40
  ReefAngel.Relay.On( Port6 ); //MP40
  ReefAngel.Relay.On( Port7 ); //Return
 // ReefAngel.Relay.DelayedOn( Port8 ); // Used By Cooling Fan

  //  ReefAngel.DCPump.FeedingSpeed=100;

  //  ReefAngel.Timer[FEEDING_TIMER].SetInterval(2100);
  ReefAngel.Timer[FEEDING_TIMER].SetInterval(4000);

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

void loop()
{
  ReefAngel.StandardHeater( Port1, 250, 255 );
  ReefAngel.StandardHeater( Port2, 250, 255 );
  ReefAngel.StandardFan( Port8, 256, 260 );

  ////
  ReefAngel.RF.UseMemory = false;
  ///////
// Define Relay Ports by Name
        #define Heater             1
        #define Heater             2
        #define ReefWave25           3
        #define Skimmer          4
        #define MP40          5
        #define MP40           6
        #define Return         7
        #define Fan            8

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

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



Re: Buzzer for High and Low alarm

Posted: Sun Oct 27, 2024 12:05 pm
by brennyn21
This code below is only for the Reef Angel Star as it has a built in buzzer.

Code: Select all

if ( buzzer ) ReefAngel.BuzzerOn(2); else ReefAngel.BuzzerOff();
The RAPlus does not have a built in internal buzzer so you would need an external one and run it off one of the PWM Channels.
The code you would use is this below

Code: Select all

boolean buzzer=false;
if (ReefAngel.Params.Temp[T1_PROBE] >= 300 || ReefAngel.Params.Temp[T1_PROBE]<= 230) buzzer=true;
ReefAngel.PWM.SetDaylight( buzzer?0:100 ); // in this example I have it set on the Daylight Channel
Hope this helps.

Re: Buzzer for High and Low alarm

Posted: Mon Oct 28, 2024 7:20 am
by Appleseed
Thanks Brennyn, I didnt realise that the Plus didnt have a buzzer :)
Would any 12v buzzer work?

Re: Buzzer for High and Low alarm

Posted: Mon Oct 28, 2024 2:10 pm
by brennyn21
Yes 12v buzzer is fine

Re: Buzzer for High and Low alarm

Posted: Mon Oct 28, 2024 2:12 pm
by brennyn21
On a side note you can setup alerts in the Uapp to also notify you if a parameter goes out of your desired range

Re: Buzzer for High and Low alarm

Posted: Tue Oct 29, 2024 4:50 am
by Appleseed
brennyn21 wrote: Mon Oct 28, 2024 2:12 pm On a side note you can setup alerts in the Uapp to also notify you if a parameter goes out of your desired range
Thanks I already have but thought the buzzer would be an extra safe guard.