Multiple serial communication with Atmega328 [closed]

2

I am using the atmega328 serial to control a bluetooth module, but I would like to use the same serial output to communicate with another atmega328, how can I do it?

    
asked by anonymous 01.12.2015 / 23:52

1 answer

0

The Atmega328 has only 2 pins for serial communication, they are: 2.3. On an Arduino board (such as Uno and Duemilinove), these pins are mapped to pins 0.1.

Serial communication via USB cable on an Arduino board also uses these pins. This means that you can not make a program that communicates via Serial with one computer and at the same time with another device.

The same is true for a bluetooth device that communicates via serial. Since you are using the Arduino 0.1 pin to connect the bluetooth device, then you can not connect any other device with the Atmega328 via serial.

Your alternatives are:

  • Use an ATmega1280 (micro-controller of the Arduino Mega board). This chip has 4 serial outputs. So you can connect bluetooth to one of these outputs and the rest you can use to connect other serial devices;

  • Use the bluetooth device via serial and communicate an Arduino with another via Ethernet;

  • Find a bluetooth device that communicates via the I2C protocol. I can not claim to exist.

  • Make one Arduino communicate with another via I2C protocol. This looks very interesting and even has documentation: link

  • 02.12.2015 / 00:59