Dimming module not working

Basic / Standard Reef Angel hardware
Post Reply
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Dimming module not working

Post by 00Warpig00 »

Roberto,

I got my Meanwell LPF (LPF-90D-36) series drivers today which are three in one dimming (potentiometer/0-10V Analog/10V PWM) choose one. When I ordered my RA+ you customized a Dimming module for me to run channels 0/1/2 (PWM) and 3/4/5 (Analog). I'm probably doing something wrong but it seems as if the module does not work. I have tried hooking up my Dim+/- leads observing proper polarity and I get a fairly dim output from the LED's. I have tested the drivers by shorting and opening the dim +/- leads. Shorted shuts LED's off completely open turns LED's on 100%. When hooked up to the Dimming module I get a mostly dim output. I tried ports 0 and 3 and get the same results. If I pull the dim +/- wires off the dimming module and hook them to a AAA battery the light output from the drivers seems about half of the brightness from the dimming module. I did some testing with slopes and parabola on channels 0/3 and noticed no change in brightness at all during my test period. I have attached my test code.

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 <ReefAngel.h>

// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;
byte atoflag=0;

////// 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 = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port3Bit | Port4Bit;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port4Bit | Port5Bit | Port6Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 850 );


    // Ports that are always on
    ReefAngel.Relay.On( Port3 );
    ReefAngel.Relay.On( Box1_Port5 );
    ReefAngel.Relay.On( Box1_Port6 );
    ReefAngel.Relay.On( Box1_Port7 );

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

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

void loop()
{
    ReefAngel.StandardFan( Port1,790,820 );
    ReefAngel.StandardATO( Port2,60 );
    ReefAngel.Relay.DelayedOn( Port4,5 );
    ReefAngel.WavemakerRandom( Port5,30,100 );
    ReefAngel.StandardHeater( Port6,750,760 );
    ReefAngel.StandardLights( Box1_Port1,7,5,19,50 );
    ReefAngel.StandardLights( Box1_Port2,7,5,19,50 );
    ReefAngel.StandardHeater( Box1_Port3,750,760 );
    ReefAngel.StandardHeater( Box1_Port4,750,760 );
    ReefAngel.PWM.SetChannel( 0, PWMParabola(23,0,23,15,1,100,1) );
    ReefAngel.PWM.SetChannel( 1, PWMParabola(23,0,23,15,0,100,0) );
    ReefAngel.PWM.SetChannel( 2, PWMSlope(0,1,10,0,0,100,1,0) );
    ReefAngel.PWM.SetChannel( 3, PWMSlope(23,30,23,40,0,100,5,0) );
    overheatflag = InternalMemory.read( Overheat_Exceed_Flag );
    atoflag = InternalMemory.read( ATO_Exceed_Flag );
    buzzer = overheatflag + atoflag;
    if ( buzzer >= 1 ) buzzer = 100;
    ReefAngel.PWM.SetDaylight( buzzer );
    ReefAngel.PWM.SetActinic( buzzer );

    ////// Place your custom code below here
    

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

    // This should always be the last line
    ReefAngel.Portal( "00Warpig00" );
    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();

    // I/O Expansion
    byte bkcolor;
    x = 14;
    y = 34;
    for ( int a=0;a<6;a++ )
    {
      ReefAngel.LCD.DrawCircleOutline( x+(a*20),y,4,COLOR_MEDIUMORCHID );
      if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; else bkcolor=COLOR_GRAY;
      ReefAngel.LCD.FillCircle( x+(a*20),y,2,bkcolor );
    }
    pingSerial();

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

    // Salinity
    ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,15,76, "SAL:" );
    ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,39,76, ReefAngel.Params.Salinity );
    pingSerial();

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

    // Relay Expansion
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 12, 104, TempRelay );
    pingSerial();

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

void DrawCustomGraph()
{
}


I have measured my voltage with my DVM on all 6 of the Dimming module ports and they all read about 3.8V DC no matter what my dimming percentage displays on the RA+ display or on the Portal. I have also made sure I have the 12V included supply connected to the dimming module. I noticed when I unplug the power from the dimming module the LED's get a little bit brighter and when I plug the 12V adapter back in the brightness goes back down to where it was. i also noticed that when I unplug the data cable and plug it back in to the dimming module the LED brightness goes way up for a second or two then goes back down by itself to where it was.

Not sure what is going on and it may be something else in my code. Any Ideas anyone has would be helpful.

Thanks

Nick
180G FOWLR
20GH QT#1
29G QT#2

Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dimming module not working

Post by rimai »

Load this code with the module plugged in.

Code: Select all

/**
 * I2CScanner.pde -- I2C bus scanner for Arduino
 *
 * 2009, Tod E. Kurt, http://todbot.com/blog/
 *
 */

#include "Wire.h"
extern "C" { 
#include "utility/twi.h"  // from Wire library, so we can do bus scanning
}

// Scan the I2C bus between addresses from_addr and to_addr.
// On each address, call the callback function with the address and result.
// If result==0, address was found, otherwise, address wasn't found
// (can use result to potentially get other status on the I2C bus, see twi.c)
// Assumes Wire.begin() has already been called
void scanI2CBus(byte from_addr, byte to_addr, 
void(*callback)(byte address, byte result) ) 
{
  byte rc;
  byte data = 0; // not used, just an address to feed to twi_writeTo()
  for( byte addr = from_addr; addr <= to_addr; addr++ ) {
    rc = twi_writeTo(addr, &data, 0, 1, true);
    callback( addr, rc );
  }
}

// Called when address is found in scanI2CBus()
// Feel free to change this as needed
// (like adding I2C comm code to figure out what kind of I2C device is there)
void scanFunc( byte addr, byte result ) {
  Serial.print("addr: ");
  Serial.print(addr,HEX);
  Serial.print( (result==0) ? " found!":"       ");
  Serial.print( (addr%4) ? "\t":"\n");
}


byte start_address = 1;
byte end_address = 128;

// standard Arduino setup()
void setup()
{
  Wire.begin();
  pinMode(7,OUTPUT);
  Serial.begin(57600);
  Serial.println("\nI2CScanner ready!");

  Serial.print("starting scanning of I2C bus from ");
  Serial.print(start_address,DEC);
  Serial.print(" to ");
  Serial.print(end_address,DEC);
  Serial.println("...");

  // start the scan, will call "scanFunc()" on result from each address
  scanI2CBus( start_address, end_address, scanFunc );

  Serial.println("\ndone");
}

// standard Arduino loop()
void loop() 
{
  // Nothing to do here, so we'll just blink the built-in LED
  digitalWrite(7,HIGH);
  delay(300);
  digitalWrite(7,LOW);
  delay(300);
}
Go to menu Tools->Serial Monitor
Make sure that you have 57600 baud
Reboot the controller if it doesn't do when you open Serial Monitor.
Paste here what you get printed in the screen.
Roberto.
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Dimming module not working

Post by 00Warpig00 »

RESULTS connected as follows... Dimming Module-->Expansion Hub-->Primary relay box

I2CScanner ready!
starting scanning of I2C bus from 1 to 128...
addr: 1 addr: 2 addr: 3 addr: 4
addr: 5 addr: 6 addr: 7 addr: 8 found!
addr: 9 addr: A addr: B addr: C
addr: D addr: E addr: F addr: 10
addr: 11 addr: 12 addr: 13 addr: 14
addr: 15 addr: 16 addr: 17 addr: 18
addr: 19 addr: 1A addr: 1B addr: 1C
addr: 1D addr: 1E addr: 1F addr: 20 found!
addr: 21 addr: 22 addr: 23 addr: 24
addr: 25 addr: 26 addr: 27 addr: 28
addr: 29 addr: 2A addr: 2B addr: 2C
addr: 2D addr: 2E addr: 2F addr: 30
addr: 31 addr: 32 addr: 33 addr: 34
addr: 35 addr: 36 addr: 37 addr: 38 found!
addr: 39 addr: 3A addr: 3B addr: 3C
addr: 3D addr: 3E addr: 3F addr: 40
addr: 41 addr: 42 addr: 43 addr: 44
addr: 45 addr: 46 addr: 47 addr: 48
addr: 49 addr: 4A addr: 4B addr: 4C
addr: 4D addr: 4E addr: 4F addr: 50 found!
addr: 51 addr: 52 addr: 53 addr: 54 found!
addr: 55 addr: 56 addr: 57 addr: 58
addr: 59 addr: 5A addr: 5B addr: 5C
addr: 5D addr: 5E addr: 5F addr: 60
addr: 61 addr: 62 addr: 63 addr: 64
addr: 65 addr: 66 addr: 67 addr: 68 found!
addr: 69 addr: 6A addr: 6B addr: 6C
addr: 6D addr: 6E addr: 6F addr: 70
addr: 71 addr: 72 addr: 73 addr: 74
addr: 75 addr: 76 addr: 77 addr: 78
addr: 79 addr: 7A addr: 7B addr: 7C
addr: 7D addr: 7E addr: 7F addr: 80

done



RESULTS connected as follows... Dimming Module-->Primary relay box

I2CScanner ready!
starting scanning of I2C bus from 1 to 128...
addr: 1 addr: 2 addr: 3 addr: 4
addr: 5 addr: 6 addr: 7 addr: 8 found!
addr: 9 addr: A addr: B addr: C
addr: D addr: E addr: F addr: 10
addr: 11 addr: 12 addr: 13 addr: 14
addr: 15 addr: 16 addr: 17 addr: 18
addr: 19 addr: 1A addr: 1B addr: 1C
addr: 1D addr: 1E addr: 1F addr: 20 found!
addr: 21 addr: 22 addr: 23 addr: 24
addr: 25 addr: 26 addr: 27 addr: 28
addr: 29 addr: 2A addr: 2B addr: 2C
addr: 2D addr: 2E addr: 2F addr: 30
addr: 31 addr: 32 addr: 33 addr: 34
addr: 35 addr: 36 addr: 37 addr: 38
addr: 39 addr: 3A addr: 3B addr: 3C
addr: 3D addr: 3E addr: 3F addr: 40
addr: 41 addr: 42 addr: 43 addr: 44
addr: 45 addr: 46 addr: 47 addr: 48
addr: 49 addr: 4A addr: 4B addr: 4C
addr: 4D addr: 4E addr: 4F addr: 50 found!
addr: 51 addr: 52 addr: 53 addr: 54 found!
addr: 55 addr: 56 addr: 57 addr: 58
addr: 59 addr: 5A addr: 5B addr: 5C
addr: 5D addr: 5E addr: 5F addr: 60
addr: 61 addr: 62 addr: 63 addr: 64
addr: 65 addr: 66 addr: 67 addr: 68 found!
addr: 69 addr: 6A addr: 6B addr: 6C
addr: 6D addr: 6E addr: 6F addr: 70
addr: 71 addr: 72 addr: 73 addr: 74
addr: 75 addr: 76 addr: 77 addr: 78
addr: 79 addr: 7A addr: 7B addr: 7C
addr: 7D addr: 7E addr: 7F addr: 80

done
180G FOWLR
20GH QT#1
29G QT#2

Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dimming module not working

Post by rimai »

They both show that the controller is seeing the module... addr: 8 found!
So, it's got to be something else.
Can you check voltage on the 12VDC power supply?
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dimming module not working

Post by rimai »

Also, what kind of voltage you get with this code?

Code: Select all

#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

void setup()
{
  ReefAngel.Init();  
}

void loop()
{
  ReefAngel.PWM.SetDaylight(0);
  ReefAngel.PWM.SetActinic(0);
  ReefAngel.PWM.SetChannel( 0, 100 );
  ReefAngel.PWM.SetChannel( 1, 100 );
  ReefAngel.PWM.SetChannel( 2, 100 );
  ReefAngel.PWM.SetChannel( 3, 100 );    
  ReefAngel.ShowInterface();
}
Roberto.
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Dimming module not working

Post by 00Warpig00 »

rimai wrote:They both show that the controller is seeing the module... addr: 8 found!
So, it's got to be something else.
Can you check voltage on the 12VDC power supply?

I am questioning the batteries and/or calibration on my DVM right this minute but here is what I got. I tested both AC adapters that came with my RA purchase as well as one other 12V AC adapter I have laying around and have similar results.

AC Adapter 9.4 VDC

Dimming Module Port 0 7.1 VDC
Dimming Module Port 1 7.1 VDC
Dimming Module Port 2 7.1 VDC
Dimming Module Port 3 7.1 VDC
Dimming Module Port 4 1.8 VDC
Dimming Module Port 5 1.8 VDC
180G FOWLR
20GH QT#1
29G QT#2

Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dimming module not working

Post by rimai »

Humm...
Can you get another meter?
Roberto.
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Dimming module not working

Post by 00Warpig00 »

I was right to question my meter. Replaced the batteries, no luck. My bench meter needs recalibration at best and replacement at worst. Not sure what happened to my bench meter it was fine a few months ago when I used it last. Glad my electronics BS detector was on guard on this one... Things didnt add up with my bench meter... lol. Anyway, I went out today and bought a cheap portable digital meter. Here are my new results.

AC Adapter 12.25 VDC

Dimming Module Port 0 9.55 VDC
Dimming Module Port 1 9.55 VDC
Dimming Module Port 2 9.55 VDC
Dimming Module Port 3 9.55 VDC
Dimming Module Port 4 0 VDC
Dimming Module Port 5 0 VDC

did some more testing around

loaded the following code

Code: Select all

#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

void setup()
{
  ReefAngel.Init(); 
}

void loop()
{
  ReefAngel.PWM.SetDaylight(0);
  ReefAngel.PWM.SetActinic(0);
  ReefAngel.PWM.SetChannel( 0, 100 );
  ReefAngel.PWM.SetChannel( 1, 80 );
  ReefAngel.PWM.SetChannel( 2, 60 );
  ReefAngel.PWM.SetChannel( 3, 40 );
  ReefAngel.PWM.SetChannel( 4, 20 );
  ReefAngel.PWM.SetChannel( 5, 1 );
  ReefAngel.ShowInterface();
}
here are those results

Dimming Module Port 0 9.55 VDC
Dimming Module Port 1 7.63 VDC
Dimming Module Port 2 5.74 VDC
Dimming Module Port 3 3.82 VDC
Dimming Module Port 4 1.91 VDC
Dimming Module Port 5 83.2 mVDC

So it appears as if the module is working fine, or at least the voltage output is. I dont have a scope at home to test PWM. Going to go from the test code back to my regular load on the RA and test some more.

Nick
180G FOWLR
20GH QT#1
29G QT#2

Image
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Dimming module not working

Post by 00Warpig00 »

Things seem to be mostly working while hooked up to the the Analog Ports on the Dimming module. Not working hooked up to the PWM ports on the dimming module. The Drivers are LPF-90D-36. With MeanWell drivers the D normally means analog dimming however the spec sheet http://www.meanwell.com/search/LPF-90D/LPF-90D-spec.pdf clearly states the driver supports a 3 in 1 dimming feature with one option being 10V PWM 100hz - 3Khz. The PWM dimming does not seem to work with the RA+ (maybe I'm missing something) but the Dimming module PWM ports basically turn the dimmer up from .5V to ~3.5V and then sticks @~3.5V never dims or brightens any more or less. The analog ports on my Dimming module seem to work with the driver pretty well but will not drop the dimming channel drive for the dimmer below 500mv while hooked up to the driver's dim leads. If I remove the dim leads from the Modules ports the ports go all the way down to 85mv. I have not noticed the driver turning the LED's OFF even when RA+ sets the dim channel at 1% (probably due to the 500mv that remains on the port and therefore the dim leads) I am pretty sure the Driver can dim the LED's more before they turn off but need to find a way to give the drivers a variable voltage from 0- 500mv to see what happens across the dim leads.

Nick
180G FOWLR
20GH QT#1
29G QT#2

Image
Post Reply