Attempting to use USB to power my project

Thread Starter


Joined Jul 22, 2006

I'm currently working on, in my head, a project that I'm hoping to power through 2 USB ports, but I'm after some advice to help clear up some uncertainties with my little project

Essentially, I'm planning to make a box that will enable a single push button switch that will move 2 computers forward within a slide presentation. Basically the box contains 2 keyboard PCBs and the push button switch triggers a relay that closes the contacts on the PCB and simulates a key being pressed.

What I'm trying to do is make all this powered from the USB ports on both computers. I know that each USB port will give me 5V (ish) and in theory each port will also give me 100mA to play around with.

I've worked out that I reckon I'll need a total of around 160mA to run a relay, a couple of LEDs to tell me that the USB port is plugged in and about 3 LEDs to flash to confirm that the switch has been pushed to trigger the key press. Of course this 160mA does not include the current that the actual keyboard PCB needs - as I can't seem to find that information but I'm hoping it won't be too much.

My plan is to take a power feed from the under side of each PCB and run each feed through a diode and then connect them to a common power rail - From what I remember from my distant school days this will still give me 5V? and that any load I place on this power rail will be distributed equally across both USB ports. Another query I'm hoping to resolve is the voltage drop of the diode. I do remember that 0.7V is a ballpark figure and looking through various web sites I've read alot about schottky diodes and the fact they have a substantially lower forward drop - would these be suitable for use in my project over a regular silicon diode? I've read that the USB power can drop to as low as 4V and I'd rather keep as much juice flowing as possible! :) I've seen this particular schottky diode as a contender - it's a 1N5817 it might be a bit OTT?

If my plan to power from the USB isn't suitable I'm ready to go to plan B and use a mains adaptor - but it's more convenient to use the USB as wall warts tend to go missing when you need them! :rolleyes:

many thanks in advance! :)


Joined Aug 11, 2005
Is there any reason you couldn't use batteries? They can be much smaller and lighter than a mains adaptor, and work with most things. And that important point of not needing a wall socket. (I've given up on mains adaptors, and use batteries with all my current projects.)

Thread Starter


Joined Jul 22, 2006
I've considered using batteries - in fact this is my third incarnation of this box and the previous 2 did use batteries - but even though the batteries did last a long time they have expired at the wrong time...and the trouble is no-one (including myself) can remember how long the batteries have been used for and they end up getting replaced on each show just for piece of mind.

It's the same reason I'm trying to not use a wall wart as it'll be sods law it will get misplaced in between jobs and there won't be a shop nearby to buy a new one! :eek:


Joined Oct 14, 2005
First, it is not easy to balance 2 power lines to supply equal currents. If you are not careful, one of the USB port would end up supplying more than 100mA and the other one would be less and the driver would just shut the bus down. You have to make sure, using some kind of
balancing circuit, that the current would be shared equally.

Second, most keyboard circuits would work with 4V or so power, I don't think the voltage is as critical as the amount of current. Why don't you try to reduce your circuit consumption instead? Maybe replacing the relay with solid circuit one or a FET or BJT switch seeing 160mA is a big part of the total budget. If you could reduce that to 20mA or so then you have plenty of power budget left.

Personally, I wouldn't go with two keyboard PCBs, a microcontroller inserted in the PS2 lines acting as a keyboard emulator (like those portable bar scanners they have in shops), serial line and another micro for keypresses is a much more simpler and elegant solution.

Thread Starter


Joined Jul 22, 2006
Thanks for the replies and help so far!

The main reason I'm using keyboard PCBs as it's easier (for me at least) to just tap in to it and select the keys that I need to use. In this case I need the space bar and page up/down so that the PCs can be remote triggered forwards (backwards isn't used that often and not remotely) Also I think it's cheaper - 2 usb keyboards have cost me about £10! although they are cheaper the actual size of the PCBs seem to increase the less you spend:confused: Someone did mention using transistors instead of relays sometime ago but I'm thick and I need something simple! :)

After looking at the power requirements I think it might be easier to split it down the middle so that each PCB will supply half the total current. The only problem I can forsee is the LEDs I was planning to use to give a visual cue when the box is triggered. Originally I was only going to use about 3 LEDs but each one I've looked at have a vF of just over 3V - this means I'd have to run each LED in parallel and that's where most of the current is being used

One of my colleagues has mentioned a dc-dc converter to boost the voltage to get around this problem. After scouring the pages of Farnell and RS I found one (well several really!) that will output 12V - Only trouble is that I don't really know too much about them....

On the datasheet for the converter in question (C & D Technologies NDY0512C) it does state a min o/p current of 42-65mA and a full load of 166-250mA. The input full load current is 548mA. On my calculations I reckon that each half of the circuit will need to supply no more than 55mA so am I right in thinking I'll be OK to use this? The datasheet also mentions to use capacitors on the in and output pins I'm guessing to smooth out the voltage?

One more question - On this converter it has 2 rows of pins which are labelled on the datasheet - but it almost looks to me as if it is dual channel? ie it's got 2 +Vin, 2 -Vin, 2 +Vout and 2 -Vout. So could I get away with using just one converter per circuit or will I need 2?

Of course these converters may not be suitable...And if that's the case then it's over to plan B! :)

Thread Starter


Joined Jul 22, 2006
I've had to make a few subtle changes to my circuit to get it to work and as a result I'm having to use 2 relays which of course is eating far too much into my limited current budget!

I've found some solid state relays ( which were mentioned in an earlier reply, but I discounted them due to cost) which are 'reasonably' priced at around £5 each. They are Vishay LH1513AB (datasheet ) which appear to be DPST which would appear to be a bonus!

Would these relays be a straight forward replacement for mechanical ones? I won't be switching that much in the way of current - it's only the current running through the keyboards so probably less than 10mA. From my understanding all I'd need to drive are the LEDS on the input stage so that would only be 3mA. I'm also hoping to run 3 of these in series - all will be switching independent circuits.

Would it be a problem to keep one of these relays on for an extended time? I would like to use one connected to an on/off switch so that I can isolate either keyboard. I'm guessing my main concern would be the heat build up of the LED. Typically, I would expect that a relay would be in it's on state for most of the day ( not everyday though! ) I've seen latching relays but I'd need to work out how to reverse the polarity so that they would release the coil. I'm using a DPST rocker switch to control the voltage to the relay which also has a LED so that I know if it's active or not - A SSR would be the easiest (for me) even if it is consuming 3mA all the time.

Can anyone confirm that I'll be OK with these SSR replacements before I buy them?

Many thanks in advance! :)


Joined Apr 20, 2004

Be careful of SSR's. They are (or were) built around scr's, which tend to latch on with DC. Once on, never off.

I think you might be happier with a latching relay. Some work with only one coil and voltage polarity. Even having to reverse polarity is easy to do with a switch. No constant current draw helps the energy budget.
This is about your previous difficulties in using batteries and not knowing when they start to go bad. I had the same difficulty on some of my projects, and so I built a pretty basic low-battery warning LED system. The core of it is a run-of-the-mill LM311 comparator. On one input (A), you have a voltage divider (2 res. in series) from the pos. to the neg. battery nodes. On the other input of the comparator (B), I put a "voltage divider" of a resistor and a diode in series. This locks the B input at .6-.7 volts, no matter what the battery voltage is (extremes excluded). You have to tune the voltage divider on input A to the right trigger voltage (pots help a lot). When the voltage at A gets lower than the voltage at B (.6-.7V), the comparator turns on the output, at which you have an LED. Then you can tell when your batteries start to dip below a certain voltage. Hope this helps!
Last edited by a moderator:


Joined Jun 30, 2006
The relays should do fine as long as you don't exceed their max current. If you're doing that for school work your school may be able to get parts free or reduced.