0

I'm absolutely new to arduino, so please excuse me if this is a noob question. I want to use a ESP8266 esp-03 Wifi module with a HC-05 bluetooth module together with my arduino uno. Unfortunately both use the TX and RX pins on the board. Is there a way to use both, the wifi and the bluetooth modules? Or do I have to purchase a wifi board?

3

You can (just about) use any combination of two of:

  • Serial to PC,
  • HC-05
  • ESP-03

You have, basically, a hardware UART (pins 0/1), and a software UART (any pins of your choice).

Only the hardware UART can be used for communication with the PC, and you can only reliably use one instance of SoftwareSerial.

So, you could:

  • Use Serial to the PC (0/1) and HC-05 (SoftwareSerial, your choice of pins), or
  • Use Serial to the PC (0/1) and ESP-03 (SoftwareSerial, your choice of pins), or
  • Hardware Serial for ESP-03 (0/1) and SoftwareSerial for HC-05 (your choice of pins), or
  • Hardware Serial for HC-05 (0/1) and SoftwareSerial for ESP-03 (your choice of pins)

If you want anything more complex than that then you need to use a board with more than one hardware Serial port (such as a Mega2560).

  • Thank you for your reply! So do I understand correctly, that when I use the serial port (e.g. to program the arduino) I cannot use the hardware UART pins at all? I also bought the Mega2560, are the 14TX3, 15RX3, 16TX2, 17RX2, ... pins the hardware serial ports you are talking about? – Daniel Gretzke Oct 18 '18 at 12:11
  • 1
    You can't have anything connected to the UART pins when actually doing the programming. Once programmed you can't use the UART pins and communicate with the PC. I.e., if you want to use the UART pins for a peripheral you will (most likely) have to disconnect it to get the programming to work, and you won't be able to debug your program through serial. And yes, those are Serial2 and Serial3 etc that you point to there. – Majenko Oct 18 '18 at 12:12

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.