multiple pH meters, solenoids, PLC and IOs

Request new hardware or ideas for the controller
Post Reply
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Hello all,

I will buy a Reef Angel to make my large tank work with algae and zooplankton culture. I need a way to make the RA read multiple pH meters and control many solenoids. I will use a PLC with 128+ outputs and at least 6 inputs to use with an IO box from RA. I'd like to program the PLC to control each solenoid based off of 6 inputs that I will treat as binary inputs. I'd like to program the RA so that its IO module ouputs that same binary code to the PLC. The RA turns on output 1 and 5 which to the PLC looks like 100010 and turns on solenoid 14. I may really only need 5 to cover my needs but its probably easier to just use binary and let the calculator tell me the proper sequence for any given number. I can expand the PLC units to have add-on capacity later.

The above summary was written for me by a friend. I'm 51 and I last programmed in BASIC in the 1980's. I am a complete programming idiot, but will do whatever it takes to help automate my 3,000 gallon tank. I am at least a month away from installing the RA, so if any smart programmers want to mull over a solution with me, we have time.

Thank you very much. This is the only way I can keep a large tank from overwhelming me with work.

Dave W.
tkeracer619
Posts: 160
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: multiple pH meters, solenoids, PLC and IOs

Post by tkeracer619 »

Hey there Dave.

So what I proposed to him with having to control all these solenoids as described in his post would be that instead of operating ac solenoids on a relay box he would operate dc solenoids off of a plc.

The PLC is programmed such that it has 6 inputs and any given combination of those inputs will drive a certain relay or set of relays. The IO module for RA outputs these so that the PLC controls the particular relay or group of relays.

Sounds simple enough when needing to operate 1 solenoid but where I believe the coding will get complex is when needing to operate multiple solenoids simultaneously. I think it can be worked around but will definitely take some of the brain power on this board. With 6 inputs there are something like 720 combinations possible. So my initial thought is to figure out all the instances you could run into and each one would get an individual code ouput from the IO module. Increasing to 8 channels has something like 13,000 combinations so the system should be able to be expanded indefinitely.

Dave has been working on a really cool system that could benefit us all and progress captured breeding efforts so we should all definitely put some time and thought into this to make this work.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

Multiple pHs will definitely require a custom development.
How many solenoids are you going to drive? All 128??
If you are thinking of using a PLC to drive the solenoids, doesn't the PLC have a serial com port for communication?
We could communicate with the PLC through serial.
Roberto.
tkeracer619
Posts: 160
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: multiple pH meters, solenoids, PLC and IOs

Post by tkeracer619 »

Maybe a simple solution would be to get a plc that will allow you to receive the data in short pulses instead of the outputs always being on. So it pulses 1 and 5 which turns on that solenoid and then pulses again to turn off.

It would be good if you could program the plc to pulse the code back once it receives a code and have the RA pick that back up as a confirmation.

Edit:

Posting at the same time :)

Yup a lot of them have a serial. That would probably be much easier.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

I have built 4 pH modules for a group of scientist/marine biologists that are studying the effect of temperature rise and acidification in the oceans.
They have 4 mesocosms that they use to lower ph and increase temperature based on the actual measurements in the ocean. They cycle through 5000 l/h (I think) through their mesocosms tanks coming right from the ocean.
Their website is in Portuguese :(
http://coralvivo.org.br/
I was able to do this because they didn't have any need for ORP, WL and Salinity measurements and I just reused the same ICs to measure 4 different pH readings.
How many pH readings do you have in mind?
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Roberto and tkeracer619,

I think I'll need 5 or 6 pH meters because I will maintain that many algal species. Each specie has it's own ideal pH for growing and needs a dedicated pH meter. This application could also be solved with a Total Dissolved Solids meter or a transparency meter for algal density, or even with an optical photo receptor meter to measure transparency like an electronic Secci stick. You probably already know what a Secci stick is, but it's a colored disk on the end of a rod. Depending on the depth into the water that the color distinction fades, that tells you the density of the algae in the water.

But honestly I see pH as being the simplest and most accurate tool. The algal cultures will be grown under sunlight and transparency meters would be thrown off related to whether the day was overcast, etc. However if photo receptors or a similar approach is an easy application that works equally well as a pH meter, I am willing to measure algae density by another method. I could always try a light at one side of the algae culture vessel aiming at a photo receptor on the other side to see if it accurately measures algae density.

I anticipate using 50 to 100 solenoids for automation. Tkeracer619 brings up a good point regarding how to program if several solenoids are on at the same time, I hadn't thought about that complication.

Please let me know what other questions you have and what other data you need from me.
Last edited by dave w on Thu Nov 29, 2012 2:51 pm, edited 1 time in total.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

One other point. There are two types of solenoid programs here. One is a fixed program that drains a reservoir at regular intervals. This type of application can be programmed so that only one solenoid operated at a time.

The other system is not routine because it calls on the pH meter to signal the controller to power a solenoid at preset limits. For example, the solenoid would dump in new water at pH of 9, then stop dumping in new water once pH dropped to 8.7, if that particular algae culture started to crash at a pH of 9.2. Theoretically, each of the five algae cultures on a bright day may call for water dilutions all at the same time.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

What are the specs on the solenoid?
How many mA do they draw when they are closed, assuming the are normally open?
What timeframe do you have for this to be operational?
We can easily have a board with 128 independent relays to control all these solenoids.
It would need to be inside a metal box like on of those they install alarm systems.
This solution would not even require the PLC. I think the cost of the PLC would offset the board development, unless the PLC is a really cheap one.
That's the beauty of open source.
We can develop any hardware and still make use of the software and vice versa.
For multiple pHs, I would recommend going with a ph meter from atlas. It would be much easier to implement multiple meters and not have to worry about galvanic isolation. Their meter can be easily integrated with the RA hardware and we would only need to worry about how to read from their modules, which isn't a big deal.
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Roberto,

The solenoids are normally closed. I recall that the 1/2" gravity feed solenoids need 400 milliamps to open, but I will double check that figure. I also have 3/4" sprinkler solenoid valves that will operate on 40 psi house water and I will check their amp draw also. I have very short wire runs of 30' and am using 20 and 18 gauge wire.

The time frame to be operational is up to several months. I guess that you are recommending that relays not be in the fish room for humidity reasons, and because this is a greenhouse the humidity will be terrible. Fortunately the greenhouse is a lean-to design behind my house and I pulled all the wiring into the adjacent basement room which doesn't have moisture issues. Thanks for the atlas meter recommendation, I will look them up. So it seems that you've thought of a way to put multiple pH meters onto an RA via a special board, or is the special board just for the relays?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

Yes, we can pack all 128 relays and a few ph meters in the same board, but 400mA is quite a lot!!! :shock:
.4 x 128 = 50A
Is the 400mA on 12VDC coil?
I don't think we will be able to use the common trace on the board itself.
You will need to do just like an industrial installation.... You will need to use jump wires. Actually you would need to do that with the PLC too...
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Roberto, when I double check the amp draw on the solenoids lets hope that it's less than 400 mA. Perhaps 400 mA was on the 24vAC valves which I bought first and the DC amp draw may be less. And putting jumpers is something so easy even I could do it. I will look up the valves and get right back to you.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

OK Roberto, I double checked the amp draw on the 24v DC solenoids and it is indeed 400 mA. So instead of putting 100 relays on the board, would it be better to do 60 relays for the first go-round and save the next 60 for the next upgrade? I can probably get by with just 60 solenoids to start.
tkeracer619
Posts: 160
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: multiple pH meters, solenoids, PLC and IOs

Post by tkeracer619 »

Awesome!

Dave have they shipped the solenoids? You might want them to hang tight for a bit. If Roberto is going to custom make you a relay board it might be easier to run AC... :twisted:

Roberto what do you think is the easiest route to take?
Image
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

tkeracer619, I've already asked the valve company to change the order once, I can ask them to change a second time if I need to. Three times would be embarassing. Just let me know if the valves should be AC or DC and I'll email them asap on the final determination.

And Roberto, I understand that 128 solenoids at 400 mA is a total of 50 amp draw if they are all running at the same time, but in all liklihood not 5 or 10 would ever start at the same time so 5 amps may be the most that will get pulled. Actually if I start including pumps and lights I'd be completely wrong on that point, wouldn't I? But purely for solenoids, 400 mA is probably the starting amperage required to open or close the valve, the running amperage may be half of that.

It's a little like a house with 200 amp service, if you added up all the circuits in the house you would have 500 amps. I also assume (hope) that there'd be some type of automotive 10 or 20 amp fuses for circuit protection?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

There is also no difference in which coil you will use as far as the relay board is concerned, because you will be using a jumper wire anyway. We can't run this through PCB trace. It's too much.
So, the higher the voltage, the less the amperage and less gauge wire you will need to use.
If you go with DC coil, you will need a big power supply that can deal with the coils draw and also the little inrush they will produce. You could make several parallel circuits too, which would give you less amperage in each circuit and use a smaller DC fuse for each one.
If you go AC mains voltage, you can dedicate a breaker or two in your power distribution box for the coils and not have to worry about anything.
So, I think AC 110V coil will get you less equipment to worry about for failure, that's it. I don't think there is any major difference.
DC coils are easier to maintain in the future, because you will not need to shut the power to replace them.
It's all about balancing the pro's and con's and picking which one works best for you. Not always what is best for others is best for you.
Also, there is no benefit on splitting 60-60 relays. In fact, it is actually better to place them all into a single one.
One thing I'd like to point out too is that since the relays will be jumpered, it is very easy to have a block of DC and a block of AC coils. You can even split a few relays for AC sockets to control heaters or lights, a few relays to control AC solenoids, a few to control DC solenoids and a few to control exhaust fans to keep humidity at certain level. Yes, we can monitor humidity too :)
We could even get one of those light sensors that output levels of Red, Green and Blue spectrum and adjust LEDs to give you optimum spectrum for each of your cultures :)
That would be neat, huh?
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

I got hold of the solenoid company just in time. They inform me that they only have the valves in 12vDC and 120vAC. Let me know which you prefer and I'll change the order. For safety purposes I prefer the lower voltage valves around water, although 18 and 20 gauge wires can't carry much amperage either way. Let's go with 110vAC main voltage because it's in a dry room near my current house panel.

Let's put all the relays on one board as you suggest. I agree that putting a block of DC and a block of AC is a good idea.

The only way I know to lower winter humidity in a greenhouse is when it's raining indoors on me. So any humidity control will make the room easier to work in. It would be very neat to be able to mix frequencies on algae lighting, but probably it is overkill. I think total lumens is more important than spectrum with them.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

Cool. The coil voltage is your choice because the relays can handle either one.
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

then let's go with 12v DC.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

I'll PM you with the price details.
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Roberto, we are in no hurry on this, the details can wait a few days. Enjoy.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Roberto, I may end up using a number of float valves and probably should set up some water leak sensors. What type and how many I/O devices should we look at? And I told the solenoid valve company to send the first 30 solenoids as 12VDC.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

We can have several inputs for your floats and water leak detectors.
How about 16? Will that be enough?
They would be digital input at TTL level only. Usually they are used only to detect switch closures, like reed switches, float switches or relay switches. Would this be sufficient for your needs?
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Roberto, if another 16 inputs for floats can easily be upgraded in the future, then 16 is enough for now. Please let me know the price difference and I may go with 32 rather than 16. Thanks.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

We can make 32... no problem.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

Do you think you would need these inputs to be optically isolated?
Optical Isolation would create an isolation barrier which prevents the inputs to be burned up should you have any electrical discharge of any sort and also help with noise immunity a lot, especially when you are talking about so many inputs.
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Roberto, how do we take care of the GFI requirements for these relays? I would assume that I will just wire up a bunch of GFCI outlets into large gangs for protection. Alternatively, I can plug a power strip of a dozen outlets into a GFCI outlet to save a little money. Please let me know if there is protection built into your board like reset buttons or fuses.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: multiple pH meters, solenoids, PLC and IOs

Post by rimai »

Like we've talked before, the relays are not going to be powered relays.
So there is not going to be any protection on the board.
You will use jumper wires on the headers, so you can come up with your own power board with breakers/gfci for each block of relays.
Check the attached picture.
It will be a relay with the contacts brought to the header.
So each pair in the header will be use on the hot phase of the AC coil.
All neutral phases will have to be jumpered out together by you either in a ground terminal block or with twist-on nuts. Whichever way you prefer. That's going to be your side of the project. Then, if you want to place gfci on the AC circuit, it is also up to you.
I hope it's a little more clear to you.
Attachments
relay.png
relay.png (6.48 KiB) Viewed 5981 times
Roberto.
dave w
Posts: 14
Joined: Thu Nov 29, 2012 10:34 am

Re: multiple pH meters, solenoids, PLC and IOs

Post by dave w »

Thanks, now it is much more clear. I will take care of pulling power to the device and protecting the circuits.
Post Reply