Switch between USB-UART and a bluetooth-UART

Discussion in 'Analog & Mixed-Signal Design' started by electrophile, Sep 10, 2016.

  1. electrophile

    Thread Starter Member

    Aug 30, 2013
    100
    1
    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?

    [​IMG]
     
  2. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    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: Sep 10, 2016
  3. electrophile

    Thread Starter Member

    Aug 30, 2013
    100
    1
    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.
     
  4. electrophile

    Thread Starter Member

    Aug 30, 2013
    100
    1
    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.

    [​IMG]
     
  5. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    Should work.

    Why do you have a divider on the BT RX input?
     
  6. electrophile

    Thread Starter Member

    Aug 30, 2013
    100
    1
    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.
     
  7. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    I was wondering why the resistors weren't in the first schematic. Thanks for clearing that up.
     
  8. electrophile

    Thread Starter Member

    Aug 30, 2013
    100
    1
    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.

    [​IMG]
     
    Last edited: Sep 12, 2016
Loading...