Active1 year, 3 months ago
Arduino supports serial communication through digital pins with the SoftwareSerial Library as well. This allows the user to connect multiple serial-enabled devices and leave the main serial port available for the USB. Software serial and hardware serial - Most microcontrollers have hardware designed to communicate with other serial devices. These cables connect to PC with different COM ports. You can check these COM Port by accessing 'Device Manager' on your PC. Compile the example code and uploads to Arduino by clicking 'Upload' button on Arduino IDE. Run a Serial software such as TeraTerm, connect to COM port corresponding to RS232-to-USB cable. We can stack multiple. Want to talk to multiple I2C sensors but have only one address? All the Ports! And I2C Multiplexing. Want to talk to multiple I2C sensors but have only one address? The PCA9548A is an I 2 C device that connects to the Arduino. Its default address is 0x70. If you read from this device it will give you one byte: 0b.
I am working on an application where I am required to communicate with 6 Arduino Unos from one master Arduino Uno. the six Arduino boards are placed at the 1-meter distance from the main Arduino Uno. Therefore I cannot use SPI or I2C am I correct? is this possible to do with software UARTs in Arduino Uno? 6 UARTs communication with software serial? if this is not possible how to do this?
iopertykiiopertyki
2 Answers
My recommendation is to use RS485. RS485, instead of RS232 (The Serial you are using), is a protocol that enables several devices communicated on the same serial line.
For you to use this, you need to buy 6 RS485 IC, each one connecting directly to the regular serial port of the Arduino. RS485 works the same as RS232 Serial, but is an half-duplex channel where several devices can connect at the same time.
Ricardo AlvesRicardo Alves
1 Meter is not a very large distance. I have been able to use the I2C communication over that distance, on a system of Atmega8 controllers, back when I didn't understand the beauty of Arduino. Had 3 of them connected to an Olimax Linux board, over a distance of 1 meter from the Linux board.
It should be no problem for the Arduino.
NitroNitro9601 gold badge4 silver badges16 bronze badges
Not the answer you're looking for? Browse other questions tagged arduinouart or ask your own question.
Use Serial Communications with Arduino Hardware
Arduino® hardware has serial ports, also known as UARTs,that can communicate with other devices that have serial interfaces.
Arduino With 2 Serial Ports
Hardware
You can use serial port 0 to communicate with other devicesthat have serial ports, or to communicate with a computer over theUSB port. Each serial port supports one Serial Transmit and one SerialReceive block, one block per pin. You can run your model in the Externalmode for all the Arduino boards.To know pin mapping for different Arduino boards,see Pin Mapping Table in: Pin Mapping on Arduino Blocks.
Warning
Do not connect the serial port pins to an RS-232 serial interface,such as the DE-9M connector on a computer, without limiting the voltage.The RS-232 standard allows higher voltages that can damage your hardware.For details, read the documentation for your Arduino hardware.
Transmit Serial Data
Software Serial Generator
To transmit data through a serial port or USB port on the Arduinohardware:
- Add the Serial Transmit block to your model.
- Connect a data source to the block input on the SerialTransmit block.If the data type is not uint8, use a Data Type Conversion blockto convert it to uint8.
- In the Arduino Serial Transmit block,select a Port number.
- Click the Tools menu in the model, and select Run on Target HardwareOptions.In the Configuration Parameters dialog that opens, on the HardwareImplementation > Serial port properties, set the baud rate forthe serial port you selected in the Arduino Serial Transmit block.
- Connect the appropriate digital transmit pin to thehardware that receives the data.
- Run the model, as described in Run Model on Arduino Hardware.
- If your model uses the Arduino USB port (Serialport 0) to transmit data to a device that is not your host computer,reconnect the USB cable to that device and press the RESET button.
Receive Serial Data
To receive data through a serial port or USB port on the Arduino hardware:
Serial Ports And Cables Wikipedia
- Add the Serial Receive block to your model.
- On the Arduino Serial Receive block,connect the Data block output to a block thatuses the data.
- Open the Arduino Serial Receive blockand specify the Port number.
- Click the Tools menu inthe model, and select Run on Target Hardware > Options.In the Configuration Parameters dialog that opens, on the HardwareImplementation > Serial port properties, set the baud rate forthe serial port you selected in the Arduino Serial Receive block.
- Connect the digital receive pin to the hardware thattransmits the data.
- Run the model, as described in Run Model on Arduino Hardware.
- If your model uses the Arduino USB port (Serialport 0) to receive data from a device that is not your host computer,reconnect the USB cable to that device and press the RESET button.