I have created a farm model about 5 foot by 6 foot in size and added some automation, turning on and off lights, opening and closing doors etc. This was all controlled by one Arduino. I am now adding more automation to the model, which now requires me to add more arduinos.
My plan is to have around 5 arudinos, one will act as a master control displaying info on an lcd display and sending a clock signal to the rest so that things happen in a timed sequence.
So I have been looking into how to send info between arduinos, so if I use serial comms this only allows two arduinos to talk to each other.
I have tried using i2c comms but without a lot of success, I have managed to get the receiving Arduino to read and parse the commands sent to it but when I try to then get the Arduino to do something about the command the Arduino appears to hang. So far I haven’t managed to debug this problem but I have seen on line that i2c comms can only be used over a short distance, (a few cms) not the 5 or 6 feet I would need to be able to send the signal.
I could use nfr2401 chips but that seems a little over kill.
Would anyone have any other suggestions on how to get the arduinos to talk to each other?
Well have you considered extending the wires to the LEDs rather than the communication lines? That way you just need to spec the LED resistors to account for the voltage drop of the longer wires. Also extra Arduinos may be overkill, have you considered using a chip like a PCF8574 i/o expansion chips.
Great job starting on a model farm especially with the automation, I meant to add lots of automation to mine but haven’t managed it yet.
Version 1 of the model farm only used one Arduino with long wires running round the model for the leds and servos and it used all the ports on the Arduino.
So for version 2 I am adding a few more servos for doors and I was also going to try one (or more) stepper motors to try and get cows moving on a conveyor belt ( a bit ambitious I know ) and maybe a water pump to move coloured water in a slurry pit ( not completely sure about this bit ) so I need more ports which is why I thought I would need more Arduinos, I am new to the whole electronics scene so I didn’t know anything about I/o expansion chips, but looking at what you suggested they seem like a good idea.
I just have a couple of questions, I have seen examples where you can use a PCF8574 to turn on leds and also to accept input from a button, but can it also be used to control a servo or read the input from a potentiometer?
Even if they don’t I should still be able to make good use of them.
So I have been looking into expansion chips and I found pcf8591 it looks like the kind of thing I would need to read the input from a potentiometer and control a servo. It has 4 inputs and 1 output so not the perfect ratio but it saves on extra arduinos should still be good.