I am just starting with Arduinos and have a problem which is probably pretty simple and might have been answered before, but I just couldn't find anything useful...
The problem:
For the moment I have 11 valves (later ~64 to 80), which are operating at 24 V and are controlled from another computer with DOS software.
We need the info of the valve positions (on / off) on another computer, and since I will use an Arduino anyway for controlling an MFC I would like to use the Arduino for reading the valve positions as well.
Making a voltage divider with two resistors for lowering the voltage to < 5 V to use a digital input pin is quite easy (though I am still wondering if I need a Z diode and how to connect it...).
But now I stumpled over the fact, that the valves have a common 24 V and are switched on and off via individual GND. Thus I cannot just connect Arduinos GND to common GND of the valves and get my 5 V signal from the individual valves with the voltage divider, since the the valves don't have common GND. So there must be another way to get 5 V from each valve into a digital pin of my Arduino Uno, but I just dunno how.
Hm... is it clear what I am trying to do and what my problem is? Was thinking about the pullup resistor thing, whether that can help me, but didn't figure out how.
I think it's just the same. You take the voltage from between the terminals on the valves (not the common terminals) and the switches/relays, put this through a voltage divider and read the signal with a digital input pin. The only difference is that the digital input will read HIGH until the valve is activated, when it will read LOW.
Yes, zener diodes would be a good idea. 5V ones connected between ground and the digital pin.
PaulRB:
Yes, zener diodes would be a good idea. 5V ones connected between ground and the digital pin.
I think it's a poor idea.
A zener only works if you leave the Arduino always on.
If the Arduino is off, only 0.5volt is allowed on a pin.
Be careful with 11 (or more) voltage dividers as well.
If resistor values are too low, then they could phantom-power the Arduino.
If the resistor between valve and input is 100k, and you use 80 valves through port expanders, then ~15mA could flow to Arduino's VCC through the pin protection diodes.
I would probably use a 220k:56k divider, with a 100n ceramic cap from pin to ground.
You could go one step further and let the Arduino control 80 valves with 10 TPIC6*595 shift registers, and use your DOS computer for data input/output.
Or 74HC595+mosfet if the valve current is too high.
CrossRoads (moderator here) sells boards that can switch a large amount of valves/solenoids.
Leo..
Thank you for your reply!
I also had the feeling all the time that it should be almost the same, but still I don't manage to come up with the wiring, since I have no clue how to connect Arduinos GND, since I cannot put negative voltages into the digital pins. I am making crappy drawings all the time, but didn't get any further yet.
Maybe I should find a tool for creating a wiring diagram and upload it to show where I am stuck.
About the zener diodes: How do I connect them, they should be parallel to the resistor between 5V and GND, right?
Wawa:
Be careful with 11 (or more) voltage dividers as well.
If resistor values are too low, then they could phantom-power the Arduino.
If the resistor between valve and input is 100k, and you use 80 valves through port expanders, then ~15mA could flow to Arduino's VCC.
Leo..
For testing with one valve I used 47k and 10k resistors today, but was thinking about ordering 470k and 100k resistors tomorrow.
Wawa:
I would probably use a 220k:56k divider, with a 100n ceramic cap from pin to ground.
You could go one step further and let the Arduino control 80 valves with 10 TPIC6*595 shift registers, and use your DOS computer for data input/output.
Or 74HC595+mosfet if the valve current is too high.
CrossRoads (moderator here) sells boards that can switch a large amount of valves/solenoids.
Leo..
I was thinking about 470k and 100k to be a bit below 5V (about 4.3V) at the Arduino input, just to make sure V doesn't get to high, dunno if there are voltage fluctuations while switching or so... Seems the Arduino reads voltages > 3V as high, so the ratio should still be ok.
But I might add the ceramic cap.
Unfortunately, I cannot use the DOS computer for controlling the valves, since it is a more complex system including the valves, many sensors, a GC, etc. Unfortunately running under DOS, even though the whole thing was set up only about 3 years ago. And of course we don't have the source code. Otherwise I would just try to send the valve status directly to the other computer, e.g. via a serial connection
Krachbummente:
I was thinking about 470k and 100k to be a bit below 5V (about 4.3V) at the Arduino input, just to make sure V doesn't get to high...
Arduino switch points are 0.3VCC and 0.6VCC, so 1:5 would also work.
There are clamping diodes on each pin that prevent voltage getting too high, and >100k reduces fault current to a safe value.
Use 220k and 56k, so you have a good defined HIGH (4.87volt).
Use the 220k (and 56k/cap) near the Arduino pin, not near the valve.
Then the wiring can't act as an aerial for the pin.
Leo..
Ok, unfortunately, my main problem is still not solved - the wiring, since the common 24 V of the valves still confuses me. I know a bit programming, but it's really the first time I put components together.
So I attached two wiring diagrams, the first is my initial plan to show what I was thinking about, but this does not work since 24 V and GND are inverted relative to my first assumption...
The second one is what I came up with after almost a whole day of thinking
I am pretty sure that this is not the way I should do it, but I just don't figure out where to connect Arduinos GND (or 5 V alternatively).
Any suggestions what to modify?
Would be really great!!
Cheers,
Jan
PS: of course I could save some resistors in the diagram.....
I think thats close to the setup which I had for testing, but with just one valve only.
But my problem is: when I connect all 11 valves GND to Arduinos GND... then I will activate all valves, since usually the relays switch GND for the individual valves on and of...
I am not far from ordering an Arduino for each valve, just to fix this asap. Unfortunately, this might work for 11 valves, but probably not for 64 valves at a later stage :o
Krachbummente:
But my problem is: when I connect all 11 valves GND to Arduinos GND... then I will activate all valves, since usually the relays switch GND for the individual valves on and of...
Grumpy_Mike's diagram is correct.
It won't activate any valve, since the resistance across the relay contact is very high.
I assume here that there is only one 24volt supply for all the valves.
And only one wire/connection between Arduino ground and supply negative.
Leo..
Wawa:
Grumpy_Mike's diagram is correct.
It won't activate any valve, since the resistance across the relay contact is very high.
I assume here that there is only one 24volt supply for all the valves.
And only one wire/connection between Arduino ground and supply negative.
Leo..
Seems I still don't understand where to get the GND from the valves which I have to connect to Arduinos GND...
The valves all have 24 V permanently from the same line. When I connect all eleven valves GND to each other as well, and get one of the relays closes the circuit, the all valves should open the same time (if pelay and PSU can handle the current...).
Where am I wrong...?
I would manage to do the wiring in your diagram for one valve, in fact I did already for testing, it worked fine.
But since I have 11 GND wires coming from a mysterious interface / relay box to the individual valves, but have only one GND on the Arduino - where to connect these 11 GND wires to? (or 64 at a later stage...)
Do you know what I mean?
Seems to me nobody sees the problem I see... Probably its just a tiny thing I overlooked, but I just cannot figure it out what it is.
but have only one GND on the Arduino - where to connect these 11 GND wires to?
As the grounds from the valve power supply are all connected to the same place inside the valve power supply, there is only need to connect one ground to the Arduino ground.
It is to give the Arduino a voltage reference. You don't need any more grounds unless you have another valve power supply. Then just connect the ground from the second valve power supply to the ground of the first valve power supply.
Grumpy_Mike:
As the grounds from the valve power supply are all connected to the same place inside the valve power supply, there is only need to connect one ground to the Arduino ground.
It is to give the Arduino a voltage reference. You don't need any more grounds unless you have another valve power supply. Then just connect the ground from the second valve power supply to the ground of the first valve power supply.
See this for why you need a ground in the first place. Power Supplies
Hm, ok, maybe my understanding of ground is wrong, will google it tonight. For me, ground is 0 V when the other wire has 24 V. Or is ground always the common wire, which makes my 24 V in fact ground (0 V) and my "previous" ground (minus) -24 V?
In my wiring the relays would usually only close the 0 V (for me GND... so far...) of one valve at a time, while GND is open for the others, i.e. having one of them connected to the Arduino GND would be essentially be the same as connecting... like nothing... or what did I get wrong here?