0

I need to make the Raspberry Pi communicate with the Arduino via USB Cable. From this, I will use the port on the USB which supports Serial Communication. However I also need to make the Raspberry Pi communicate through Bluetooth in a Mobile App via Serial Communication as well. Since both Serial devices use different ports according the the Raspberry Pi 3 Model B documentation, can it communicate at the same time? (The Arduino to Raspberry Pi and Raspberry Pi to Mobile App). The Bluetooth uses the /dev/ttyAMA0 port then I will use an USB port to connect the Pi to the Arduino.

Example using pySerial library.

serialArduino = serial.Serial('/dev/ttyACM0', 9600)

serialBluetooth = serial.Serial('/dev/ttyAMA0', 9600)

1 Answer 1

1

You are overcomplicating the issue, and your question is unclear.

  1. You can communicate with Arduino via its USB/Serial interface, independent of anything else.

  2. You can access Bluetooth, which uses /dev/ttyAMA0, although whether your application will use this directly or through a service on the Pi is unclear.

How you communicate between these 2 fundamentally independent processes is up to you. It is not even necessary to do this in a single program, and may be easier to debug if independent programs with inter-process messaging is used.

4
  • Sorry if that confuses you. I mean, can you communicate with the Arduino and Bluetooth at the same time with the Raspberry Pi? In Arduino, using Software Serial, only one pair of TX RX can listen at a time. Since in Raspberry Pi, the Bluetooth and USB is a hardware serial, that means I can use them at the same time right?
    – LinkedRom
    Apr 8, 2018 at 8:35
  • @LinkedRom As Milliways said they are independent. You can use multiple USB and /dev/ttyAMA0 (the UART) at the same time.
    – joan
    Apr 8, 2018 at 9:22
  • So it means I can use the Bluetooth and USB at the same time right? Thanks. This became my problem in Arduino Uno with only one hardware serial because multiple software serial is not allowed to work at the same time. I currently don't a Pi right now so I can't try it. I was just asking to have a smooth progress as I start working. Thanks!
    – LinkedRom
    Apr 8, 2018 at 9:35
  • @LinkedRom For your information (not directly related to the question) there is a fundamental difference between Arduino and Raspberry Pi. Arduino is a micro-controller which runs a single task at a time. Linux is a multi-tasking OS which can run multiple programs "simultaneously" (at least as far as the user is concerned).
    – Milliways
    Apr 8, 2018 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.