Is there a way to have more than 127 addressable Arduino to work together - Currently working on a project idea that will require more than 127 Arduino and the I2C only supports up to 127
Thanks
Is there a way to have more than 127 addressable Arduino to work together - Currently working on a project idea that will require more than 127 Arduino and the I2C only supports up to 127
Thanks
Sure - use RS485, and assign addresses to each device, make the address 16 bits, and come up with your own protocol instead.
Here's a couple of application notes to get you started.
AN723 RS485 fail safe terminations.pdf (155 KB)
AN763 RS485 termination.pdf (234 KB)
AN-960 Analog Devices RS485.pdf (246 KB)
Yep, RS-485 can be good for 256 devices if you use the right transceivers (1/8th UL devices).
Rob
Can you tell more about the configuration?
Is there one master controlling N slaves ?
or is it peer to peer?
must any Arduino be capable to talk to any other directly?
What data rates are used?
What is the physical distance?
You could also use an I2C multiplexer?
Thanks for the feedback sent so far
I need a system which I can scale up to any number of arduino.
The idea is to have 1 master unit which will receive data from a PC or load data from a SD card. The data will be sent to the slave arduino which will have some items connected to it to perform a specific task. Although each slave arduino configuration will be exactly like each other, the actions each will perform will be different based on the data received.
The slave units will be around 10 cm to 15 cm apart from each other. The master unit can be located next to the slave units however need an easy way to send data to it. The length of the entire install may be from 3 meters to 100 meters and this is why I need a solution that scales on demand.
Adding to my complexity is that each slave unit has to be configured by non technical people in any configuration then program the slave id as they desire.
After some tinkering I have some other options which would like to receive point of view:
In case of wireless transmission, for distance, I was thinking of using a repeater unit which will get the data and send it back out to increase the distance covered. Data will be encrypted in some way just in case.
picture becomes more clear.
What about the data rate expected ?
bandwidth needed?
burst modes or continue?
(if wired is an option RS485 is a good candidate)
Sounding like RS485 is the way to go due to the # of connections and the distances for the wired units. RF-wise, that will depend on your spend limits for transmitter/receivers/transceivers.
Have a read of the answers in this post.
Data may look like 6750|M-200|S100|R255255255 for every arduino slave
The data will be sent once every 1 second at the worst case and at best at every 30 seconds or even more if the client desire more delay between each action.
Baud rate - the fastest possible without data loss as data will be sent for every unit
exorgroup:
Is there a way to have more than 127 addressable Arduino to work together - Currently working on a project idea that will require more than 127 Arduino and the I2C only supports up to 127Thanks
You would have a distance issue most likely without extending the i2c bus for that many also, unless they are on the same board.
RS485, thi Arduino Interchip Serial Communication library supporting RS485 is probably just what you need.
http://sourceforge.net/p/arduino-icsc/wiki/Home/
exorgroup:
Data may look like 6750|M-200|S100|R255255255 for every arduino slaveBaud rate - the fastest possible without data loss as data will be sent for every unit
This is 30 bytes of text but I assume the values are partly integers, and that | is used as separator.
assume 200 devices @30 bytes per second == 6000bytes /second = 65.000 baud
if the values are indeed integers you can send them binary and you do not need separators only a start and stop char.
written in binary format, using <> as start/stop chars
< ==> 1 byte
[6750] ==> 2 bytes
M ==> 1 byte
[-200] ==> 2 bytes
S ==> 1 byte
[100] ==> 1 byte
R ==> 1 byte
[255][255][255] ==> 3 bytes
==> 1 byte
OK there are assumptions made but it could be as less as 13 bytes,
so you can send 2-2.5x faster if you send the data as binary bits instead of text.
13 bytes x 200 devices = 3000bytes/second = 30Kbaud.
Please confirm the structure of the data packet. (fieldname and range per field)
e.g.
struct
{
int identifier;
byte RGB[3];
}
seen this thread - 1000 Arduinos cluster networking - Networking, Protocols, and Devices - Arduino Forum -
The structure you mentioned is correct - the numbers are integers and the letter is an identifier
Adding to my complexity is that each slave unit has to be configured by non technical people in any configuration then program the slave id as they desire.
Sounds like an adult toy setup 8) . If the slaves don't have to respond to the master, then a broadcast to all the arduinos should be possible, wired or wireless. Have you figured out how each individual arduino will know it is the recipient of the message?
Why do you need the letters, they are only normally of any use to a human but as the fields must be a fixed size anyway just dump the letters for more speed improvement.
Rob
@Graynomad - letters are required to identify the instruction as multiple devices will be connected to an arduino - This will allow me to send data only for the devices that need to be activated without the need to send data for the rest
What if I use a daisy chain of arduinos - found this post and looks interesting
Any idea how many devices can be in the chain?
6750|M-200|S100|R255255255
As far as I can see you only have the letters M, S, R and | (vert bar) how do they help addressing multiple Arduinos?
Any idea how many devices can be in the chain?
As many as you like, there is no physical limit but you have to think about propagation delay because at best you will have a one-character delay for every Arduino. So if there are 100 nodes #100 will get the message 99 x byte-times later than #1. At 115200 that's approx 8.6mS later. That may or may not matter in your application.
Rob
the first numbers identify the arduino - the letters identify the device on the arduino so as per my example I can do the following
6750|M-200|S100|R255255255 or 6750|R255255255 or 6750|M-200|R255255255 or use any other pattern I wish
Currently not excluding to have a start of message indicator in worst case scenario
As far as I can see you only have the letters M, S, R and | (vert bar) how do they help addressing multiple Arduinos?
Simple setup using letters to determine the servo to receive the servo command.
//zoomkat 11-22-12 simple delimited ',' string parse
//from serial port input (via serial monitor)
//and print result out serial port
//multi servos added
String readString;
#include <Servo.h>
Servo myservoa, myservob, myservoc, myservod; // create servo object to control a servo
void setup() {
Serial.begin(9600);
//myservoa.writeMicroseconds(1500); //set initial servo position if desired
myservoa.attach(6); //the pin for the servoa control
myservob.attach(7); //the pin for the servob control
myservoc.attach(8); //the pin for the servoc control
myservod.attach(9); //the pin for the servod control
Serial.println("multi-servo-delimit-test-dual-input-11-22-12"); // so I can keep track of what is loaded
}
void loop() {
//expect single strings like 700a, or 1500c, or 2000d,
//or like 30c, or 90a, or 180d,
//or combined like 30c,180b,70a,120d,
if (Serial.available()) {
char c = Serial.read(); //gets one byte from serial buffer
if (c == ',') {
if (readString.length() >1) {
Serial.println(readString); //prints string to serial port out
int n = readString.toInt(); //convert readString into a number
// auto select appropriate value, copied from someone elses code.
if(n >= 500)
{
Serial.print("writing Microseconds: ");
Serial.println(n);
if(readString.indexOf('a') >0) myservoa.writeMicroseconds(n);
if(readString.indexOf('b') >0) myservob.writeMicroseconds(n);
if(readString.indexOf('c') >0) myservoc.writeMicroseconds(n);
if(readString.indexOf('d') >0) myservod.writeMicroseconds(n);
}
else
{
Serial.print("writing Angle: ");
Serial.println(n);
if(readString.indexOf('a') >0) myservoa.write(n);
if(readString.indexOf('b') >0) myservob.write(n);
if(readString.indexOf('c') >0) myservoc.write(n);
if(readString.indexOf('d') >0) myservod.write(n);
}
readString=""; //clears variable for new input
}
}
else {
readString += c; //makes the string readString
}
}
}