I’ve been learning about serial communications for a project, but I think my wiring situation won’t really allow clean communication. I have two irrigation controller wires traveling over 1200 ft with multiple connections on my common wire. Clearly, I cannot use a twisted pair or any network structure since irrigation stations aren’t laid-out in anyway similar to the rs-XXX protocols. I need to transmit a number, 0-99 say, from one arduino to another. I’ve looked into half-duplex rs-485, but I don’t have twisted pair wires, as I’ve mentioned.
I was thinking I could use an opto-isolator to level up for the distance, but is there a way to code the arduino to send a number of pulses and then send some sort of terminator before repeating so another arduino could read it and count out a number? I assume if I have it repeat, it could use some sort of error correction by averaging the counts. I don’t need crazy fast speeds…10 repeats per second would be plenty fast.
Anyone have any ideas so I don’t have to re-invent serial communication?
I would still use RS485 / RS422 even though you don’t have twisted pair, but you’ll obviously need to limit the baud rate. The differential signaling used will give MUCH better results than “single ended” signaling. You should have no big problem with the distances and baud rates you’re looking at.
There are plenty of driver chips you could use; connect them to UARTs on the Arduinos. You may want to implement CRC or similar to reduce errors.
Make sure there is a common ground wire somewhere in your wiring. I assume there will be, but some people omit this because they assume the differential signaling will be OK without it. In some cases this is correct; the driver chips can tolerate a certain amount of common-mode noise without errors, but no more than a few volts.
Unfortunately, I only have access to two lines at a time. My common wire has multiple endings, but my controller wire is a single running from my clock to each valve. Will I need to terminate all of my common wires with resistors? And to what?
How are you powering the nodes? If you are running power cables, then just use the negative power supply lead as signal ground.
An RS485 circuit MAY work without a common ground, but I wouldn’t try it. As I said, you really should have some common “ground” reference between the different nodes. Normally this is a separate wire or shield in the case of shielded cables. In some situations, it is acceptable to use a less-than-ideal “ground” reference such as a building “earth”, but note that the “earth” voltages can vary. RS485 specifies the “ground” (common-mode) voltage must be within -7Volts to +12Volts.
It is advisable to put a 100 ohm resistor between the signal “ground” at each node, and whatever common ground you are using, to limit any ground currents.
If there REALLY isn’t a common ground you can use, it might be better to try a “single ended” signaling protocol such as RS232. To implement a bi-directional, half-duplex “RS232” protocol would probably require using RS232 driver chips that have “enable” lines for the outputs, and implementing a master / slave protocol in your microcontroller code. You MAY be able to achieve 1200’ if you use 1200 baud, but it would depend on other factors in the installation…
As for terminating resistors, RS485 normally only terminates each end of the network (usually 120 ohms, but can be higher to save power).
I was hoping to use my 18V DeWalt battery pack and a power regulation circuit for the power. Since I’m running adjacent to about 3000’ of copper pipe that runs 2’ below grade, would it work to connect all of my common grounds to the mainline copper? Or since I’m landscaping in the dirt 90% of the time, could I drive a metal rod into the actual “earth” and get a consistent reading?
Next time, I’ll price out running some CAT5 cable to all of my manifolds!
Copper pipe would work well if it’s run to all the nodes. Using earth stakes is not good, since the local “earth” voltage can vary considerably, especially over distances of hundreds of feet. The difference in “earth” potential could easily exceed the -7 to +12V common-mode range of the RS485 drivers.
I’m not sure I understand what you mean re the battery pack - I assume each node won’t have its own battery? In that case, there must be power cable going to each node?
I’m confused about the end result you’re trying to achieve. If this is a permanent installation, why are you using battery packs instead of sending power down the cables? If you’re worried about not having enough wires, there are schemes for sending power and data over the same wires.
I’ve been trying to set this viewtopic.php?f=14&t=18065 project up for months now. I finally have multiple arduinos for each end of my run and an LCD for a display, so I’m quite eager to figure out the coding/remaining hardware necessary. If I can get serial to work, then my coding is just about done using softserial for multiple pins - or just Tx & Rx for a single set of wires.
I don’t know anything, yet, about sending data and power along my two wires.
In all honesty, it sounds like you need a power line communications system. Your goal is to couple a signal over your power wire.
This is really RF design at this point. You need a modulator, amplifier, demodulator, lots of error correction, and some logic to control who is transmitting. Couple this over your power wire capacitively. You’ll only need to run at a few kHz since I doubt this is a data-rate critical application.
If your wiring is point to point, you can do a simpler scheme much like 1-wire, where you charge up a reservoir at the end device, and then initiate communication by pulsing the power wire. This can extend to multiple drops along a wire, but if devices are consuming large amounts of current (like valve solenoids) this may be suboptimal. If you lookup US patent 7358626 and 7619322 Toro already has a system similar to this. Their system involves AC powered end devices, which allows them to switch the polarity of the system for communication, with a current based data return system (if I am reading it correctly).
Previously, I would hook-up a battery to my two wires on one end and light up an LED on the other end. I could wire up a 555 timer and strobe a count of flashes pause repeat, however, couldn’t I have an MCU pick up those pulses passively? If I run an optoisolator, is there a way to code in an error checking procedure?
And if so, why can’t I have an MCU send the pulses so I can dial-up any number I want?
All I want to do is to tell the Tx what number of pulses to send (1 thru 99, say) and have an MCU at the other end counting, then printing out onto a screen. Would it be that hard to send a nice square wave at less than 1kHz?
Option 2 - XBeePro communication and just iterate a button code to switch terminals on the Tx module lighting up LEDs at the Rx with the “next” button…
I’m a landscaper with very large irrigation installations. Often I have to run my controller wires (1 solid 14gauge per station and 1 solid 14 gauge common) before I can install my controller clock. Sometimes I have over 40 station wires and several common wires all in a bundle coming into a closet in a building. At this point, I have no idea which wire goes to which valve. My current low-level work around is to hook up a battery to the common and one controller wire, go into the closet, and search out which of the 40 wires has power coming through it with an LED that lights up. Label the wire and then walk 3000’ to change the battery to another controller wire. Time consuming to say the least.
I’d like to be able to hook-up a Tx device that would send the number of the station to the closet where I can find the signalling wire and then “read” the station number off of it with an Rx unit. Since I have 3 to 4 valves per manifold, I’d love to be able to hook-up all four controller wires (and the common) and then label all of them at once in the closet(hence the need for more than a blinking light).
I know I can run differing levels of power with resistor leveling, but this has some limitations for “transferring” the technology to my crew. They could read a number from an LCD panel, but might not get the idea of differing voltages on a multi-meter.
I’ve been curious about using serial communication for this, but perhaps I should be looking into a 1-wire solution for power and data. Perhaps I should use an XBEE device for triggering the power send (push button addressing on sending unit?). I seem to have hit a wall due to the random nature of irrigation wiring installations…
What about going the other way? A box at the controller that sends a different message out each line, and a little box you use in the field with a display on it? That would solve any issues with determining which is the common and which is the signal. Maybe use current pulses rather than voltage to reduce the effect of voltage drop from the wires?
I’m sorry for not being clearer…my common wires are all white and the bundle of station wires are genereally all red. So I know at every point which is my common and it spiders to every manifold in the system.
The more information I have, the crazier this project seems. I have a multi-trunking common that runs everywhere with multiple stubs going all over. The electrical weight of 3000’ of wire is probably a great obstacle to overcome.
At this point, I’m thinking of just using a sender unit that can know what station it is supposed to be (1-99) that can be triggered by an Xbee master unit which will then be able to read which wire just turned on, probably by lighting an LED. The cost is greater, but the prototyping will be easier (he says knowing nothing of XBee and Arduino programming).
“I know I can run differing levels of power with resistor leveling, but this has some limitations for “transferring” the technology to my crew. They could read a number from an LCD panel, but might not get the idea of differing voltages on a multi-meter.”
Create an interface in the control station that consists of a an arduino with a hefty megaohm resistors for impedance isolation, and read the varying voltages coming back from the valves. For any given voltage, the arduino will display the associated valve number. You are essentially creating a “dumbed down/specially crafted” multimeter using the arduino analog input ports, and the arduino is left in a relatively safe environment. I’ve seen alarm systems that work on this principle. They use different resistor values to set a voltage in a multiple sensor loop that is identifiable by the alarm controller. There are multiple resistors for one loop, and when the sensor goes into alarm, the resistor for that sensor is shorted, so the sum (can be a parallel, ladder like system as well) of the remaining resistors left in the circuit determines the voltage that allows the system to determine what sensor actually tripped. I think for what you are doing, you need a rugged, dumb sensor at each end point, not a delicate system spewing back serial communications.
Be careful! Electricity and grounded copper pipes is a recipe for electrocution, but I’m sure your well aware of that.
Not too worried about electro-shock aversion therapy. The 18v battery shouldn’t send too much my way. Not interested in hooking up to line voltage, so…
Would there be an easy way to setup the resistors in some sort of selector circuit, so I could dial in the “station-voltage” that would signal a number to a pre-programmed arduino, or, would the circuit need to be calibrated each time? I’d love to be able to set up a voltage chart in my arduino and be able to reliably “dial up” a station number.
If I understand this, you want to avoid a lot of walking around. Therefore, you want to attach a Tx device at each remote station, then be able to attach a Rx unit to each wire at the control box and read off its ID from a display.
I think this could be achieved by sending an ID using RS485 over 2 wires, although I would check this with a sample of cable first. Bit rate could be as low as 300 baud since you only need one byte of data to hold the id. I’m not sure which Arduino you have, but you will need a TTL to RS485 converter. There are cheap ICs to do this, but packaged solutions tend to be expensive. Sparkfun have an [adaptor that might be suitable, but it’s hard to tell from the limited spec.