0
\$\begingroup\$

I use the uln2003a to switch a device (with use of a MCU) that is capable doing several things, like fm-radio, bluetooth, playing MP3's etc. It also provides an USB function when it is connected to a computer, it provides an usb soundcard and a SD-card interface. The function is only enabled/started when selected on the device.

The switch works okay, however, when connected to a computer the device is recognized but the computer is unable to communicate with the devices. In Windows there is an exclamation mark present with the comment "Device doesn't start, code 10".

When I bypass the uln2003a switch with a wire, connect ground directly so the uln2003a has no function, all of the devices operates just fine. I tried the following experiment:

  1. Start the device,
  2. Connect point A and B with a wire (see schematic below) to bypass switch,
  3. Select USB mode and working fine.

As soon as I disconnect this wire (ground still connected via uln2003a), devices starts to malfunction in Windows.


Question:

The uln2003a switch the same ground and I don't understand why USB is not working. Can somebody explain what's going on?


Simple schematic to give some idea what's going on:

uln2003a-switch-usb


ULN2003A datasheet: http://www.ti.com/lit/ds/symlink/uln2003a.pdf

\$\endgroup\$
2
\$\begingroup\$

The ULN2003 datasheet says Vce(sat) can be as high as 1.6V which is pretty high for a "low" output. When you shorted the connection with the wire you got 0V which is why it worked. The ULN2003 isn't really useful for this application because it can never pull the output low enough.

What you are doing is "low side switching" -- for USB I would recommend high side switching and put a Texas Instruments TPS2051B power switch between +5V from USB and your device's +5V input. Then connect the device to ground like normal.

http://www.ti.com/product/TPS2051B

The TPS2051 has a simple interface; there's an enable pin and a fault status indicator. It's easy to use and can handle up to 500mA for your device you are switching.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the answer. So okay, not suitable for this task. I take a look at it, thanks. \$\endgroup\$ – Codebeat Mar 13 '18 at 15:04
  • \$\begingroup\$ Pretty simple, actually the same drive operation only the positive route. I see there is also a TPS2054 with four channels. One question, what is the ULN2003A suitable for, only to drive motors? \$\endgroup\$ – Codebeat Mar 13 '18 at 15:31
  • \$\begingroup\$ I chose this answer as accepted because it provides a solution. \$\endgroup\$ – Codebeat Mar 13 '18 at 15:46
  • 1
    \$\begingroup\$ Good question, I'd say motors, relays, solenoids, and LEDs are the most common application for it. \$\endgroup\$ – user171804 Mar 13 '18 at 16:40
4
\$\begingroup\$

Take a look at the graph "6.14 Typical Characteristics" in the ULN2003 datasheet.
Even with only a small amount of current the output is still at least 0.7V above ground.
That means that your device's USB signalling is all going to be (at best) shifted 0.7V higher than it's supposed to be (could be even worse) - making the USB host in your PC very unhappy.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the answer. "making the USB host in your PC very unhappy", haha. That's strange, is there something I can do to pull it down/correct it or do I need to take another route? \$\endgroup\$ – Codebeat Mar 13 '18 at 15:00
  • \$\begingroup\$ @Codebeat cut the power on the high side.. \$\endgroup\$ – Trevor_G Mar 13 '18 at 15:02
1
\$\begingroup\$

When you have a Darlington output stage you can expect significant volt drops: -

enter image description here

To turn on Q2 you need about 0.7 volts applied to its base with respect to the emitter. Given that the base voltage is supplied via Q1 and Q1 sources this voltage from Q2's collector you cannot realistically have the output falling below 0.7 volts unless you have a very light load on the output.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the clear answer. One question, what is the ULN2003A suitable for, only to drive motors? Why it is so populair when there are so many possible side effects? \$\endgroup\$ – Codebeat Mar 13 '18 at 15:36
  • \$\begingroup\$ @Codebeat I don't particularly like it because of the natural loss of voltage - you can get a MOSFET output version that drops a much smaller voltage (don't ask what the number is but it's supplied by TI). Popularity doesn't mean it's good! It's like the crappy L293 H bridge or the crappy 741 op-amp - people keep using 'em and it beats me why! \$\endgroup\$ – Andy aka Mar 13 '18 at 15:47
  • \$\begingroup\$ Okay, haha, thanks. I chose this ULN2003A because it is easy to drive without any external components required and safe for the MCU and very cheap. Can you give me some positive alternatives/suggestions? And yeah, the LM386 amp is also very populair, dunno why. I don't understand they use the cheaper and more powerful one like the PAM8304 instead. \$\endgroup\$ – Codebeat Mar 13 '18 at 15:53
  • \$\begingroup\$ TPIC2701 is worth a look. 0.5 ohm on resistance. \$\endgroup\$ – Andy aka Mar 13 '18 at 15:57
  • \$\begingroup\$ okay, thanks, take a look at it. \$\endgroup\$ – Codebeat Mar 13 '18 at 16:00
1
\$\begingroup\$

Good answers here already, but I feel it important to add ground side switching of devices is generally a bad idea.

We spend a lot of time ensuring the integrity of the grounding system to minimize noise in systems, ensure proper return current management, and to maintain as close to a constant reference voltage across the circuit/system as we can achieve. (The latter being the issue that stopped you!)

Adding a switch in the ground side negates all that and adds all kinds of hard to debug issues. As such, it should be avoided wherever possible.

Furthermore, when you switch the ground side you leave the device hot.

Internally it is still connected to whatever rail it is attached to. That means the output pins will tend to pull or drive whatever they are attached to up to the rail. Even input pins can do some strange and unpredicted things with the ground disconnected.

Having the device not directly connected to a power source is safer.

Of course, having a device in circuit with Vcc disconnected can also be problematic. The device can actually take power from the input pins via the protection devices if whatever is connected to them can supply enough current.

As such, depowering devices takes some careful design and is often not a trivial matter.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the clear answer. One question, what is the ULN2003A suitable for, only to drive motors? Why it is so populair when there are so many possible side effects? \$\endgroup\$ – Codebeat Mar 13 '18 at 15:35
  • 1
    \$\begingroup\$ @Codebeat that device is really old. It was good for driving multiple higher current devices like row driving LED matrices and the like. There are better MOSFET drivers available though. \$\endgroup\$ – Trevor_G Mar 13 '18 at 15:43
  • \$\begingroup\$ Okay, thanks. I chose this ULN2003A because it is easy to drive without any external components required and safe for the MCU and very cheap. Can you give me some positive alternatives/suggestions? \$\endgroup\$ – Codebeat Mar 13 '18 at 15:49
  • \$\begingroup\$ @Codebeat If you are only switching one device, a decent P-MOSFET on the high side is sufficient. \$\endgroup\$ – Trevor_G Mar 13 '18 at 15:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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