Expansion hub and PWM Expansion hub coding
Expansion hub and PWM Expansion hub coding
Attached is my current code thanks to Roberto with a few little mods that I added. But I'm having problems coding the 2nd relay box. Do I just add the relays as relay 9-16 or do I have to call them out as something else? Also I have 2 expansion modules one for the relays and one of the LEDs but the PWM expansion module doesn't have dip switches so do I put that module into slot one and set the Dip switch in the relay box expansion module to position 2?
Any sort of guidance would be great!!
Don
Any sort of guidance would be great!!
Don
- Attachments
-
- force_cloud_ato_modify11_8_11.pde
- (15.56 KiB) Downloaded 395 times
Re: Expansion hub and PWM Expansion hub coding
On the relay expansion module, use ID #1.
Then you can just call relays 11 through 18.
If you use ID#2, you would use relays 21 through 28. And so forth for the other IDs.
The order and position where you place them on the hub is irrelevant. You can place them in whichever port you wish.
Make sure to have the following line on the ReefAngel_Features.h file:
Then you can just call relays 11 through 18.
If you use ID#2, you would use relays 21 through 28. And so forth for the other IDs.
The order and position where you place them on the hub is irrelevant. You can place them in whichever port you wish.
Make sure to have the following line on the ReefAngel_Features.h file:
Code: Select all
#define RelayExp
Roberto.
Re: Expansion hub and PWM Expansion hub coding
I had the line in both the sketch and the ReefAngel_features.h file and when i try to compile it tells me the port 11-18 have not been declared.
Re: Expansion hub and PWM Expansion hub coding
My bad.
You have to use either of this:
or
You have to use either of this:
Code: Select all
ReefAngel.Relay.On(11);
Code: Select all
ReefAngel.Relay.On(Box1_Port1);
Roberto.
Re: Expansion hub and PWM Expansion hub coding
you either use the number 11 through 18 or you use the defines which are Box1_Port1divingdon wrote:I had the line in both the sketch and the ReefAngel_features.h file and when i try to compile it tells me the port 11-18 have not been declared.
Code: Select all
ReefAngel.Relay.On(Box1_Port1);
the additional boxes use the format Box#_Port# for reference.
curt
Re: Expansion hub and PWM Expansion hub coding
Great that work my last question is can I just add 1 and 0's to feed, water change, lights on port and over temp
Re: Expansion hub and PWM Expansion hub coding
In order to do them, you need to use the variables for them. They work exactly like the ones for the main relay except the variable is named a little different.divingdon wrote:Great that work my last question is can I just add 1 and 0's to feed, water change, lights on port and over temp
FeedingModePortsE[]
WaterChangePortsE[]
OverheatShutoffPortsE[]
LightsOnPortsE[]
They are arrays that you can assign the 0 & 1's to just like the main relay. The index starts at 0 for the first expansion relay box.
So this will be the code you can use for the first expansion relay:
Code: Select all
FeedingModePortsE[0] = B00000000;
WaterChangePortsE[0] = B00000000;
OverheatShutoffPortsE[0] = B00000000;
LightsOnPortsE[0] = B00000000;
curt
Re: Expansion hub and PWM Expansion hub coding
So if I understand correctly I would code like this
FeedingModePortsE[0] = B10011100;
WaterChangePortsE[0] = B10111111;
OverheatShutoffPortsE[0] = B00000011;
LightsOnPortsE[0] = B00000011;
FeedingModePortsE[1] = B11111111;
WaterChangePortsE[1] = B11111111;
OverheatShutoffPortsE[1] = B00101010;
LightsOnPortsE[1] = B00000000;
With 0=on and 1= off
Correct?
I now get this error "FeedingModePortsE not declared in this scope" when I try to complie did I miss something
FeedingModePortsE[0] = B10011100;
WaterChangePortsE[0] = B10111111;
OverheatShutoffPortsE[0] = B00000011;
LightsOnPortsE[0] = B00000011;
FeedingModePortsE[1] = B11111111;
WaterChangePortsE[1] = B11111111;
OverheatShutoffPortsE[1] = B00101010;
LightsOnPortsE[1] = B00000000;
With 0=on and 1= off
Correct?
I now get this error "FeedingModePortsE not declared in this scope" when I try to complie did I miss something
Re: Expansion hub and PWM Expansion hub coding
you must have define RelayExp in your features file for it to compile.
what i described will work for the expansion relays only. you still use the default way for the main relay. so the first relay box is index 0. in your post it looks like you have 2 expansion relays, is that correct?
curt
what i described will work for the expansion relays only. you still use the default way for the main relay. so the first relay box is index 0. in your post it looks like you have 2 expansion relays, is that correct?
curt
Re: Expansion hub and PWM Expansion hub coding
I think what you are trying to do is:
Code: Select all
FeedingModePorts = B10011100;
WaterChangePorts = B10111111;
OverheatShutoffPorts = B00000011;
LightsOnPorts = B00000011;
FeedingModePortsE[0] = B11111111;
WaterChangePortsE[0] = B11111111;
OverheatShutoffPortsE[0] = B00101010;
LightsOnPortsE[0] = B00000000;
Roberto.
Re: Expansion hub and PWM Expansion hub coding
yes i have 2 relay box and i did define RelayExp in my sketch and feature file. The 2nd relay box is current controlling heaters, fans and a few other things correctly
Roberto that didnt work either??
Roberto that didnt work either??
Re: Expansion hub and PWM Expansion hub coding
What ID did you use on the relay expansion module?
Roberto.
Re: Expansion hub and PWM Expansion hub coding
We didnt add the ReefAngel. in front of the command now it works I left the expansion module with the your default I believe it was set to 1
So would I have to change the command to this???
ReefAngel.FeedingModePortsE[1] = B11111111;
ReefAngel.WaterChangePortsE[1] = B11111111;
ReefAngel.OverheatShutoffPortsE[1] = B00101010;
ReefAngel.LightsOnPortsE[1] = B00000000;
So would I have to change the command to this???
ReefAngel.FeedingModePortsE[1] = B11111111;
ReefAngel.WaterChangePortsE[1] = B11111111;
ReefAngel.OverheatShutoffPortsE[1] = B00101010;
ReefAngel.LightsOnPortsE[1] = B00000000;
-
- Posts: 471
- Joined: Sat Jan 14, 2012 2:08 pm
- Location: Montgomery Village, MD
Re: Expansion hub coding
Trying to learn how to address the ports on my relay expansion box..is it as simple as this?rimai wrote: You have to use either of this:orCode: Select all
ReefAngel.Relay.On(11);
Code: Select all
ReefAngel.Relay.On(Box1_Port1);
Roscoe's Reefs - Starting Over Again:
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
-
- Posts: 471
- Joined: Sat Jan 14, 2012 2:08 pm
- Location: Montgomery Village, MD
Re: Expansion hub and PWM Expansion hub coding
Hi roberto;
What would be the best method to turn a port on for a hour or so, then off for an hour or so and then toggle off and on forever. I am using a powerhead to just stir some chemicals in my top off bucket. Thx
What would be the best method to turn a port on for a hour or so, then off for an hour or so and then toggle off and on forever. I am using a powerhead to just stir some chemicals in my top off bucket. Thx
Roscoe's Reefs - Starting Over Again:
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Re: Expansion hub and PWM Expansion hub coding
Try this:
Code: Select all
ReefAngel.Relay.Set (Port1,(hour()%2==0));
Roberto.
-
- Posts: 471
- Joined: Sat Jan 14, 2012 2:08 pm
- Location: Montgomery Village, MD
Re: Expansion hub and PWM Expansion hub coding
I installed this code tonite and it doesn't appear to be working. You can see on the portal where it came on and has not yet turned off. LMK what I can try next. Thx
this is how I wrote the line
Code: Select all
//stir chemicals in water top off unit
ReefAngel.Relay.Set (Box1_Port1,(hour()%2==0));
Roscoe's Reefs - Starting Over Again:
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Re: Expansion hub and PWM Expansion hub coding
Looks like Box1_Port1 is on override on mode.
Can you turn into auto mode and try again?
Can you turn into auto mode and try again?
Roberto.
-
- Posts: 471
- Joined: Sat Jan 14, 2012 2:08 pm
- Location: Montgomery Village, MD
Re: Expansion hub and PWM Expansion hub coding
Did that this morning over coffee. Went back to portal couple of minutes later and it had switched back to "on." Thxrimai wrote:Looks like Box1_Port1 is on override on mode.
Can you turn into auto mode and try again?
Roscoe's Reefs - Starting Over Again:
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
-
- Posts: 471
- Joined: Sat Jan 14, 2012 2:08 pm
- Location: Montgomery Village, MD
Re: Expansion hub and PWM Expansion hub coding
looked again a few minutes later and is now back to auto. Device is now off, but is showing as auto and green (on) on the portal screen. Expansion box is currently not showing up in the relay charts but does show up on the main dashboard. thx
And finally device just turned back on at the top of the hour... so, I will monitor today and let you know how it goes, but wanted to report in. Thx
And finally device just turned back on at the top of the hour... so, I will monitor today and let you know how it goes, but wanted to report in. Thx
Roscoe's Reefs - Starting Over Again:
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
-
- Posts: 471
- Joined: Sat Jan 14, 2012 2:08 pm
- Location: Montgomery Village, MD
Re: Expansion hub and PWM Expansion hub coding
Update: device is working as expected, turning off and on top of each hour; however when the device is on the portal is showing activity in relay activity charts, yet when the device is off, it shows nothing from any of the ports on box1. Thx
Roscoe's Reefs - Starting Over Again:
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Re: Expansion hub and PWM Expansion hub coding
The portal by design doesn't store anything when something is off to save space on the database.
What that does is it thinks that your controller doesn't have any expansion module because there is nothing on.
If you use the code below, your relay activity in th Portal will show properly until you get some of those other ports used up.
What that does is it thinks that your controller doesn't have any expansion module because there is nothing on.
If you use the code below, your relay activity in th Portal will show properly until you get some of those other ports used up.
Code: Select all
ReefAngel.Relay.On(Box1_Port8);
Roberto.
-
- Posts: 471
- Joined: Sat Jan 14, 2012 2:08 pm
- Location: Montgomery Village, MD
Re: Expansion hub and PWM Expansion hub coding
thx, so this is just going to set that port on even if not used so it will keep up the charts? I'll use this until I am thru testing and then remove, I don't need it once I understand what I'm seeing. Thx
Roscoe's Reefs - Starting Over Again:
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.