Arduino Nano RX-TX Module Switching

Thread Starter

silverflare

Joined Jun 4, 2024
3
Hi!
I am trying to make my Arduino Nano switch the device where it is currently communicating with (RX-TX) and I want to make it using NPN Transistors (2N3904) to switch from the ESP-01 to HC-06 (Bluetooth).
I'm kinda new to this and I made this circuit - for ESP-01 only for now with the same circuit for the HC-06. Will this work? What modifications should I do? I want to try putting the transistors to the ground instead, will that work too?
 

Attachments

MrChips

Joined Oct 2, 2009
31,171
Hi!
I am trying to make my Arduino Nano switch the device where it is currently communicating with (RX-TX) and I want to make it using NPN Transistors (2N3904) to switch from the ESP-01 to HC-06 (Bluetooth).
I'm kinda new to this and I made this circuit - for ESP-01 only for now with the same circuit for the HC-06. Will this work? What modifications should I do? I want to try putting the transistors to the ground instead, will that work too?
You don't have to do that. Just wire directly to the RX and TX pins of the device.
Each device has an enable input (EN). Enable the device you want and disable the device you don't want.

You can use one output pin from the Arduino to select. Use a transistor to create a NOT gate.
 

Dave Lowther

Joined Sep 8, 2016
263
Hi MrChips
Each device has an enable input (EN).
I'm interested in this topic too. I'm not sure what you mean by what you said in the above quote.
Do you mean:
1) The enable pin is there by default or
2) Use a GPIO pin as enable, read it in software and when not enabled then change the TX pin to an input and ignore anything on the RX pin?
If you mean 1) then I don't understand where the EN pins are for the two devices. I can't see an EN pin on either
Nano Schematic, or ESP01 manual
 

Thread Starter

silverflare

Joined Jun 4, 2024
3
You don't have to do that. Just wire directly to the RX and TX pins of the device.
Each device has an enable input (EN). Enable the device you want and disable the device you don't want.

You can use one output pin from the Arduino to select. Use a transistor to create a NOT gate.
I looked it up if I can just wire the same RX-TX from the Arduino to multiple different devices' RX-TX and they said that I could wire the TX from the Arduino to many different device and it will work like a broadcast, unfortunately, I won't be able to control which device receives the information.

e.g I want to send a serial message to my HC-06, but since the ESP-01 is also attached to it, the ESP-01 will also receive the serial message even if it is not the intended recipient.

The RX is worse, having the RX of the Arduino wired to two different devices means that the signal might be corrupted since there are two different messages being merged to a single pin.

And also, I need both the HC-06 and the ESP-01 running.

There's a chance that I did not fully understood what you mean, can you please elaborate?
 

Dave Lowther

Joined Sep 8, 2016
263
ESP-01 pin-4 is CHIP_EN
HC-05 pin-6 is Enable
Thank you and sorry for my mistake. I shouldn't have been looking for an EN on the nano. The reason I didn't see an EN on the ESP-01 module is because it wasn't shown in the manual I provided a link to:
1717606855599.png
And of course, I should have looked at HC05 for an EN pin, not the nano.
 
Top