2nd Dimming Expansion Module

Do you have a question on how to do something.
Ask in here.
User avatar
Posts: 50
Joined: Fri Sep 01, 2017 8:15 am
Location: Severna Park, MD
PostPosted: Fri Feb 23, 2018 12:53 pm
I saw in this thread that I could use a second Dimming Expansion Module to control more than 6 channels of lighting.

viewtopic.php?p=50059#p50059

I built my DIY RapidLEDs fixture to use 12 channels and have 2 dimming expansion modules.

How do I access/control the ports on the second dimming module? Do I need to/should I customize my libraries?

I have an RA*.
Try to learn something about everything and everything about something... Thomas Huxley
210gal DT | 50gal sump/refug | Jebao DCP 10000 pump | RO 200-int skimmer | DIY built stand | DIY 160 led, 12 channel, 458 watt, on MakersLED 72" heatsink

Posts: 12200
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Feb 23, 2018 1:27 pm
No change to the libraries. You would have to implement the communication to the second module in your code.
Roberto.
User avatar
Posts: 50
Joined: Fri Sep 01, 2017 8:15 am
Location: Severna Park, MD
PostPosted: Fri Feb 23, 2018 1:46 pm
Thanks Roberto.

Would you give me an example; if I wanted set channel #7 (#1 on the second Dimming Module) to 90%, what would that code look like?
Try to learn something about everything and everything about something... Thomas Huxley
210gal DT | 50gal sump/refug | Jebao DCP 10000 pump | RO 200-int skimmer | DIY built stand | DIY 160 led, 12 channel, 458 watt, on MakersLED 72" heatsink

Posts: 12200
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Feb 23, 2018 2:44 pm
All the code for the Dimming expansion module can be found on the file RA_PWM.cpp
Here is what you need:
Code: Select all
    Wire.beginTransmission(I2CPWM_PCA9685);
    Wire.write(0x8+(4*channel));
    Wire.write(data&0xff);
    Wire.write(data>>8);
    Wire.endTransmission();

Where channel would be 7 and data would be 90% of 4095.
Roberto.
User avatar
Posts: 50
Joined: Fri Sep 01, 2017 8:15 am
Location: Severna Park, MD
PostPosted: Fri Feb 23, 2018 3:01 pm
Thank you Sir,

Exactly what I needed.

I have that printed out but this section threw me off:

#ifdef PWMEXPANSION
else if (Channel>=OVERRIDE_CHANNEL0 && Channel<=OVERRIDE_CHANNEL5) // Dimming Expansion channel 0-5
SetChannelOverride(Channel-OVERRIDE_CHANNEL0,Value);

Still learning the language.

FYI, I'm doing this remotely with the Dimming Expansion modules and Expansion relay connected to the Cloud Wifi expansion hub through an Expansion Hub module.

Again, thanks much!
Try to learn something about everything and everything about something... Thomas Huxley
210gal DT | 50gal sump/refug | Jebao DCP 10000 pump | RO 200-int skimmer | DIY built stand | DIY 160 led, 12 channel, 458 watt, on MakersLED 72" heatsink
User avatar
Posts: 50
Joined: Fri Sep 01, 2017 8:15 am
Location: Severna Park, MD
PostPosted: Fri Feb 23, 2018 3:29 pm
A couple of follow-up questions.

Can I designated one module to be channels 0-5 and the other 6-11 or is it determined automatically?
If determined automatically, would it ever switch?
Try to learn something about everything and everything about something... Thomas Huxley
210gal DT | 50gal sump/refug | Jebao DCP 10000 pump | RO 200-int skimmer | DIY built stand | DIY 160 led, 12 channel, 458 watt, on MakersLED 72" heatsink

Posts: 12200
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Feb 23, 2018 3:45 pm
Actually,I just remember that you also have to change the ID of the 2nd expansion module.
Open the module and place a jumper on ID1.
That way both your modules will have distinct addresses.
The first one is I2CPWM_PCA9685 and the second one is I2CPWM_16CH_PCA9685.
Also, I just looked at the libraries and since both these addresses are distinct and already in the libraries, all you need to do is place this line on the setup() section:
Code: Select all
ReefAngel.Add16ChPWM();

Then you can control the channels of the second module as if it were a 16ch.
Code: Select all
ReefAngel.PWM.SetChannel(0,4096); // Sets channel 0 of 1st dimming module to 4096
ReefAngel.PWM.Set16Channel(0,4096); // Sets channel 0 of 2nd dimming module to 4096

Channels for both modules start at 0.
Roberto.
User avatar
Posts: 50
Joined: Fri Sep 01, 2017 8:15 am
Location: Severna Park, MD
PostPosted: Fri Feb 23, 2018 5:56 pm
Got it. With jumper on, 2nd module is addressable as a 16ch, that makes it easy.

Thanks.

--Loose
Try to learn something about everything and everything about something... Thomas Huxley
210gal DT | 50gal sump/refug | Jebao DCP 10000 pump | RO 200-int skimmer | DIY built stand | DIY 160 led, 12 channel, 458 watt, on MakersLED 72" heatsink
User avatar
Posts: 50
Joined: Fri Sep 01, 2017 8:15 am
Location: Severna Park, MD
PostPosted: Mon Feb 26, 2018 5:14 pm
Is there something that would keep a 6 ch Dimming module from working with a Cloud Wifi Hub expansion?

I inserted the jumper on JP1 and added the code to my INO.

void setup():
Code: Select all
ReefAngel.Add16ChPWM();

and used the following as a test.
void loop():
Code: Select all
    ReefAngel.PWM.Set16Channel(0,9);
    ReefAngel.PWM.Set16Channel(1,27);
    ReefAngel.PWM.Set16Channel(2,45);
    ReefAngel.PWM.Set16Channel(3,63);

I can see the changes in the android app but the lights do not turn on

I switched the the following code:
Code: Select all
    ReefAngel.PWM.Set16ChannelRaw(0,369);
    ReefAngel.PWM.Set16ChannelRaw(1,1107);
    ReefAngel.PWM.Set16ChannelRaw(2,1845);
    ReefAngel.PWM.Set16ChannelRaw(3,2583);

With the same results

I attached the jumpered 6ch module to the RA* and ran the I2CScanner.INO just to verify that the address was 0x41 and it was detected there correctly.

I even tried your test code, slightly modified, as I only have 4 channels from that module attached right now.
void loop()
Code: Select all
  for (int a=0;a<4;a++)
  {
    CustomExpansion(0x41,a,50);
  }
  CustomExpansion(0x41,now()%4,99);

Code: Select all
void CustomExpansion(byte id, byte channel, byte percentage)
{
  Wire.beginTransmission(id);
  Wire.write(0);
  Wire.write(0xa1);
  Wire.endTransmission();
  int newdata=(int)(percentage*40.95);
  Wire.beginTransmission(id);
  Wire.write(0x8+(4*channel));
  Wire.write(newdata&0xff);
  Wire.write(newdata>>8);
  Wire.endTransmission();
}


This is what my setup in the remote room looks like at the moment:
Attachments
20180225_221754.jpg
20180225_221754.jpg (121.05 KiB) Viewed 374 times
Try to learn something about everything and everything about something... Thomas Huxley
210gal DT | 50gal sump/refug | Jebao DCP 10000 pump | RO 200-int skimmer | DIY built stand | DIY 160 led, 12 channel, 458 watt, on MakersLED 72" heatsink

Posts: 12200
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Mon Feb 26, 2018 5:38 pm
Hummm.
I may not have implemented the publishing of this module. :(
I have to double check.
Does it work if you use it directly connected to RA*?
Roberto.
Next

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 4 guests