1
\$\begingroup\$

I would like to hack a 3.3v UART controlled Self Balancing Scooter in away that it can keep old logic (control), but optionally it should be able to switch to external control data source.

The question is will the presented schema do the job if

  • 3.3v Data IN - is the original source. I have no control on it.
  • Switch 5.0v - is the switch to disconnect original source.
  • 5.0v Data IN - is come from an Arduino UNO board and need to be logic level shifted to 3.3v
  • 3.3v Data OUT - is the UART signal connected to motor control board of the hoverboard

Data source switch with simple logic level shift


In practice

I cut the wires between the Motor Controller and the Gyro Board.

Unfortunately I have no information about the schematics of the current circuitry.

enter image description here

\$\endgroup\$
6
  • 1
    \$\begingroup\$ that depends on wether the out is conntected to a source or a sink, adding a 10K resistor from out to ground may help. \$\endgroup\$ Mar 4, 2018 at 7:04
  • \$\begingroup\$ Do you have schematics of the current circuitry on the 3.3V system? \$\endgroup\$
    – KalleMP
    Mar 4, 2018 at 8:09
  • \$\begingroup\$ @KalleMP Unfortunately I have no information about the schematics, but I can measure the current. \$\endgroup\$ Mar 4, 2018 at 9:19
  • \$\begingroup\$ Your circuit could never pull the data out pin low. \$\endgroup\$ Mar 4, 2018 at 9:24
  • 1
    \$\begingroup\$ You could always use an SN74LVC2G157DCUR. 2:1 Mux with select line. They cost <£0.40 in singles, plus in a tiny VSSOP8 package. They also support down-translation - i.e. the inputs are 5V tolerant even when running from a 3.3V supply. \$\endgroup\$ Mar 4, 2018 at 9:28

1 Answer 1

1
\$\begingroup\$

Your circuit as is wouldn't work well for several reasons:

  • Your transistor base has no resistor
  • The output is driven only by diodes, so there is no way to pull the output low
  • You could add a pull-down on the output, but if the input pin to which the circuit connects has an internal pull-up resistor (which is likely for a UART RX), they will fight each other. Your 1k series resistor and pull-down resistor will also fight each other acting as a level shifter.
  • Even if you added a pull-down resistor on the output, when the switch pin is selecting the 3.3V input, the output will stay high if 5V data input is high, regardless of what the 3.3V input is doing.

You could always use an SN74LVC2G157DCUR.

These are dedicated 2:1 multiplexers with select line. You'll get better performance than trying to hook up a circuit with transistors and resistors. As they cost less than 40p in singles, they aren't going to break the bank.

The nice thing about them for your application is they also support down-translation. That means that if you run the IC from a 3.3V supply, the inputs remain 5V tolerant. So in your case you would make the connections:

  1. 3.3V Data In
  2. 5V Data In
  3. N/C
  4. GND
  5. 3.3V Data Out
  6. Switch 5V
  7. GND
  8. 3.3V Power

No need for any level shifting as the chip will do that itself.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks @Tom for the detailed answer. I take your advise. \$\endgroup\$ Mar 4, 2018 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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