Shop OBEX P1 Docs P2 Docs Learn Events
USB-powered protoboard — Parallax Forums

USB-powered protoboard

rokickirokicki Posts: 1,000
edited 2008-05-20 16:07 in Propeller 1
Howdy, everyone.

Let's say I wanted to make a protoboard powered by USB, just for running, not for programming.
(So I'm happy to use external power and the USB->prop thingie to program.)

Let's also assume I'm willing to play fast and loose with the spec, to some reasonable degree.
(A one-off; if it works on my desktop I'm happy).

Can I just hook up a USB cable ground and +5 to the output of the 5V regulator (after
removing the 5V regulator from the board with a chain saw)?

And if that works, I suppose I can try to find the work someone did to make the prop speak
HID back to the USB interface, so I can then actually communicate with the prop.

Essentially what I'm looking for is the *simplest* way to get a protoboard powered via USB
and then talking via USB to a Windows box. If it pulls a few tens of milliamps more than it
should, I don't care. (I mean those USB-powered lamps have to work somehow, right?)

-tom

Comments

  • hippyhippy Posts: 1,981
    edited 2008-05-14 22:41
    Should work. As you've noticed everyone seems to suck USB power to drive everything from the humble LED to a steel foundry despite it being 'out of spec'.

    I've seen a number of circuits recently where a 5V regulator has been left in place and an external 5V connected straight to 5V line. You could do that, and a diode would block the voltage flowing back up the USB cable and allow USB or plug-in PSU operation ( even simultaneously ).

    The serial comms and other HID stuff was by Brad C, and it works for me ...

    http://forums.parallax.com/showthread.php?p=675656
  • RaymanRayman Posts: 14,162
    edited 2008-05-14 22:56
    I wouldn't bother removing the 5V regulator... I'm trying to remember...

    On one of my boards I brought in 5V DC to that group of headers where you're supposed to connect servos.

    Then, just did something with the servo power jumper and had a good situation. There's a big capacitor there and an inductor to give some noise immunity. Set the power switch to the #2 position, I think...
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-05-14 23:31
    I'd connect the +5V from the USB right into the wall transformer input, upstream of the 5V regulator. You will get less than 200mV dropout through the LM2940 regulator, and that hardly matters, since it gets reregulated to 3.3V anyway. Plus you get the following advantages:

    1. Use of the Protoboard's on/off switch.

    2. Reverse voltage protection, provided by the LM2940.

    3. Short circuit protection (1.6A, typical: a little high for USB but better than nothing).

    -Phil
  • rokickirokicki Posts: 1,000
    edited 2008-05-14 23:36
    Wow, this is really good news. So potentially we can take a protoboard and make it do "interesting" stuff as a
    USB gadget without killing ourselves.

    What I'd like to do as a quicky is just build a fake, mini, IMSAI front panel lights (no switches) as a USB
    controllable thing, and then I can make the lights flash via serial comms. I'm hoping a protoboard, some
    simple LED driver chip or circuit (haven't picked one yet), a handful of LEDs, a photo of the IMSAI front
    panel, a USB cable, and some really careful work with a hand drill will do it.
  • hippyhippy Posts: 1,981
    edited 2008-05-15 00:17
    So potentially we can take a protoboard and make it do "interesting" stuff as a USB gadget without killing ourselves.

    I think it's now just down to who's going to be the person to try it ! With only my desktop PC having USB I'm not going to risk it before someone else reports it worked for them smile.gif

    IMSAI ? ... This : www.imsai.net ? Similar to the PDP-8 front panel.
  • rokickirokicki Posts: 1,000
    edited 2008-05-15 00:35
    Oh, I'm not too worried about frying the mobo, but you're right, I should try it on an old computer before risking an expensive one.

    Yep, that imsai, only the original: http://en.wikipedia.org/wiki/IMSAI_8080

    -tom
  • RaymanRayman Posts: 14,162
    edited 2008-05-15 00:37
    You can use a powered USB hub to isolate your computer from any problems...
  • BradCBradC Posts: 2,601
    edited 2008-05-15 07:42
    hippy said...
    So potentially we can take a protoboard and make it do "interesting" stuff as a USB gadget without killing ourselves.

    I think it's now just down to who's going to be the person to try it ! With only my desktop PC having USB I'm not going to risk it before someone else reports it worked for them smile.gif

    IMSAI ? ... This : www.imsai.net ? Similar to the PDP-8 front panel.

    Something like this dodgy device?

    It powers up and enumerates as a 500mA USB device before it powers up the backlight and initializes the display to keep power consumption down toward the USB pre-enumeration limits. It's still too high, but it's pretty close and given all the USB coffee warmers that don't even bother to enumerate I'd say it's best effort. The LCD is currently displaying some demo code sourced from the LCD object by Simon Ampleman (which has a bug in the 4 bit init routine).

    I'm working on a USB bootloader to be able to power/use/program the device through the same soft-usb port without having to re-connect or bugger about with extra cables. The idea is when the prop boots it enumerates as a bootloader device for 5 seconds and a python program on the PC sees that and starts a bootload process. If the pc does not respond in 5 seconds it falls through to whatever code you actually want to run. I'm trying to get it right with python and libusb so it's linux/mac/windows compatible.. just for kicks [noparse]:)[/noparse]

    I've found what I *think* is a bug in my USB-CDC-ACM code.. but it's *so* hard to hit it's killing me tracking it down.
    If the PC is _really_ busy.. very occasionally the USB stack will just die. Looks like the low level cog dies completely and this locks things up somehow. Not sure what actually occurs, and a solo cog that I have setup as a WDT always manages to reboot it, but something breaks. Unfortunately I have to place the PC under *extreme* load for anywhere up to 4 days to get this to happen. (* extreme being simultaneous transfers to and from 14 drives and a heavy CPU load)

    Anyway, USB powered Proto board? Yep, it's do-able.
    2816 x 2112 - 603K
    2564 x 1692 - 850K
  • hippyhippy Posts: 1,981
    edited 2008-05-15 13:13
    Good to hear from you again Brad. That trick for USB bootloading is ingenious. I recall you were thinking of the Propeller as a USB Mass Storage Device and GamePad -- Have you done anything else with USB on the Prop rather than being busy with other things ?
  • rokickirokicki Posts: 1,000
    edited 2008-05-15 16:58
    Sweet, that looks great!

    You say this takes more power than pre-enumeration limits; I thought pre-enumeration was 100ma.

    Or is that backlight that hungry?

    Anyway, this looks exciting and I can't wait to see what you come up with. Next: figure out how to
    mount a mini-USB jack on the protoboard.
  • KamPuttyKamPutty Posts: 48
    edited 2008-05-15 19:54
    Hi all,

    Here is a cable from Sparkfun

    http://www.sparkfun.com/commerce/product_info.php?products_id=8639

    That may be used?...

    ~Kam (^8*
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-05-15 21:06
    That cable is perfect! (I assume the center is positive.) No funky soldered stuff; plus all the advantages I listed above for running through the LM2940.

    -Phil
  • BradCBradC Posts: 2,601
    edited 2008-05-19 12:55
    hippy said...
    Good to hear from you again Brad. That trick for USB bootloading is ingenious. I recall you were thinking of the Propeller as a USB Mass Storage Device and GamePad -- Have you done anything else with USB on the Prop rather than being busy with other things ?

    No, unfortunately life/work has had me with zero spare time the last 6 months, I've nly just started to even look wistfully at my electronics/micro gear again and I'm looking forward to getting back to it "real soon now".

    The USB bootloader has been an idea of mine for a while. It'll be interesting to see if I can make it work well enough to be a worthwhile development. Fun trying in any case.
  • BradCBradC Posts: 2,601
    edited 2008-05-19 12:58
    rokicki said...
    Sweet, that looks great!

    You say this takes more power than pre-enumeration limits; I thought pre-enumeration was 100ma.

    Or is that backlight that hungry?

    Anyway, this looks exciting and I can't wait to see what you come up with. Next: figure out how to
    mount a mini-USB jack on the protoboard.

    On re-read of the spec you are pretty right. The bit my hazy memory was flagging was the mandatory support for suspend on the bus.
    A device in the suspended state can consume no more than 500uA while suspended, and I never quite got round to implementing that in the USB stack. (It's on the list though)

    In this configuration the backlight only consumes about 10mA, but I wanted to make it software switchable anyway for an idea I have for a bedside assistant (yes, it even makes coffee)
  • rokickirokicki Posts: 1,000
    edited 2008-05-19 16:23
    Hmm, looking over the protoboard schematic, you should be able to use the USB->barrel jack into the barrel jack
    connector, and then just jump Vin+ to 5V+ using the servo power-selection jumper (pin #1 to pin #3) and then
    you don't need to solder anything at all. (This will short input and output of the 5V regulator; that should be okay.)

    I'm going to have to try this. If this works, that's really cool because I can switch from USB-powered to
    non-USB-powered very easily (as long as I remember never to use a >5V while the #1->#3 header is installed.)
    Although even that would be probably be okay as long as I don't install any 5V devices, since the 3V regulator can
    cope.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-05-19 17:33
    I wouldn't bother with the jumper. The dropout through the 5V regulator will be minimal.

    -Phil
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-05-19 23:15
    I am currently working on the next generation USB Oscilloscope using the Propeller. And let me share a word of caution, USB has very strict standards when it comes to power management. Not only do you have to make sure your average current stays within limits but that no transients exceed the the limits. This includes the inrush that occurs on plugin due to charging the capacitance. Because we didn't design this inrush into account the first prototype board causes a overcurrent fault when plugged in and therefore the board didn't work.

    FTDI chips have the ability to manage this high current, but you must program it to do this correctly. They have a utility called MProg on thier website that allows you to program the chip (via the USB connection) to configure it for higher current, and those high current devices are controlled by a transistor connected to a pin on the FTDI chip (default pin is CBUS3, but is changable in MProg). Application note AN232-10 outlines high power applications and it also provides a slow start functionality to minimize voltage drop during inrush.

    With a properly designed board, you should set the maximum current in the FTDI chip to be your maximum current draw (typically during inrush), add a margin for process variation, and make sure that no more than 100mA is ever drawn from the USB line during enumeration and negotiation (this is the purpose of having the high power circuitry controlled by the FTDI chip).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-05-19 23:44
    Paul,

    You're absolutely correct to point out these issues. For anyone designing a commercial product, it's essential to pay attention to them. But for a one-off project, as I and many others have discovered, some of the current limit rules can be broken with some PCs, so long as the current draw is not sufficient to damage one's computer. I believe it was in that spirit that Tom posed his original question and certainly the spirit of most of the answers. In any event, if the USB port is also powering an FTDI chip, excess draw will almost certainly cause Vdd to dip momentarily, resetting the chip, which can be a real nuisance.

    Now, about that CBUS3 pin. If you're designing a product, you're best off completely ignoring FTDI's published PMOS soft-start circuit. It simply doesn't work as advertised. What's even worse, the CBUS3 pin on the FT232R has a start-up glitch that renders its usefulness nil unless further steps are taken to negate it. There's an extensive thread on the subject here, where I've included some scope traces and my own recommendations for overcoming the soft-start problems.

    -Phil
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-05-20 00:18
    Thnaks for the heads up Phil, i will look into the information you provided. It will certainly help prevent me from making the same mistakes others have made by relying on thier documentation.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-05-20 00:36
    I found this circuit on EDN which is a little easier for me to follow conceptually since it's a simple RC controlled latch: ·http://www.edn.com/article/CA605503.html?spacedesc=designideas&industryid=44217&text=inrush+limiter

    Do you think this circuit would also work for this purpose?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-05-20 02:08
    Paul,

    The circuit you've cited is an interesting one and will, indeed, limit inrush current. However, it doesn't include a way to determine when the charging process begins which, in the case of the FTDI chip, could happen before the chip enumerates. The PWREN# pin is a reliable switch for this process, so long as some sort of one-shot is employed to get past the reset glitches. This is the reason I used the Microchip supervisor: it provides the necessary delay for PWREN#, as well as low voltage detection. Joerg's circuitry in my referenced thread accomplishes the same with chepaer, albeit more numerous, components. There may also be a way to hold the base of Q2 in the EDN circuit low until PWREN# has been low long enough for a glitch-free turn-on.

    -Phil
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-05-20 16:07
    Ok, thanks Phil for your help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
Sign In or Register to comment.