PWM ports randomly gets on !

Basic / Standard Reef Angel hardware
Post Reply
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

PWM ports randomly gets on !

Post by Bo0sted_Rafi »

Hi to all.

Just curious about what happens inside the relay box because in 3 times randomly in 2 weeks my pwm ports gets on at 100% both. My lights are hooked to the ports and when I awake in the night, I saw the tank with the lights on at 4:30am. When that's happens, I unplug the relay box from the wall but when I connected again, still the lights on. To resolve this, I need to disconect the RA head unit from the serial port cable. It's like the system that actived the pwm gets stuck or something. Anyone experience this problem?how do I can solve this?

If my lights gets on in my next vacations, I can burn my corals at that power
Image
bencollinz
Posts: 140
Joined: Wed Mar 13, 2013 5:36 pm

Re: PWM ports randomly gets on !

Post by bencollinz »

post your code.
Image
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM ports randomly gets on !

Post by cosmith71 »

Do you mean the squarish VGA cable, or the flat TTY cable that you use to program?

--Colin
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: PWM ports randomly gets on !

Post by Bo0sted_Rafi »

the VGA cable disconnected its the only method i found to get the relay box to normal activity. Like a reboot.

Here its my 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
    int avgph[10];
    unsigned long totalavgph=0;
    byte avgindex=0;

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


    void setup()
    {
       // This must be the first line
       ReefAngel.Init(); //Initialize controller
       // Ports toggled in Feeding Mode
       ReefAngel.UseFlexiblePhCalibration();
       ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port5Bit | Port6Bit | Port3Bit;
       // Ports toggled in Water Change Mode
       ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port5Bit | Port6Bit | Port6Bit;
       // Ports toggled when Lights On / Off menu entry selected
       ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port6Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
       // 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( 830 );

       // Ports that are always on
       ReefAngel.Relay.On( Port1 );
       ReefAngel.Relay.On( Port5 );

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

       for (int a=0;a<10;a++) avgph[a]=analogRead(PHPin);

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

    void loop()
    {
       totalavgph=0;
       avgph[avgindex]=analogRead(PHPin);
       avgindex++;
       if (avgindex==10) avgindex=0;
       for (int a=0;a<10;a++)
       totalavgph+=avgph[a];
       totalavgph/=10;

       totalavgph=map(totalavgph, ReefAngel.PHMin, ReefAngel.PHMax, 700, 1000); // apply the calibration to the sensor reading
       totalavgph=constrain(totalavgph,100,1400);

       if (totalavgph <= 639) ReefAngel.Relay.Off(Port3);
       if (totalavgph >= 652) ReefAngel.Relay.On(Port3);

       ReefAngel.Relay.DelayedOn( Port2 );
       // ReefAngel.CO2Control( Port3,644,655 );
       ReefAngel.StandardFan( Port4,780,788 );
       ReefAngel.StandardLights( Port7,0,30,12,30 );
        ReefAngel.WavemakerRandom( Port6,1200,240 );
       ReefAngel.StandardLights( Port8,12,0,2,0 );
       ReefAngel.PWM.SetDaylight(PWMSlope(17,0,0,3,0,12,3,0));
       ReefAngel.PWM.SetDaylight(PWMSlope(18,30,22,33,12,45,3,ReefAngel.PWM.GetDaylightValue()));
       ReefAngel.PWM.SetActinic( PWMSlope(15,0,1,0,9,60,60,9) );
       ////// Place your custom code below here
       ////// Place your custom code above here

       // This should always be the last line
       ReefAngel.Portal( "Bo0sted_Rafi" );
       ReefAngel.ShowInterface();
    }
    void DrawCustomMain()
   {
  byte x = 6;
  byte y = 2;
  byte t;
  char text[7];
 

  ReefAngel.LCD.DrawDate(6, 2);
  ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
  pingSerial();
 
  ReefAngel.LCD.DrawText(0,255,3,17," Rafi's 75 Reef");
 


  pingSerial();

  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 6, 90, "--------------------");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 6, 126, "--------------------");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 93, "|");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 103, "|");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 113, "|");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 123, "|");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 93, "|");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 103, "|");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 113, "|");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 123, "|");
 


  ReefAngel.LCD.DrawText(0,255,10,30,"Display");
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawText(COLOR_BLACK, 255, 10, 40, text);
  pingSerial();

  ReefAngel.LCD.DrawText(0,255,90,30,"CA pH");
  ConvertNumToString(text, ReefAngel.Params.PH, 100);
  ReefAngel.LCD.DrawText(COLOR_BLACK, 255, 95, 40, text);
 
  pingSerial();

  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 77, TempRelay);

  pingSerial();
 
  ReefAngel.LCD.DrawText(0,255,8,100, "White");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255,15,119, ReefAngel.PWM.GetDaylightValue());
 
  ReefAngel.LCD.DrawText(0,255,88,100, "Blue");
  ReefAngel.LCD.DrawText(COLOR_BLACK,255,90,119, ReefAngel.PWM.GetActinicValue());
 

}
    void DrawCustomGraph()
    {
    }
Image
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: PWM ports randomly gets on !

Post by Bo0sted_Rafi »

Still have this problem! The white ports gets on randomly and if I disconnect the VGA cable, gets the actinic a lights on too. The method to resolve the problem it's unplug the VGA cable, disconnect from the wall the relay box, connected again the relay box and then connect the VGA cable and then the lights gets to normal. It's possible a internal problem in the relay box?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PWM ports randomly gets on !

Post by rimai »

Try changing this:

Code: Select all

       ReefAngel.PWM.SetDaylight(PWMSlope(17,0,0,3,0,12,3,0));
       ReefAngel.PWM.SetDaylight(PWMSlope(18,30,22,33,12,45,3,ReefAngel.PWM.GetDaylightValue()));
To this:

Code: Select all

       ReefAngel.PWM.SetDaylight(PWMSlope(18,30,22,33,12,45,3,0));
Roberto.
Bo0sted_Rafi
Posts: 75
Joined: Thu Mar 21, 2013 12:11 pm

Re: PWM ports randomly gets on !

Post by Bo0sted_Rafi »

What's the difference? I need the code to start my lights at 5pm
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PWM ports randomly gets on !

Post by rimai »

Check this link for the info on what the parameters are and you can adjust yourself to whatever you want:
http://www.easte.net/RA/html/_globals_8 ... bf4e544482
Roberto.
bencollinz
Posts: 140
Joined: Wed Mar 13, 2013 5:36 pm

Re: PWM ports randomly gets on !

Post by bencollinz »

Bo0sted_Rafi wrote:What's the difference? I need the code to start my lights at 5pm
just try it and see if it resolves something. change 18,30 to 17,0
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: PWM ports randomly gets on !

Post by lnevo »

I remember this code...we were trying to do something weird with the schedule...you wanted two slopes right?

It was a slope and then another slope than flat till night then decrease and then decrease again...
Post Reply