Lunar hub dimming

Expansion modules and attachments
Post Reply
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Lunar hub dimming

Post by Dctrojan »

I am running the lunar dimmable hub with 2 moonlights they are plugged into the high ato port . I was windering if there was a way to manually dim them.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Lunar hub dimming

Post by rimai »

You mean, with a potentiometer?
Roberto.
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Re: Lunar hub dimming

Post by Dctrojan »

Sorry didnt mean manually. Wasnt sure what I was thinking. I mean is there a way I can dim them with my phone not just have them dim according to the moon?

Sent from my SAMSUNG-SGH-I337 using Tapatalk
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Lunar hub dimming

Post by rimai »

Have you used the android app and are you comfortable with using internal memory settings yet?
We can code it to do that, but you need a way to tell the controller what the % of dimming that you want, instead of moonphase.
Easiest way is to use the internal memory.
Roberto.
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Re: Lunar hub dimming

Post by Dctrojan »

Yes I think im getting alot better at this and starting to understand . The android app im using allows me to monitor and change the relays but I cant change the dimmer. Ive looked at the internal memory writing feature on the app but im completely clueless to write it without the wizard especially to the lowato port im using. Ive been reading about adding custom menus . Would this be possible to add a custom menu so I can change the dimmer effect with the menu on the app?

Sent from my SAMSUNG-SGH-I337 using Tapatalk
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Re: Lunar hub dimming

Post by Dctrojan »

Plus I would like to compliment you and the forum for all the support. Not many other companies have this kind of support.

Sent from my SAMSUNG-SGH-I337 using Tapatalk
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Lunar hub dimming

Post by rimai »

So, let's use one memory location.
Use this instead:

Code: Select all

  pinMode(lowATOPin,OUTPUT);
  if (InternalMemory.LEDPWMActinic_read()<=100)
    analogWrite(lowATOPin,InternalMemory.LEDPWMActinic_read()*2.55);
  else
    analogWrite(lowATOPin,MoonPhase()*2.55);
Then, using the android app, go to internal memory and look for LEDPWMActinic in the list.
If you write a value from 0-100, it will override the port to whatever you choose. Any value from 101-255 will place the port on moonphase cycle.
Roberto.
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Re: Lunar hub dimming

Post by Dctrojan »

Thats what I like to see . Thank yoj so much as soon as I get out of class im going to add this.

Sent from my SAMSUNG-SGH-I337 using Tapatalk
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Re: Lunar hub dimming

Post by Dctrojan »

Could a custom menu be added in the future to control this function later on?

Sent from my SAMSUNG-SGH-I337 using Tapatalk
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Lunar hub dimming

Post by rimai »

Although you can, it requires a lot of code to do this in the controller itself.
We can easily do a preset %, so you can choose the menu choice and it would go to that % and choose the menu again to put back into moonphase.
Roberto.
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Re: Lunar hub dimming

Post by Dctrojan »

Hmm sounds like a plan in the future. as im learning more about this coding stuff. Is there any resource you would recommend that has a list of all the code functions ?

Sent from my SAMSUNG-SGH-I337 using Tapatalk
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Re: Lunar hub dimming

Post by Dctrojan »

ok heres what I coded:

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 <Humidity.h>
#include <DCPump.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 = Port5Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port5Bit | Port6Bit | Port7Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port8Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


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

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

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

void loop()
{
    ReefAngel.MoonLights( Port2 );
    ReefAngel.DayLights( Port3 );
    ReefAngel.ActinicLights( Port4 );
    ReefAngel.WavemakerRandom1( Port5,10,60 );
    ReefAngel.WavemakerRandom2( Port6,5,10 );
    ReefAngel.SingleATOHigh( Port7 );
    ReefAngel.StandardHeater( Port8 );
    ReefAngel.PWM.ActinicPWMSlope();
    ReefAngel.PWM.Channel0PWMSlope();
    ReefAngel.PWM.Channel1PWMSlope();
    ReefAngel.PWM.Channel2PWMSlope();
    ReefAngel.PWM.Channel3PWMSlope();
    ReefAngel.PWM.Channel4PWMSlope();
    ////// Place your custom code below here
  pinMode(lowATOPin,OUTPUT);
  if (InternalMemory.LEDPWMActinic_read()<=100)
    analogWrite(lowATOPin,InternalMemory.LEDPWMActinic_read()*2.55);
  else
    analogWrite(lowATOPin,MoonPhase()*2.55); 

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

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

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Dimming Expansion
    x = 15;
    y = 2;
    for ( int a=0;a<6;a++ )
    {
      if ( a>2 ) x = 75;
      if ( a==3 ) y = 2;
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
      y += 10;
    }
    pingSerial();

    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 39, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 39, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // pH Expansion
    ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,15,76, "PHE:" );
    ReefAngel.LCD.DrawSingleMonitor( ReefAngel.Params.PHExp,COLOR_MEDIUMSEAGREEN,39,76, 100 );    
    pingSerial();

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
}/code]

However, I cant change the setting back to moonlight dimmer using internal memory on my controller. I can control the brightness of the lunar module from 0-100 but when i type in 101 it tells me only values 0-100 available.
User avatar
Dctrojan
Posts: 96
Joined: Wed Oct 16, 2013 9:50 am

Re: Lunar hub dimming

Post by Dctrojan »

?

Sent from my SAMSUNG-SGH-I337 using Tapatalk
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Lunar hub dimming

Post by rimai »

Whenever you pick a memory location, it shows the position right underneath it.
You can use that location number and pick custom to change it for more than 100.
Roberto.
dapg8gt
Posts: 104
Joined: Tue Apr 16, 2013 7:33 pm
Location: 650 Bay Area..

Re: Lunar hub dimming

Post by dapg8gt »

So what would I replace in the above code if I was using the Actinic channel on the relay box to be able to control it thru the Android app? And does it go into the custom code lines?

I am not sure I even have it right the way I hooked it up today didn't see a reference to the lunar hub in the wizard so I guessed by hitting moon phase in the Actinic dimming type it will automatically do it. Is that right?
My other hobby has 450rwhp and eats tires instead of mysis!
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Lunar hub dimming

Post by rimai »

Yeap. It will adjust the channel according to the moon cycle for that day.
Roberto.
Post Reply