Hello,
Can i establish a serial communication between two Arduino ICs ?
I want to send command from master to slave.
I have uploaded the circuit diagram, i wanted to know if it will work...
That should work, the GNDs have to be connected as well which is shown in the schematic but people are inclined to forget when the chips are separate.
How far apart will they be?
Rob
Thanks a lot.. yes their grounds are connected.. they are on the same PCB
Whilst that looks like it should work, I would be using I2C instead. That lets you do master/slave and can generate an interrupt when a "packet" of information has arrived. Whilst incoming serial generates interrupts you have to "poll" for Serial.available in your main loop.
Examples:
The fastest I2C rate is around 40,000 bytes per second, compared with around 11,520 bytes per second with serial running at 115200 baud.
All you would have to do is connect together SDA and SCL (and Ground). Unlike serial you do not swap them. Also read the part about it helping to use pull-up resistors.
This has the advantage that it leaves the serial port free for debugging, or uploading new programs with an FTDI cable.
Yes, now that we know the chips are on the same board I'd also say use I2C.
Rob
You can do arduino to arduino with Bluetooth, that's easy. Knowing exactly what your sending and receiving may be a little tricky.
But it is possible, because I myself am using arduino to arduino with my robot.
Checkout my YouTube channel HazardOfExistance, I posted an update of my college seminar project that does just that.
The only downside with Bluetooth, is the range. Bluetooth's range is short, about 30 feet, in an open area. If you want range, then go with Xbee.
He did say they were on the same PCB.
Oh my mistake, I only read the first post, and figured they were in separate locations.
Why have them on the same pcb then, unless you want to expand your I/O pins.
Out of interest, what is the longest practical length you can run I2C wires in a noiseless environment?
I think it is governed by the capacitance of the wiring rather than the length, but in any case you can adjust the clock speed over a wide range, so there is probably no simple answer. Purely as an example, the Wii nunchuk uses I2C, and has about a 1m cable length from the device to the plug.
Thanks Nick.
The only option for reasonable distance, high speed comms is RS485?
That's interesting about the nunchuk. I assumed that the switches/joystick were hardwired through to the console.
Here's my nunchuk connected to an Arduino using a nunchuk adapter board (from Sparkfun I think):
I think there are I2C extenders. Because of the way the protocol works I doubt that RS485 would work.
Example: P82B715
According to their datasheet:
It uses unidirectional analog current amplification to increase the current sink capability of I2C-bus chips by a factor of 10 and to change the I2C-bus specification limit of 400 pF to a 4 nF system limit. This allows I2C-bus, or similar bus systems, to be extended over long distances using conventional cables and without degradation of system performance.
But for Serial (and/or probably SPI) I think you could use RS485. I think I tested RS485 up to 20m but you could likely go further:
Thanks a lot everyone for replying..
I have connected two arduinos by establishing a serial communication between them and its working perfectly.