2 RAs in tandem + H2O Automation

Talk about you and your tank/equipment
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: 2 RAs in tandem + H2O Automation

Post by rimai »

The trigger is whether you want the relay to activate when RA sends high (5V) signal or low (0V) signal.
If you set to low, the relay will activate when RA sends 0% or when RA is offline. That's the best scenario when you want something to be on when RA looses power.
If you set to high, the relay will activate when RA sends 100% (assuming you set the jumpers to 5V analog) and will not activate when RA looses power. So, the relay can only be activated when RA is operational and sending 100% signal.
That's what I picked up of what the trigger is.
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: 2 RAs in tandem + H2O Automation

Post by Sacohen »

But if it is a 24V relay will a 5v signal from the RA even trigger it?

The E-Bay description is very unclear what the high and low triggers do?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

That's interesting and actually may match up to what I saw when initially testing....

I had the Low trigger option configured and initially when I wired everything up the relays were ON not OFF. Thats why I started screwing around with the wiring, etc. So I probably had good behavior and messed it up trying to unconfirm that behavior.

The Low option is almost what I'm looking to do with the signal from upstairs though so that's cool to know that other applications have similar requirement :)
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

Sacohen wrote:But if it is a 24V relay will a 5v signal from the RA even trigger it?

The E-Bay description is very unclear what the high and low triggers do?
The relays are made to work with Arduino.. here's the ebay link http://bit.ly/1pFisuu

I have a feeling that the voltage on that signal doesn't really matter except that it's good. The test code on the controller was slow so I may not have waited it out long enough thinking something was wrong with my wiring to see the ports come on / off.

I also wasn't sure I had the pinout properly on the RA so I was debugging that at the same time... at least I got an extra set of relays this time. I'll go one at a time and make sure I don't fry them all in one shot...
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: 2 RAs in tandem + H2O Automation

Post by rimai »

The signal IN is not directly connected to the relay coil. It goes through an opto-isolator, which in turn controls a transistor, which in turn activates the coil, which is 24VDC.
The purpose of the opto-isolator is to isolate the RA port from being damaged by anything that is going on with the relay coil stuff, which is running at 24VDC.
The opto-isolator does not have enough power to activate the coil in the relay, so a transistor is need that can handle the 24V and 5mA current.
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: 2 RAs in tandem + H2O Automation

Post by Sacohen »

Thanks for clarifying that. I had never heard of an Optocoupler before and wasn't sure what they did.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: 2 RAs in tandem + H2O Automation

Post by rimai »

Check the beginning of the thread for the schematics of an optocoupler:
http://forum.reefangel.com/viewtopic.php?p=36132#p36132
It works basically the same as your tv remote control. On one side you have a infrared led (your remote control) and on the other side, you have a photo-sensitive transistor (your tv).
When the led is turned on by the RA signal, it emits light that the transistor picks up so you have this layer of protection where one side is isolated from the other side by a small gap of air.
This small gap of air protects one side from another since they don't have any physical contact and the signal is transmitted by means of light through this led-transistor combo.
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: 2 RAs in tandem + H2O Automation

Post by Sacohen »

Very cool. You learn something new everyday. :)

Sent from my HTC One VX using Tapatalk
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

So I guess on the issue of high or low trigger, I couldn't find much documented.. I did find the specifications for one relay that said the low trigger was anything less than 7V and high was >7V.

I also found this link http://www1.electusdistribution.com.au/ ... tocoup.pdf

[quote]For example just like a discrete LED, you can drive an
optocoupler’s input LED from a transistor or logic
gate/buffer. All that’s needed is a series resistor to set the
current level when the LED is turned on. And regardless of
whether you use a transistor or logic buffer to drive the
LED, you still have the option of driving it in ‘pull down’ or
‘pull up’ mode — see Fig.2. This means you can arrange for
the LED, and hence the optocoupler, to be either ‘on’ or
‘off ’ for a logic high (or low) in the driving circuitry./quote]

And based on the behavior I saw (both relays going to ON when set to Low trigger) I'm pretty inclined to think that it was all working as expected and I screwed up it up trying to troubleshoot a working situation. Only one way to know once the new relays come in. I can't seem to find anyone in the US that sells these.. I found a few more links on Amazon, etc. but they all have crazy stupid shipping times. If anyone knows where I can source something like this locally, please lmk. In the meantime, I'm glad I have some confirmation that I was going in the right direction.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

Got the replacement relays last night. Probably won't have time to connect and test them for a little while. Also received a delivery from Roberto. My dimming module.. so I can hack my D-120s and a salinity module so i can automate salt mixing :) I need to start working on the code for all of this soon...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

Hooked up the relays tonight. Connected to the RA. Left it on high trigger. Working perfectly. PWM controller for the pump is hooked up as well. All electronics components are now in place. Oh, minus one more float switch. Plumbing, mounting, cabling still to come..
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: 2 RAs in tandem + H2O Automation

Post by Sacohen »

Good going.

Sent from my HTC One VX using Tapatalk
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

Ok I spoke to soon.. I went to hook it up again to the RA to take a video and nothing was working. I measured the output now from the PWM and I'm getting 0. Not sure what happened... :(

Relays are working fine however...
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: 2 RAs in tandem + H2O Automation

Post by Sacohen »

That sucks.

Sent from my HTC One VX using Tapatalk
howaboutme
Posts: 245
Joined: Tue Jan 28, 2014 11:10 am
Location: Northern VA

Re: 2 RAs in tandem + H2O Automation

Post by howaboutme »

lnevo wrote:Got the replacement relays last night. Probably won't have time to connect and test them for a little while. Also received a delivery from Roberto. My dimming module.. so I can hack my D-120s and a salinity module so i can automate salt mixing :) I need to start working on the code for all of this soon...
Hey Lee...When you do the D120 hack, can you document w/ a lot of photos? The official thread is short on photos detailing each individual steps making it hard for non-electronics people to follow along. I can only read so much short this, short that jargon. :D
Jack
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

Will do...not rushing into that...especially after this right now...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

Can the salinity module be plugged in to the relay box or does it need to be isolated?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: 2 RAs in tandem + H2O Automation

Post by rimai »

Yes it can
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

Ok temp probe received today. Will be mixing up some salt with my RA soon :)

I have my float switches ready to go. I need to setup the pump for the RO and install the float switches. Oh and need to setup the wifi so I can monitor the change in salinity.

Once I can monitor the salinity over time I'll be able to see how quickly the salinity changes when i add salt manually and when i add water manually. This way I can figure out what the routine will look like.

I'll use 1/2 the usual salt I use to mix up 1/2 my container of SW to 35ppt. Then I'll add 1/2 of the salt remaining and monitor the salinity. I'll then add RO in increments and watch the change in salinity until I'm back to 35ppt. That should get my barrel to 3/4 full. If the high level float switch gets triggered before we get to 35ppt, i will obviously stop adding RO and send an alert. At that point, I would just need to drain some water out so it can finish up or figure out what went wrong...

I'll fine-tune the fill amounts and timing based on how quickly the salinity reacts. Add a specified amount of real mixing time and signal the AWC to resume. Then the routine will just be to add a few cups of salt every week.

BTW, this process will only happen if I trigger WC mode :) This way the salinity isn't being constantly adjusted all week long.

Sorry if I've described the process multiple times already, but talking it out in my head is helping the overall thought process.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

So I think I finally finished the first set of code and getting ready to load it up this weekend. In order to do what I want I've created a TimedPort class.

This is a wrapper for a relay port. You can do all the things you can do with a normal relay, but you can do a few extra things to it. You can set it up like a dosing pump by setting the Time, Offset, Repeat and then use the Run() function. What this adds over a normal DosingPumpRepeat function is built in state tracking, Pause() Resume() Start() Stop()

It has an Osc function that is similar to the APEX OSC call so if you just want a port that is on for 20 minutes and off for an hour and 40 you can do that too.

For me what I wanted was the ability to have the running schedule but be able to trigger a run or a stop when I want. I didn't want to have to do the timer in my loop or separate function every time. For instance, every time I come home and turn my fuge light on to take a look at my tank, i end up leaving the override on and then realize the next day my fuge light has been on for 24 hours...so now I can change my fuge light on to a Start(3600) and the override will be timed for one hour. Another example is my skimmer. I dose reefbooster and it needs the skimmer off for like 12 hours...i mask it off, but then I gotta remember to turn it back on. With this i can issue a call to Stop(12*SECS_PER_HOUR); and the Skimmer will now be off for that much time.

Anyway, it may sound complex but its quite easy, once I can post it, I'll write up some documentation. I haven't even tested the compile yet :)

I will also be adding a Scale function so you can specify the times in seconds, minutes, hours, or days.

The next class will be the dosing pump one. This will add calibration values, logging, and maybe millisecond scaling...have to do some more research on that one before I commit to that.

Anyway, when I'm ready to post it, I'll put up a few more use cases. If you want to help test or develop this, let me know and I'll be happy to give you an early version :)
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: 2 RAs in tandem + H2O Automation

Post by Sacohen »

Awesome.

This sounds like it might be what I want to disable the Auto-Feeder if I do a manual feed, like I was asking about over the weekend and you said to just override it.

I was afraid if I override it I would forget to remove the override and the fish would not get feed for a couple of days.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

You need to disable the StartFeedMode() though...not the Feeder, but yes it can be used to Stop() the feeder for X amount of time :)
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: 2 RAs in tandem + H2O Automation

Post by Sacohen »

Cool I'll look into it when you have more info up about it.
It's nothing earth shattering right now.
I can do an override if I do a manual feed.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

The code for my mixing station is pretty complete at this point. Want to do some cleanup and commenting so it's clearer to read. Right now it's a bit on the convoluted side. I also want to clean up the use-case for the TimedPort class so I can use as an example in the documentation.

In any event, the cool part is that salt mixing is now fully automated. As my salt water bin gets low, I put the RA into waterchange mode which kicks off the mixing pump for 12 hours. Normally it's running every for an hour every other hour. Then I turn on an unused port which then starts adding water slowly (3 seconds on / 30 seconds off) until the "average" salinity drops below 35ppt. I've only tested so far with adding 5 gallons of water to the barrel, but after I do my water change this weekend, I'll try from a full bin of fresh water. By the way, if the barrel has been emptied below the low ato switch, then it will first pump in X amount of water. I've set this for 30 seconds but I have to see how much water that actually is :) Either way, I'll get some testing in this weekend.

Hopefully I can start doing some calibration testing soon on the auto water change pump so I can move forward on that piece.

Also, I haven't added this to the libraries yet, but I registered an issue so I can make a pull request. I added a function Auto to ReefAngel.Relay which will remove the masks from a port. We already had this with Override, but I think it reads cleaner without using Override. So soon we'll have On(), Off(), and Auto().
User avatar
ewaldsreef
Posts: 82
Joined: Tue Oct 08, 2013 8:22 pm
Location: Salt Lake City, UT
Contact:

Re: 2 RAs in tandem + H2O Automation

Post by ewaldsreef »

I am getting in on this conversation late but going back to the first part. Why not run the whole thing off of one RA? Would the r e be enough memory in one controller to do all of it?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

This was before RANet existed. It still may be too much distance. The mixing station is in the basement on opposite end of the house.
User avatar
ewaldsreef
Posts: 82
Joined: Tue Oct 08, 2013 8:22 pm
Location: Salt Lake City, UT
Contact:

Re: 2 RAs in tandem + H2O Automation

Post by ewaldsreef »

If this wasnt an issue then would using on controller have enough memory? Is there anyway to boost the signal on RANet?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: 2 RAs in tandem + H2O Automation

Post by lnevo »

Yeah, plenty of memory. That's not the issue, just the distance.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: 2 RAs in tandem + H2O Automation

Post by cosmith71 »

You can replace the XBee's with the pro models (series 1) and get more distance. They have to be reprogrammed, but it works.

--Colin
Post Reply