I have a pi that controls and monitors stuff in the garden, in the house on different floors and such. Currently I have multicore cables running around but I am at the limit of my GPIO pins and I want to expand the system. So for instance I want 8 digital inputs (capable of 1kHz sampling) and 8 digital outputs at the end of the garden.
As I say currently the system is simple with little external digital electronics but I probably need to change this so that my data acquisition and control happens at the remote end of the cable and I just use the cable (ie, for instance, the cable to the end of the garden) for serial data rather than parallel control signals as it currently is.
So as an example, I have 8 water valves at the end of the garden controlled by the PI GPIO pins through relay boards which are at the PI end (at the house). And I have flow sensors which measure the water flow (and convert it to pulses) and report this back to the PI via optoisolators (the PI polls the relevant pins at 1kHz to check their state and calculates water flow from that).
So I want to make a remote IO port essentially (or several of them). I2C is difficult to electrically isolate and not good with long cable runs, SPI is also not in its comfort zone at long distances. I don't want to make a huge project of it electronically, and I have been mulling it over thinking one way is simple a shift register at the remote end (for the control requirements). So I would need to have a wire for each of: Clock (only pulsed when data is being sent to the shift register), output enable, data, and ground. When I want to change the state of any pin on the shift register I would have to pulse the clock wire a few times and use another GPIO pin to pulse the relevant data on to the data line. Easy to isolate electrically but it seems a bit messy (for instance, when I put the outputs into high impedance state when I write a new byte to the output chip, the pins would be pulled down to ground and I would get a glitch during the write which is not ideal).
Are there any other ways of doing this? Without resorting to programming my own PIC etc, I want to be able to convert this project from direct GPIO control to this new method quickly and without too much work. Seems there should be a chip more suited to the task, ideally one which has a few pins on it to set an address so that it watches for its own 'select' word on the data line and enables itself when it sees its identifier (reads the next data word and puts that on its outputs). Then I could bus several of these on the same wire. A UART seems the wrong choice to me because it seems to be designed for use by a microprocessor. But maybe I am missing something, hence asking here.
Also I need a solution for the return data (IE remote data acquisition - to report back to the PI the state of 8 pins at the end of the garden once again) - but it can be a different chip, I can have input and output using different wires. But I think maybe that once I know the best way to approach the control side of the problem the acquisition aspect might be a simple extension of that.
I only need to sample and control at a rate of 1kHz max.