smoothing out led dimming

Requests for new functions or software apps

Posts: 144
Joined: Tue Aug 14, 2012 1:11 pm
PostPosted: Wed Nov 04, 2015 4:37 pm
is there a way to smoooth out the dimming?

I have the pwm expansion running ldd drivers.

you can see the steps as it dims, Id like to smooth it out so it slowly drops down like the sun rather step down... is this possible?
Adam
58 Gal
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Nov 04, 2015 7:14 pm
As long as its not a really old dimming expansion you should be able to use the new highres dimming that gives us 4096 steps instead of 256. Can you post your code? When was the last time you updated your libraries and ra?
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Nov 04, 2015 7:15 pm
Even with the older module you'll actually get 256 steps rather than 100, which is still a big increase :)

Posts: 144
Joined: Tue Aug 14, 2012 1:11 pm
PostPosted: Thu Nov 05, 2015 6:13 am
this is whats in there now, but will be changing it soon eliminated the dc pump as it doesnt work, stuck on constant 30% never changed.

and adding delay to when certain channels start coming on for sun rise effect.
I built a new 180gal 48x30x30 tank and large sump with new equipment. so codes needs to be redone.

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 <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
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddMultiChannelWaterLevelExpansion();  // Water Level Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port4Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port4Bit | Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    ReefAngel.UseFlexiblePhCalibration();
    ReefAngel.DCPump.FeedingSpeed=30;
    ReefAngel.DCPump.WaterChangeSpeed=0;
    ReefAngel.DCPump.ActinicChannel=Sync; // Now you're pump will be affected by the portal settings.

    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );
    ReefAngel.Relay.On( Box1_Port3 );
    ReefAngel.Relay.On( Box1_Port4 );
    ReefAngel.Relay.On( Box1_Port5 );
    ReefAngel.Relay.On( Box1_Port6 );
    ReefAngel.Relay.On( Box1_Port7 );
    ReefAngel.Relay.On( Box1_Port3 );
    ////// Place additional initialization code below here
     //Use PH Flexible Calibration
    ReefAngel.UseFlexiblePhCalibration(); 


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

    void loop()
    {
    ReefAngel.Relay.DelayedOn( Port2 );
    ReefAngel.StandardHeater( Port3 );

    ReefAngel.Wavemaker1( Port5 );
    ReefAngel.DayLights( Port8 );
    ReefAngel.PWM.Channel0PWMSlope();
    ReefAngel.PWM.Channel1PWMSlope();
    ReefAngel.PWM.Channel2PWMSlope();
    ReefAngel.PWM.Channel3PWMSlope();
    ReefAngel.PWM.Channel4PWMSlope();
    ////// Place your custom code below here
    // Add random mode if we set to Mode to Custom in portal
    static int rmode;
    static boolean changeMode=true;


    // These are the modes we can cycle through. You can add more and even repeat...
    byte modes[] = { ReefCrest, Lagoon, Constant, TidalSwell, ShortPulse, LongPulse, Else, Gyre };

    if (now()%SECS_PER_DAY==0 || changeMode==true) { // Change at midnight or if controller rebooted
    rmode=random(100)%sizeof(modes); // Change the mode once per day to pick from our array
    changeMode=false;
    }

    // Set timer when in feeding mode
    static unsigned long feeding;
    if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
   
    if (now()-feeding<3600) {
    // Continue NTM for the 60 minutes
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
    ReefAngel.DCPump.Mode=NutrientTransport;
    } else if (now()%SECS_PER_DAY<43200 || now()%SECS_PER_DAY>=79200) { // 12pm / 10pm
    // Night mode (go to 30%)
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
    ReefAngel.DCPump.Mode=Constant;
    ReefAngel.DCPump.Speed=30;
    } else if (InternalMemory.DCPumpMode_read()==11) {
    // Custom Mode and nothing else going on
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
    ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode :)
    ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
    } else {
    ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
    }
    ////// Place your custom code above here

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

Adam
58 Gal
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Thu Nov 05, 2015 6:41 am
Good news. The code you are using will support the high resolution dimming. You just need to make sure you're on the latest libraries and re-upload. You should get either double or ~400x resolution.

Posts: 144
Joined: Tue Aug 14, 2012 1:11 pm
PostPosted: Sat Nov 07, 2015 6:51 am
so simply updating the libs and uploading the new code will give me the better resolution on dimming?
Adam
58 Gal
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sat Nov 07, 2015 3:20 pm
It should. It was added into the last release and should be transparent based on your code.

Posts: 12273
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Nov 08, 2015 8:29 pm
I think he will need a code change.
Roberto.
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Nov 08, 2015 8:48 pm
Why? He'a using ReefAngel.PWM.ChannelXSlope() those functions call the HighRes functions behind the scenes. What code would need to change?

Posts: 12273
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Nov 08, 2015 8:52 pm
It calls the high res behind the scenes, but the resolution is still 0-100 steps, which gets upscaled, I think.
He would need to use the raw numbers 0-4096 to be able to take advantage of the high resolution.
Roberto.
Next

Return to Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron