Page 1 of 1

Second dimming expansion not responding

Posted: Fri Mar 05, 2021 10:26 pm
by tngo
Hi.

I'm trying to get a 2nd dimming expansion to work on an existing system. I shorted the jumper ID, and added to setup:
ReefAngel.Add16ChPWM();

Added into the loop:
ReefAngel.PWM.Set16Channel(0,100);

I checked the voltage across the ground and port 0 but it still shows 0 volts. Other ports are also not responding. However if I remove the jumper the dimming expansion will mimic the voltage that I have on the first dimming expansion. Any ideas on how to make the second dimming expansion work?

Thanks,
Tim

Re: Second dimming expansion not responding

Posted: Mon Mar 08, 2021 8:56 am
by rimai
Can you load the I2CScanner and see which addresses you have on your log?

Re: Second dimming expansion not responding

Posted: Mon Mar 08, 2021 11:24 pm
by tngo
I loaded the I2CScanner.ino onto the controller but once it loaded it just says code was updated successfully and doesn't output any addresses after that. Checked the bitrate on the COM port to match that of what was in the ino file. Also tried adding the lines below for the RA* but cbi returns not declared error.

DDRH|=(1<<2); // Port PH2 output (Exp Bus Power)
cbi(PORTH,2); // Turn on exp bus power

Thanks,
Tim

Re: Second dimming expansion not responding

Posted: Tue Mar 09, 2021 9:00 am
by rimai
Try this one:

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");
}

#define sbi(port,bitnum)		port |= _BV(bitnum)
#define cbi(port,bitnum)		port &= ~(_BV(bitnum))

#define i2cMux  0x70

#define i2cMuxEnable  43

byte start_address = 1;
byte end_address = 128;

byte muxpresent=0;
// standard Arduino setup()
void setup()
{
  Wire.begin();
  pinMode(7,OUTPUT);
  Serial.begin(57600);
  DDRH|=(1<<2); // Port PH2 output (Exp Bus Power)
  cbi(PORTH,2); // Turn on exp bus power
  pinMode(i2cMuxEnable,OUTPUT);
  digitalWrite(i2cMuxEnable,LOW);
  delay(1000);
  digitalWrite(i2cMuxEnable,HIGH);
  delay(100);
  Wire.beginTransmission(i2cMux);
  Wire.write(0xf);
  muxpresent=Wire.endTransmission();
  delay(100);
  
  if(muxpresent!=0)
  {
    Serial.println(muxpresent);
    Serial.println("I2C Mux not found");
  }
  else
  {
    Wire.beginTransmission(i2cMux);
    Wire.requestFrom(i2cMux, 1);
    delay(100);
    if (Wire.available())
    {
      byte channels=Wire.read();
      Serial.println(channels);
      if (channels==0xf)
        Serial.println("All channels active");
      else
        Serial.println("Error setting channels");
    }
    else
    {
      Serial.println("No response from I2C Mux");
    }
    Wire.endTransmission();
    
    Serial.println("I2CScanner 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);
}

Re: Second dimming expansion not responding

Posted: Tue Mar 09, 2021 10:25 am
by tngo
Okay cool. I'll try it later tonight when I get home. Thank you for all the support Roberto.

Tim

Re: Second dimming expansion not responding

Posted: Tue Mar 09, 2021 10:13 pm
by tngo
The code compiled and uploaded, but I'm still not getting the serial output. It should output at the bottom of the webwizard after stating that the code was uploaded successfully. That's where the memory should appear correct? Or an issue with the serial writing, anyway to dump the output to a file?


...
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 1.27s
avrdude: verifying ...
avrdude: 5796 bytes of flash verified
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (H:FF, E:D8, L:FF)
avrdude done. Thank you.
Your code was uploaded sucessfully.
×

Re: Second dimming expansion not responding

Posted: Wed Mar 10, 2021 9:26 am
by rimai
Sorry, the webwizard doesn't have serial monitor.
You have to use putty, teraterm or the Arduino IDE.

Re: Second dimming expansion not responding

Posted: Wed Mar 10, 2021 10:57 am
by tngo
Ahh got it. I was looking in the wrong place.

Thanks.

Re: Second dimming expansion not responding

Posted: Wed Mar 10, 2021 9:32 pm
by tngo
The program kept returning "I2C Mux not found", so I changed the if(muxpresent!=0) to keep the program running. Below is what was returned, though I'm not sure what the Mux is for. Currently have connected 2 relay boxes, 2 5port dimming modules, one expansion hub, one wifi hub, one pH expansion, and one salinity expansion on the RA*.

No response from I2C Mux
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 found!
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
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 found! addr: 4F addr: 50
addr: 51 addr: 52 addr: 53 addr: 54
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: Second dimming expansion not responding

Posted: Wed Mar 10, 2021 9:39 pm
by rimai
I don't see neither dimming expansions in the log.
They are:

Code: Select all

#define I2CPWM_PCA9685		0x40
#define I2CPWM_16CH_PCA9685		0x41

Re: Second dimming expansion not responding

Posted: Wed Mar 10, 2021 10:27 pm
by tngo
I've added the 2 definitions to my code and uploaded it but 2nd dimming expansion still isn't responding.

Re: Second dimming expansion not responding

Posted: Thu Mar 11, 2021 8:22 am
by rimai
Is this for RA* or RA+?

Re: Second dimming expansion not responding

Posted: Thu Mar 11, 2021 9:03 am
by tngo
This is for an RA*.

Re: Second dimming expansion not responding

Posted: Thu Mar 11, 2021 11:08 am
by rimai
That's odd.
I can only see the pH and RF expansions in the log.

Re: Second dimming expansion not responding

Posted: Thu Mar 11, 2021 12:09 pm
by tngo
I did have an error with I2C Mux not found error when in the script that I had to bypass or else the log wouldn't post. Not sure if that would affect the log readout. Currently have connected and working 2 relay boxes, 1 5port dimming modules, one expansion hub, one wifi hub (expanded relay is connected to the wifi hub), one pH expansion, one RF module, and one salinity expansion.

Re: Second dimming expansion not responding

Posted: Thu Mar 11, 2021 8:18 pm
by tngo
It seems that I have my expansion hub connected to the wifi expansion hub. I forgot that I had to move most connections to the wifi hub to prevent the reboots. Would the prevent me from connecting a second dimming module?

I connected the 2nd dimming module to a 2nd expansion hub and that sovled the problem. I'll just keep the current setup if there aren't any bus locks.

Re: Second dimming expansion not responding

Posted: Thu Mar 11, 2021 8:23 pm
by rimai
Ahhh... That makes sense
I think that is the reason.

Re: Second dimming expansion not responding

Posted: Thu Mar 11, 2021 8:44 pm
by tngo
Okay very good. Going to test these aqlinks to see if I can control the jebao dcp return pumps.

Thanks for your help Roberto.

Tim