Using multiple Arduinos with [maxuino]
I've got this project where we needed a few dozen photosensors, so we hooked up three Arduino boards (two Megas and a Due) to get 38 analog inputs. I'm also using maxuino (the latest version, 0.09) to read in data from the three boards.
When I use one board, the whole thing works perfectly; at two boards it gets a little laggy, and at three it gets really laggy. One idea I had was that since maxuino uses the [qmetro] to poll [serial] I would just remove the [qmetro] and use one [qmetro] for all three objects. Would this make any sort of difference?
Basically, the problem is that with three boards going instead of tracking the object across the whole array of photosensors, the data is only updated every 700-1000 ms, so it's just a series of chunks. I need it to respond much more quickly, and using three [maxuino]s is not working.
Also, when [serial] is polled, does it send all of its relevant information no matter what, then sort it out later? I'm wondering if rewriting the Arduino code so that it only sent analog instead of (possibly) sending all of its data then leaving it up to [serial] to decide which data to pass on. It's not doing that much, but would optimizing that code greatly increase the efficiency? Has anyone else had this problem with multiple Arduinos?
I should also say that this is for an interactive sculpture that's already installed at the gallery, and I may not be able to work on it until Friday. So, any suggestions will be tried and used then, and I'll report back. Thanks in advance.
It may be a little late for you to change your setup, but have you considered multiplexing the photosensors?
http://www.arduino.cc/playground/Learning/4051
Wow, never considered multiplexing--that's a great idea though. I don't really have time to do it, as it's all installed in the gallery and the wires are all soldered directly to the arduino boards, but it's definitely something good to know about. Thanks.
If you do end up interested in re-engineering it with a multiplexing setup, check out the firmware here: http://pixlpa.com/blog/arduino-sensorbox-firmware
Included is code for supporting up to 6 multiplexed 4051 analog inputs. That will give you a total of 48 inputs in one Arduino.
AB