Page 1 of 1

Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 5:06 pm
by kahlif
So we were hooking up my RA+ that I bought a while back and I am having an issue.

I have the RA plugged into the Relay box, then USB to the expansion hub, then USB to the relay expansion module, then serial to the 2nd Relay box. I believe that is how it is all wired.

On the RA LCD, I see the 2nd Relay, and it says port 1 (Kessil) is on, but it doesn't actually power on. As far as I see, none of the ports come on. I left the relay expansion set to all 3 switches off, which should be #1. Was that right?

Any idea?

My code is here:

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 <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 = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit;
    ReefAngel.FeedingModePortsE[0] = Port3Bit | Port4Bit | Port5Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = Port3Bit | Port4Bit | Port5Bit | Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit;
    ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit | Port8Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port1Bit | Port2Bit;
    // 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( Port7 );
    ReefAngel.Relay.On( Box1_Port7 );
  ReefAngel.Relay.On(Port5);
  ReefAngel.Relay.On(Port6);
  ReefAngel.Relay.On(Box1_Port5);
  ReefAngel.Relay.On(Box1_Port6);

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

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

void loop()
{
    ReefAngel.StandardLights( Port1,11,0,19,0 );
    ReefAngel.StandardLights( Port2,19,0,11,0 );
    ReefAngel.StandardHeater( Port8,770,790 );
    ReefAngel.StandardLights( Box1_Port1,11,0,19,0 );
    ReefAngel.StandardATO( Box1_Port3,60 );
    ////// Place your custom code below here

// Actinic lights - BEGIN
  // Sunrise
  ReefAngel.StandardLights(Box1_Port2,8,0,9,30);
  //Sunset
  ReefAngel.StandardLights(Box1_Port2,18,30,20,0);

  // 15min interval
  ReefAngel.StandardLights(Box1_Port2,10,15,10,30);
  ReefAngel.StandardLights(Box1_Port2,11,30,11,45);
  ReefAngel.StandardLights(Box1_Port2,13,0,13,15);
  ReefAngel.StandardLights(Box1_Port2,14,15,14,30);
  ReefAngel.StandardLights(Box1_Port2,15,0,15,15);
  ReefAngel.StandardLights(Box1_Port2,16,15,16,30);
  ReefAngel.StandardLights(Box1_Port2,17,15,17,30);
// Actinic lights - END

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

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

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

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

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

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

void DrawCustomGraph()
{
    ReefAngel.LCD.DrawGraph( 5, 5 );
}

Re: Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 5:27 pm
by rimai
How long ago was it?
Can you check if you have all 3 jumpers plugged in on your head unit?

Re: Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 7:00 pm
by kahlif
Bought it in September (I am the one getting the new LCD screen that Jess showed you).

I need to look at the jumpers. Are those in a manual somewhere? I don't think I saw that...

Re: Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 7:43 pm
by kahlif
Here is a shot of the board...

Image

Re: Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 7:59 pm
by rimai
Ok, the jumpers are there.
So, upload the attached ino code to RA.
Then, open Serial monitor on menu Tools->Serial Monitor.
Make sure you have 57600 baud selected.
If you don't see anything in the window, reboot RA.
Copy and paste what you get in the Serial monitor.

Re: Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 8:10 pm
by kahlif
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
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

Re: Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 8:13 pm
by rimai
The controller is not seeing the module.
The address of the #1 expansion module is 38.
Can you try the same thing without the hub?

Re: Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 8:19 pm
by kahlif
Jeez, basic troubleshooting....

As soon as I plugged the USB from the Relay Expansion module into the main relay, everything turned on...

The expansion hub is not working then....

One question, is there a power supply needed for it? I see an AC adapter port, but it didn't come with one...

Re: Expansion hub with Relay expansion problems

Posted: Wed Jan 16, 2013 8:55 pm
by rimai
Humm..
Maybe you got one of the older models that required AC adapter.
I'll send you the correct one with the other item.

Re: Expansion hub with Relay expansion problems

Posted: Sat Jan 19, 2013 1:19 pm
by kahlif
So I got the replacement...

Interestingly, now with the new hub, I see the LED display (which works now!) with 16 ports, and the right ports are on, but the second relay box is not actually turning ports on.

What else can it be?

Re: Expansion hub with Relay expansion problems

Posted: Sat Jan 19, 2013 1:26 pm
by rimai
So, is it still doing the same thing?

Re: Expansion hub with Relay expansion problems

Posted: Sat Jan 19, 2013 2:16 pm
by kahlif
Yes. The ports say they are on, but nothing comes on. If I connect it directly, it works.

Re: Expansion hub with Relay expansion problems

Posted: Sat Jan 19, 2013 3:44 pm
by kahlif
Interestingly, the water level expansion, connected through the hub, works perfectly...

Code: Select all

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       
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 found!	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

Re: Expansion hub with Relay expansion problems

Posted: Sat Jan 19, 2013 4:00 pm
by rimai
Weird.
Yes, 4F is the water level module.
Can you try swapping cables?
You mentioned that you got the controller to see the relay expansion by plugging it in directly to the relay box, right?
Does it show address 38 found and box works like it should?

Re: Expansion hub with Relay expansion problems

Posted: Sat Jan 19, 2013 4:04 pm
by kahlif
When you say swap cables, which do you mean? I bought new USB cables, and tried all the combos of them. I also tried those cables on a digital camera to validate functionality.

I tried swapping the serial cables, but no change.

Yes, if I plug the relay expansion directly to the main relay box, 38 is found and ports function as normal...

Re: Expansion hub with Relay expansion problems

Posted: Sat Jan 19, 2013 4:42 pm
by kahlif
Guess what!

I figured out what was wrong...

The reason this was weird, is because the issue is intermittent. The USB port on the Relay Expansion box seems to be loose, so wiggling the USB cable turns it on.

It is working now!

Re: Expansion hub with Relay expansion problems

Posted: Wed Jul 17, 2013 6:37 pm
by rossbryant1956
are these memory locations (38, 3C, etc.) and a map of what should be expected if we are looking for something. Thz

Re: Expansion hub with Relay expansion problems

Posted: Wed Jul 17, 2013 8:41 pm
by rimai
Yes, address 38 is the first relay box.
It goes from 38 to 3f for the eight possible expansion boxes.

Re: Expansion hub with Relay expansion problems

Posted: Thu Jul 18, 2013 4:26 am
by rossbryant1956
so 38
addr: 39 addr: 3A addr: 3B addr: 3C
addr: 3D addr: 3E addr: 3F

?

Re: Expansion hub with Relay expansion problems

Posted: Thu Jul 18, 2013 9:08 am
by rimai
In your other thread you posted you had address 3C found.
What happened to it?