For my college project i am operating 4 actuators independently, reading their states using built in potentiometers and illuminating LEDs to show the state of each actuator. The main issue i have is that between the control room and where the actuators are is 25 metres of cable trunking, meaning that i need to have seperate controllers, one in the control room and one with the actuators.
so therefore i'm looking at 4 SPDT switches as inputs and LEDs as ouputs in the control room, serial (485) comms to the actuator controller (using external relay control module to power actuators), the arduino controlling the actuators needs to control 8 relays on a module, by dropping the relevant pin to ground dependant on which actuator is requested using the switch in the control room and then using analog read to determine the position of each of the 4 actuators.
now i'm happy enough getting this to work on one board, but using two boards for this complicates it somewhat, i'm guessing i need to set up arrays of the inputs to each board (switches/pot value) that each board can read to enable the correct output (LED illumination / relay pin to ground).
Any advice will be greatly appreciated
One way to approach it would be to write the code that controls the hardware as if you were only going to use one arduino. Once it's working, replace all the code that touches the remote hardware with new functions e.g. digitalWrite becomes remoteDigitalWrite.
Initially, the new remote functions should just call their local counterpart i.e. remoteAnalogRead just calls analogRead so you can be sure you're passing and returning the right things.
Then code the remote functions so that they pass and return a packet of serial data to the remote e.g.
<DW;4;H> meaning digitalWrite pin four high on the remote Arduino.
Then write a sketch for the remote that parses your packets and controls the hardware.
do you have any further info regarding the remote functions?
thank you
The suggestion is simply that you get it working with a single arduino first. Then replace anything that interacts with the hardware with a new version that you provide. Initially, I'd just make that function call the original arduino function, but eventually you will need to have it pass instructions to the remote arduino over serial that the remote Arduino interprets and acts upon.
You could always start out with the two arduino version, but you seemed confident that you could get the single one going more easily.
Davemc89:
For my college project i am operating 4 actuators independently, reading their states using built in potentiometers and illuminating LEDs to show the state of each actuator. The main issue i have is that between the control room and where the actuators are is 25 metres of cable trunking, meaning that i need to have seperate controllers, one in the control room and one with the actuators.
so therefore i'm looking at 4 SPDT switches as inputs and LEDs as ouputs in the control room, serial (485) comms to the actuator controller (using external relay control module to power actuators), the arduino controlling the actuators needs to control 8 relays on a module, by dropping the relevant pin to ground dependant on which actuator is requested using the switch in the control room and then using analog read to determine the position of each of the 4 actuators.
now i'm happy enough getting this to work on one board, but using two boards for this complicates it somewhat, i'm guessing i need to set up arrays of the inputs to each board (switches/pot value) that each board can read to enable the correct output (LED illumination / relay pin to ground).
Any advice will be greatly appreciated
Can you post a block diagram of how you envisage the setup of your controllers and actuators and indicators please, showing the 25m link.
Thanks.. Tom.. 
wildbill:
The suggestion is simply that you get it working with a single arduino first. Then replace anything that interacts with the hardware with a new version that you provide. Initially, I'd just make that function call the original arduino function, but eventually you will need to have it pass instructions to the remote arduino over serial that the remote Arduino interprets and acts upon.
You could always start out with the two arduino version, but you seemed confident that you could get the single one going more easily.
TomGeorge:
Can you post a block diagram of how you envisage the setup of your controllers and actuators and indicators please, showing the 25m link.
Thanks.. Tom.. 
i have it working with one Mega, my code is attached. i have two megas to use, so how would i alter that code on both to call the functions and send the feedback to the master? i presume it will be best to get this working with two boards side by side without worrying about the distance initially and then tackling the long distance aspect
project code.txt (4.73 KB)