0

Good day.

I am new in Arduino so please bear with me. I need to know if Pins other than Pin 0 and 1 can be used as a serial connection. I have 3 devices that needs to be connected to Arduino via USB, but when I saw the specification of Arduino, it only implicate that only pins 0 and 1 is used for serial rx/tx. So is it possible to connect the other 2 usb connector via pin 2 to pin 5

Thank you very much for your answer

  • Can you explain what those three devices are? What kind of usb devices are they? The arduino uno is not a computer. Please add the extra information to your question. – Jot Sep 12 '18 at 7:39
  • The 3 devices are The Computer (which controls the system that I am making). router and then mobile phone (which are being controlled by system that I am making) – Ciach Sep 12 '18 at 7:49
  • Some android smart phones recognize a usb-serial module. Such phones can be connected to a arduino board (with the usb connected to the phone). I don't know if there are routers that can do that. Is it a hacked router or router with open source firmware? – Jot Sep 12 '18 at 9:49
3

pins 0,1 are rx/tx for the hardware UART peripheral. Arduino (I assume UNO/Nano) have just one hardware UART.

there is a software library which makes use of any 2 pin to simulate hardware UART pin behavior for additional software UARTs (this is called bit banging). these "software" UARTs are not as fast as hardware ones and can't be relied on for fast baudrates (speeds). but for 9600kbps, they're good. keep in mind, that despite they are easy to implement and versatile, they use CPU time when communicating and if you are using interrupts in your code, data flow will be affected.

https://www.arduino.cc/en/Reference/SoftwareSerial

  • Thank you Tirdad Sadri Nejad, This is a big help for me. I think this will answer my problem. – Ciach Sep 12 '18 at 7:56
  • 2
    Btw, I tried to use software serial once for MIDI (31,250) bps, this didn't work reliable. If you need four serial ports, check the Arduino Mega. – Michel Keijzers Sep 12 '18 at 8:34
0

If you need your Arduino to be a USB slave for additional serial interfaces, then you can connect FTDI Basics to hardware serial ports (such as on Mega) or to software serial ports (such as on Mega).

0

Try to avoid the SoftwareSerial library, it’s very unreliable, that I can tell you from experience. In exchange try AltSoftSerial or NeoSWSerial, far better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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