MultiSerial Mega using Arduino




Sometimes, one serial port just isn’t enough! When trying to communicate with multiple serial enabled devices, while also sending info back to the main serial window, a few extra RX/TX ports can be a welcomed thing. This example makes use of one of Arduino Mega’s 3 auxiliary serial ports, routing any incoming data read on that connection straight to the main TX line, and, in turn, to the main serial window for you to view.

MultiSerial Mega using Arduino




Circuit

After checking the data sheet of whatever serial enabled device you choose to use for this example, make sure that it is both properly wired and powered. Connect the RX pin and TX pins of your device to the TX and RX pins of your Mega, as shown in the schematic below.

Make sure that your Mega is connected to your computer, via USB, to enable serial communication.

image developed using Fritzing. For more circuit examples, see the Fritzing project page

Schematic

MultiSerial Mega using Arduino schematic

Code

/*
Mega multple serial test
Receives from the main serial port, sends to the others.
Receives from serial port 1, sends to the main serial (Serial 0).
This example works only on the Arduino Mega
The circuit:
* Any serial device attached to Serial port 1
* Serial monitor open on Serial port 0:
created 30 Dec. 2008
modified 20 May 2012
by Tom Igoe & Jed Roach
This example code is in the public domain.

*/

Major Components in Project

Hardware Required

  • (1) Arduino Mega Board
  • (1) serial enabled device (a Xbee Radio, Bluetooth module, or RFID reader, or another Arduino, for instance).




This Post / Project can also be found using search terms:

  • arduino mega projects
  • arduino mega serial
  • Mega Arduino Projects
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Digital Clock
Arduino 7 segment Displays Digital Clock With Charlieplexing LEDs

This is my second instructable. I just had a mood of making a digital watch. But wanted to make it...

Close
Scroll to top