PMSLOPE QUESTION

Related to the development libraries, released by Curt Binder
Post Reply
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: PMSLOPE QUESTION

Post by divingdon »

The 6 Meanwell's are connected to 2 seperated timers on 2 different power strips what is plugged in on RA outlet 7 is the DC power supply which supplys the PWM volatage.

No I dont use the PC logging function I just put it into the sketch was I was having problems making the client 2.2 work correctly but that problem wasn't the fix so I will remove that line.

Any ideas why the timers maybe functioning incorrectly??
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PMSLOPE QUESTION

Post by rimai »

Try this code:

Code: Select all

// Autogenerated file by RAGen (v1.0.4.92), (08/25/2011 17:16)
// RA_082511_1716.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File: 
 #define wifi
 #define StandardLightSetup
 #define SIMPLE_MENU
 */


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

ReefAngel_TimerClass ParamTimer;



//Give labels to your PWM channels

#define WhitePWM1 0
#define BluePWM1 1
#define WhitePWM2 2
#define BluePWM2 3
#define WhitePWM3 4
#define BluePWM3 5

byte PWMChannel[]={
  0,0,0,0,0,0};



void setup()
{
  ReefAngel.Init(); //Initialize controller

  // Initialize and start the Parameter timer
  ParamTimer.SetInterval(15); // set interval to 15 seconds
  ParamTimer.Start();

  ReefAngel.FeedingModePorts = B00111111;
  ReefAngel.WaterChangePorts = B00111111;
  ReefAngel.OverheatShutoffPorts = B00110000;
  ReefAngel.LightsOnPorts = B11000100;

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

void loop()
{
  ReefAngel.ShowInterface();


  // Specific functions
  ReefAngel.StandardFan(Port4);
  ReefAngel.StandardHeater(Port5);
  ReefAngel.StandardHeater(Port6);
  // Setup relay 7 to turn on at 06:00aM and off at 10:15AM
  ReefAngel.StandardLights(7,06,45,22,00);
  ReefAngel.Relay.Write(); //Writes the value of RelayData to the RelayBox 

  // Setup relay 8 to turn on at 18:00PM and off at 00:00AM
  ReefAngel.StandardLights(8,18,0,00,00);
  ReefAngel.Relay.Write(); //Writes the value of RelayData to the RelayBox 

  //This section calculates the slope
  //calculate slope for 0 to 50% starting at 12:30pm with duration of 60min, then from 50% to 0 from 17:00pm with duration of 60min
  PWMChannel[WhitePWM1]=2.55*PWMSlope(06,45,21,00,14,35,60,PWMChannel[WhitePWM1]); 
  PWMChannel[BluePWM1]=2.55*PWMSlope(06,45,21,15,14,40,60,PWMChannel[BluePWM1]); 
  PWMChannel[WhitePWM2]=2.55*PWMSlope(06,46,21,00,14,35,60,PWMChannel[WhitePWM2]);
  PWMChannel[BluePWM2]=2.55*PWMSlope(06,46,22,00,14,40,60,PWMChannel[BluePWM2]); 
  PWMChannel[WhitePWM3]=2.55*PWMSlope(06,47,21,00,14,35,60,PWMChannel[WhitePWM3]);
  PWMChannel[BluePWM3]=2.55*PWMSlope(06,47,21,15,14,40,60, PWMChannel[BluePWM3]); 

  // this section sends the data to the PWM expansion module
  PWMExpansion(WhitePWM1,PWMChannel[WhitePWM1]);
  PWMExpansion(BluePWM1,PWMChannel[BluePWM1]);
  PWMExpansion(WhitePWM2,PWMChannel[WhitePWM2]);
  PWMExpansion(BluePWM2,PWMChannel[BluePWM2]);
  PWMExpansion(WhitePWM3,PWMChannel[WhitePWM3]);
  PWMExpansion(BluePWM3,PWMChannel[BluePWM3]);
}
void PWMExpansion(byte cmd, byte data)
{ 
  Wire.beginTransmission(2); // transmit to device #2
  Wire.send('$'); // sends $ 
  Wire.send('$'); // sends $ 
  Wire.send('$'); // sends $ 
  Wire.send(cmd); // sends a value 
  Wire.send(data); // sends 255 
  Wire.endTransmission(); // stop transmitting}
}
I think your problem was this:

Code: Select all

ReefAngel.StandardLights(7,06,0,22,15);
This line turns on at 6:00AM and off at 10:15PM
I think 14% still doesn't cut off your meanwells, so as long as the drivers have power, they were lighting up at 14%.
I change the above code to match the same as your PWMSlope schedule.
Roberto.
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: PMSLOPE QUESTION

Post by divingdon »

thanks I just load that sketch will 1 change I changed the starting PWM voltage from 1.4 to .8 to make sure the LEDs go off and I notice after loading that the red status light is staying lite??

any ideas
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PMSLOPE QUESTION

Post by rimai »

Don't see how the red status would stay on, but I did forget to remove some stuff. I don't know where I had my mind.
Updated:

Code: Select all

// Autogenerated file by RAGen (v1.0.4.92), (08/25/2011 17:16)
// RA_082511_1716.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File: 
#define wifi
#define StandardLightSetup
#define SIMPLE_MENU
*/


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

//Give labels to your PWM channels

#define WhitePWM1 0
#define BluePWM1 1
#define WhitePWM2 2
#define BluePWM2 3
#define WhitePWM3 4
#define BluePWM3 5

byte PWMChannel[]={
  0,0,0,0,0,0};



void setup()
{
  ReefAngel.Init(); //Initialize controller

  ReefAngel.FeedingModePorts = B00111111;
  ReefAngel.WaterChangePorts = B00111111;
  ReefAngel.OverheatShutoffPorts = B00110000;
  ReefAngel.LightsOnPorts = B11000100;

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

void loop()
{
  ReefAngel.ShowInterface();


  // Specific functions
  ReefAngel.StandardFan(Port4);
  ReefAngel.StandardHeater(Port5);
  ReefAngel.StandardHeater(Port6);
  // Setup relay 7 to turn on at 06:00aM and off at 10:15AM
  ReefAngel.StandardLights(7,06,45,22,00);

  // Setup relay 8 to turn on at 18:00PM and off at 00:00AM
  ReefAngel.StandardLights(8,18,0,00,00);

  //This section calculates the slope
  //calculate slope for 0 to 50% starting at 12:30pm with duration of 60min, then from 50% to 0 from 17:00pm with duration of 60min
  PWMChannel[WhitePWM1]=2.55*PWMSlope(06,45,21,00,14,35,60,PWMChannel[WhitePWM1]); 
  PWMChannel[BluePWM1]=2.55*PWMSlope(06,45,21,15,14,40,60,PWMChannel[BluePWM1]); 
  PWMChannel[WhitePWM2]=2.55*PWMSlope(06,46,21,00,14,35,60,PWMChannel[WhitePWM2]);
  PWMChannel[BluePWM2]=2.55*PWMSlope(06,46,22,00,14,40,60,PWMChannel[BluePWM2]); 
  PWMChannel[WhitePWM3]=2.55*PWMSlope(06,47,21,00,14,35,60,PWMChannel[WhitePWM3]);
  PWMChannel[BluePWM3]=2.55*PWMSlope(06,47,21,15,14,40,60, PWMChannel[BluePWM3]); 

  // this section sends the data to the PWM expansion module
  PWMExpansion(WhitePWM1,PWMChannel[WhitePWM1]);
  PWMExpansion(BluePWM1,PWMChannel[BluePWM1]);
  PWMExpansion(WhitePWM2,PWMChannel[WhitePWM2]);
  PWMExpansion(BluePWM2,PWMChannel[BluePWM2]);
  PWMExpansion(WhitePWM3,PWMChannel[WhitePWM3]);
  PWMExpansion(BluePWM3,PWMChannel[BluePWM3]);
}
void PWMExpansion(byte cmd, byte data)
{ 
  Wire.beginTransmission(2); // transmit to device #2
  Wire.send('$'); // sends $ 
  Wire.send('$'); // sends $ 
  Wire.send('$'); // sends $ 
  Wire.send(cmd); // sends a value 
  Wire.send(data); // sends 255 
  Wire.endTransmission(); // stop transmitting}
}
Roberto.
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: PMSLOPE QUESTION

Post by divingdon »

the whites just shut off @ 2019 just under 30 mins early
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: PMSLOPE QUESTION

Post by divingdon »

Sorry posted before I saw your new sketch I will download and try that..
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: PMSLOPE QUESTION

Post by divingdon »

loaded your sketch white LEDs still off and Status LED stilled turned on???
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PMSLOPE QUESTION

Post by rimai »

I think they are just going below the cutoff.
You better off leaving it above the cutoff and leaving it to be totally off when the relay turns the drivers off
.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PMSLOPE QUESTION

Post by rimai »

Do you have overheat setup on your features file?
I think that's the reason you are getting status led.
Roberto.
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: PMSLOPE QUESTION

Post by divingdon »

Roberto,

The status light issues is fixed but since i loaded the sketch you fixed for me I cant use the client software it doesn't connect. Did I do something wrong or is some code missing??
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PMSLOPE QUESTION

Post by rimai »

Can you post your features file?
Roberto.
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: PMSLOPE QUESTION

Post by divingdon »

// AutoGenerated file by RAGen (v1.0.4.92), (08/25/2011 17:53)

/*
* Copyright 2010 / Curt Binder
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


#ifndef __REEFANGEL_FEATURES_H__
#define __REEFANGEL_FEATURES_H__


#define wifi
#define StandardLightSetup
#define SIMPLE_MENU

#endif // __REEFANGEL_FEATURES_H__


that was all of it
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: PMSLOPE QUESTION

Post by rimai »

Everything seems correct.
Maybe the wifi got a different ip address while doing all the changes?
Roberto.
divingdon
Posts: 57
Joined: Tue Mar 22, 2011 8:35 pm

Re: PMSLOPE QUESTION

Post by divingdon »

IP was the same as before. Rebooted everything and now it works.

Thanks for your help.

Have you tried the optiboot upgrade with the homemade cable. I have one and I'm waiting to do the update.
Post Reply