Switch between USB-UART and a bluetooth-UART

Thread Starter

electrophile

Joined Aug 30, 2013
167
I have a custom 5V Arduino design which is essentially an Arduino Nano clone. The USB to UART conversion is done through the wildly popular FT232 chip. However, I also wanted to add a bluetooth device such as the HC-05 to program and operate the Arduino wirelessly. At any given time, either the wired USB interface or the BT should be able to talk to the Arduino. This means that if the BT is ON and if the USB cable is plugged in, BT module would be turned OFF. Also the Arduino is not powered by the USB bus but by a separate 5V supply. This 5V supply would also power the BT module. In this case would the attached circuitry work?

The other idea is to use something like this load switch and have the VBUS line connected to the enable (active low in the 'B' version) pin. Any thoughts?

 

dl324

Joined Mar 30, 2015
16,839
It would work (if you address the issue of driving inputs of an unpowered circuit), but R2 would be wasting 2.5W of power when the Bluetooth module is switched off.

EDIT: A resistor from the gate to ground would be needed to insure the N MOSFET was off without a USB connection.

It would be better to use a P MOSFET to switch power. Resistor to GND to turn it on and apply VBUS to the gate to turn it off when USB is connected.
 
Last edited:

Thread Starter

electrophile

Joined Aug 30, 2013
167
Hmm the issue of driving inputs of an unpowered chip is real and if were to use a different USB to UART like the CP2104 that definitely would not work. Maybe a MUX? Would something like the CD74HC4053 work? What I could do is connect all the select lines together and ground them via a pull-down resistor and connect them to the VBUS line. That way when there is no USB the BT would be the choice of UART and when the USB is plugged in, the FTDI would get selected.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
Here is another solution that I could think of using a multiplexer. When the USB is unplugged, the select lines are low and the Y0 lines are selected which is the BT module. When the USB cable is plugged in, the select lines go high and the FTDI chip gets selected. VBUS and 5V are two separate 5V sources. Only the FTDI gets powered from the USB bus.

 

Thread Starter

electrophile

Joined Aug 30, 2013
167
Should work.

Why do you have a divider on the BT RX input?
The bluetooth is a 3.3V device while everything else here is 5V. It has a 5V to 3.3V regulator on it which is why its being powered with a 5V supply but the RX and TX lines cannot take more than 3.3V.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
While I was at it, I was thinking I could cut off power and isolate the BT module entirely when the USB cable is plugged in. Took your suggestion and used a P-channel mosfet. The BSS84 can handle only about 130mA but that should be sufficient since the BT module itself does not consume more than 50mA.

 
Last edited:
Top