I am planning to build a spaceship control panel, which will control a software spaceship programed in Processing. I have already made a small panel with a number of buttons and switches, which controls a small ship on the screen (you can steer it, and do some other, minor things as well).
My next step is to create a more sophisticated mathematical model for a bigger ship, but in order for a number of people to operate it - I need to decide on the following:
should:
several switches/buttons be all connected to one board (in this case some of the wires will stretch for a meter/a meter and a half, to get connected to the main panel)
2-3 arduino UNO boards be connected via serial ports to the arduino Mega board (it is said to have 3-4 separate serial ports - thus I am thinking of connecting 2-4 arduinios to it), in such case only the serial wires must be long.
3*) I would also like to have a separate screen run for each conrol panel. At the asme time - to communicate between Processing and Arduino I also need a serial port (arduino uno has only one)
// Now that I come think of it, may be I am wrong, I am using a usb cable to link arduino to the laptop with Processing. At the same time, the board itself has some pins, labled tx / rx - so, may be, I can connect it to the other board AND to computer. However, I read somewhere that Arduino Uno can only establish one serial connection at a time (be it a virtual port or not).
which is better?
The Uno has one hardware serial port. It uses pins 0 and 1, which is why they are labelled RX and TX. These pins cannot be used for anything else if you are going to use the hardware serial.
In addition you can use the SoftwareSerial library to define other serial ports using any digital pins but only one of the soft serial ports can be active at a time because they all use the same receive buffer. You can manage this by defining which is active at any one time but it can get complicated.
It seems to me that you need to work out what needs to be done where and why.
At the moment the only function I really see the Arduino performing is input from buttons and switches and perhaps some output to LEDs. A PC is providing a lot of visual output for Life Support and Propulsion (and perhaps some input as well?).
Personally I would use a single Arduino handling all the hardwired I/O and passing messages back to most of the logic which would reside on the PC. The PC would get the messages which would tell it the state of the hardwired I/O and it would then manipulate the spaceship object.
It is not obvious to me why you would need so many Arduinos and serial links unless you feel you need redundancy to monitor the dilithium crystals which can be unstable.
radman, you might be right, I'll rethink the concept. I thought of placing different control panels in different places, and thus needed a lot of arduinos. But if, say, I use only one of them, then, how long can the wires be, to still get the signal from the pressed button (I guess it depends on the resistance of the wire, isn't it?)?
radman, you might be right, I'll rethink the concept. I thought of placing different control panels in different places, and thus needed a lot of arduinos. But if, say, I use only one of them, then, how long can the wires be, to still get the signal from the pressed button (I guess it depends on the resistance of the wire, isn't it?)?
I'll certainly look into I2C communication.
For connecting to different panels, you might want to consider using RJ-45 cat 5/6 (ethernet) cables to bring multiple wires to each panel. For separate parts, it is real convenient to be able to unhook a single wire rather than dealing with each individual wire.
Cat 5 cables have 8 wires in them, so you could use one wire for ground, 6 wires for input/output, and 1 wire for power (for the inputs, if you only have digital leds/buttons, you can use the 7th wire as a button instead of power). Be sure to test the cables you get since some cheap cables don't have all 8 wires connected (ethernet doesn't use all 8 wires).
The spec for cat 5 is it should be able to pass data up to 100m without needing repeaters. You probably want to go a lot less than that unless you put in something with error correction between the Arduino and devices. But 5-10m should be ok.
[edit]
As an alternative to cat5 cables, consider using either RJ-11 (US phone jacks) or 2.5mm/3.5mm audio cables to bring out 4 wires to the other platforms. At Radio Shack (in the USA) you can pick up the various components:
All the switches and buttons are doing is making a circuit open or closed. For your 2m control panel the distance will not be an issue for the inputs. If the control panel has ouputs then you need to put power down the wires to drive the LED output etc. the higher the resistance of the wire the more power you will lose and the dimmer the output.
The main reason for getting rid of the multiple Arduinos and serial interfaces is simplicity. Debugging multiple communicating processors can be tricky.
With the Arduino handling the I/O and the PC managing the video and spaceship object the interface between the PC and the Arduino becomes simple to test.
Cat 5 is rated for that distance only when used as intended, as balanced twisted pair properly driven and terminated. You may get more or less distance, depending on how you use it.
10 and 100 Ethernet use two pair, Gigabit Ethernet uses all four pair.
That said, I agree that something like Ethernet cable would be a quick and easy way to connect and disconnect.
I love the idea, BTW. I started such a project a few years ago, then funding for the project dried up.
Look at the CATkit and Kitten boards from http://boxabits.com which are CAT5 shields and breakouts to allow 18 signals to be accessed over CAT5 cabling. There is also a universal Kitten board that allows connections from any micro controller (Raspberry Pi, BeagleBoard, Arduino MEGA, DUE, etc) over CAT5.
To drive the LED on the distant controls board use transistors and a power supply per control board.
E-net cable is over kill, ribbon cable for 3/4 meters would be better
The big one ditch the use of processing and go for java or visual c/c++. This will allow you to put up many different screens on the PC or pass the data to many different PC's (one per station) + 1 for Captain Kirk.
The only role I can see for an Arduino would be to let you build your own keyboard hardware (which plugs into a PC via USB and appears as a standard keyboard) and as an output driver to enable the PC to drive LEDs and dials. I wouldn't use the Arduino for any communication or control logic. Over those distances I'd use USB for everything and have a device at each switch panel which has the physical switches on one interface and presents a USB keyboard on the other. That could either be an Arduino with USB client emulation, or a standard physical keyboard with the key switches replaced with your external switches.
In order to connect all these remote keyboards back to a small number of USB ports at the PC you would use a USB hub.