USB on timers

Hi there,

I am working on constructing a box which has three USB ports which will only be used to power USB devices and not use any data features. The key to this project is to have the power to each female USB port be determined by potentiometer setting. I think I have a pretty good idea of how to do this (relays), but I have a question about power consumption:

See I would like it so this box would only have one power plug on it which would power the Arduino and also the USB ports. What would you think an appropriate power supply would look like? Clearly it must be 5Volts but how much current would I need? If I got a 5volt 2.5A supply would it be sufficient? I am not sure how much current the devices connected to the usb port would draw? Also if you could give some guidance on wiring this together, could I just connect the power supply to everything in parallel?

Thanks, and I will update this page with info on my project and code to help anyone else trying something similar, currently designing a schematic with fritzing software (very nice http://fritzing.org/ ).

The USB standard calls for 500mA per port. Three ports * 500 is 1.5 amps. Add about 200 mA for the Arduino brings the total to 1.7 amps.

The key to this project is to have the power to each female USB port be determined by potentiometer setting.

The "power" in this sentence means what? Voltage? Current? How do you want to realize that with relays?

alecsb:
What would you think an appropriate power supply would look like? Clearly it must be 5Volts but how much current would I need?

Enough to power whatever it is you will be connecting to it. If it’s a conventional USB device it will usually need no more than 500mA, but you haven’t said that’s the case so we have no way to know.

Thanks for the replies.

The kinds of devices are small USB powered heaters, and other random stuff, I'm not 100% because I was just asked to build it :} .

What I meant by the power being controlled by potentiometer is:

The potentiometer controls the timing of when the USB has power, so for example you could set the potentiometer to "6 hours" and then the USB will receive power for 30mins every 6 hours.

So I guess if the USB is rated for 500mA that means that I should get that 1.7Amp power supply and just leave it at 5 volts? Will it work fine if I send the power supplies' power to each source (3 USB ports and Arduino) in parallel? Is that all I'll need to do? The Arduino will need power to switch the relays...

Here is a crude diagram of what I'm trying to do, just imagine the battery pack is our power supply:

That might be correct, but honestly without a proper schematic drawing it's almost impossible to see if you got a correct concept or not. A schematic drawing is the universal language of electronics not that clown pictorial representation that some arduino people like to use. Sorry, pet peeve, rant over.

Lefty

Alright, here ya go.

Vcc would also be powering the Arduino.

retrolefty: That might be correct, but honestly without a proper schematic drawing it's almost impossible to see if you got a correct concept or not. A schematic drawing is the universal language of electronics not that clown pictorial representation that some arduino people like to use. Sorry, pet peeve, rant over.

Lefty

Can you give me a suggestion on free schematic software? The one I'm using clearly isn't the most elegant..

That is one ugly schematic, but you know what, it does the job of explaining what and how you want to accomplish something and that is the main point. So it's much better then the clown pictorials.

Now on to your project. In overall concept it looks good to me. The only detail problem I see is with the relay coils. Unless you pick out small 5vdc reed SPST relays (you don't need SPDT contacts as you show as you aren't using the normally closed contacts anyway) that have current draw of 30 ma or less then you will need to add switching transistors between the output pins and the relay coils. And you should always wire a reversed biased diode right across each of the relay coil's terminals to prevent voltage spikes when the coils are de-energized.

But other then that the hardware design looks OK to me. Added features might be to fuse each voltage applied to each USB connector so that if one user shorts out it doesn't effect all the other USB users or the power supply.

Good job Lefty

retrolefty: That is one ugly schematic, but you know what, it does the job of explaining what and how you want to accomplish something and that is the main point. So it's much better then the clown pictorials.

Now on to your project. In overall concept it looks good to me. The only detail problem I see is with the relay coils. Unless you pick out small 5vdc reed SPST relays (you don't need SPDT contacts as you show as you aren't using the normally open contacts anyway) that have current draw of 30 ma or less then you will need to add switching transistors between the output pins and the relay coils. And you should always wire a reversed biased diode right across each of the relay coil's terminals to prevent voltage spikes when the coils are de-energized.

But other then that the hardware design looks OK to me. Added features might be to fuse each voltage applied to each USB connector so that if one user shorts out it doesn't effect all the other USB users or the power supply.

Good job Lefty

Yeah SPST is what I had planned on using just the cruddy schematic software only had one relay model. When you say that I require switching transistors between the output pins if the relay draws more than 30mA are you referring to the "coil current" spec on the relay. I have a project where I use 3 x 42mA "coil current" relays and nothing between output, and it functions fine. I take it this is not best-practice, if possible could you break down why you would add the switching transisors?

I will be sure to include the fuses and diodes.

I am glad that all I need to power all devices is to wire them all in parallel with the power supply, thought that'd be trickier.

Thanks,

Alec.

alecsb: So I guess if the USB is rated for 500mA that means that I should get that 1.7Amp power supply and just leave it at 5 volts?

I suggest you check whether you are required to provide a [u]regulated[/u] 5V supply, and whether your proposed supply actually is regulated. If it's only powering heaters and chargers and so on they might not care, but electronic devices powered from a 5V supply would typically require that supply to be smoothed and regulated. The Arduino, for instance, won't like it if your supply is significantly different to 5V or has any noise on the line - and it doesn't sound as if you know or will have any control over whether any of your attached devices are generating noise.

From your later comment is seems to me that you have been overloading the I/O pins on the other Arduino and also not providing flyback protection. I suggest you fix that ASAP and don't make the same mistakes here.

PeterH:

alecsb:
So I guess if the USB is rated for 500mA that means that I should get that 1.7Amp power supply and just leave it at 5 volts?

I suggest you check whether you are required to provide a regulated 5V supply, and whether your proposed supply actually is regulated. If it’s only powering heaters and chargers and so on they might not care, but electronic devices powered from a 5V supply would typically require that supply to be smoothed and regulated. The Arduino, for instance, won’t like it if your supply is significantly different to 5V or has any noise on the line - and it doesn’t sound as if you know or will have any control over whether any of your attached devices are generating noise.

From your later comment is seems to me that you have been overloading the I/O pins on the other Arduino and also not providing flyback protection. I suggest you fix that ASAP and don’t make the same mistakes here.

The stuff connected to USB are pretty basic devices, just drawing the power from the USB so I’m not worried about noise or voltage spikes with them. The power going to Arduino of course I am worried about, although I know Arduino has an onboard voltage regulator, would that provide enough protection (keep in mind this is not mission critical ;))?

For between the I/Os and relays you are talking about flyback protection, should I use those transistors lefty I was talking about? I looked up flyback protection and I found that there were specific “flyback diodes” , could I use one of instead and be safe?

Thanks for all your help guys I think I am almost ready to get started :slight_smile:

I don't know what 'pretty basic devices' means in electrical terms.

If you power the Arduino from a 5V supply via the USB connected then you will be bypassing the onboard regulator and any noise in the supply will go straight into the microcontroller.

alecsb:

PeterH:

alecsb:
So I guess if the USB is rated for 500mA that means that I should get that 1.7Amp power supply and just leave it at 5 volts?

I suggest you check whether you are required to provide a regulated 5V supply, and whether your proposed supply actually is regulated. If it’s only powering heaters and chargers and so on they might not care, but electronic devices powered from a 5V supply would typically require that supply to be smoothed and regulated. The Arduino, for instance, won’t like it if your supply is significantly different to 5V or has any noise on the line - and it doesn’t sound as if you know or will have any control over whether any of your attached devices are generating noise.

From your later comment is seems to me that you have been overloading the I/O pins on the other Arduino and also not providing flyback protection. I suggest you fix that ASAP and don’t make the same mistakes here.

The stuff connected to USB are pretty basic devices, just drawing the power from the USB so I’m not worried about noise or voltage spikes with them. The power going to Arduino of course I am worried about, although I know Arduino has an onboard voltage regulator, would that provide enough protection (keep in mind this is not mission critical ;))?

For between the I/Os and relays you are talking about flyback protection, should I use those transistors lefty I was talking about?

The arduino output pins are rated at 40 ma absolute maximum current draw, so if the relay coils you select draw that much or more you are risking damage to the output pins, 30 ma or less is a safer value to try and limit for your output pins. So use switching transistors or find 5 vdc relays the draw less then 30 ma of coil current, they are available.
http://www.allelectronics.com/make-a-store/item/RLY-495/5-VDC-DIP-REED-RELAY/1.html
http://www.allelectronics.com/make-a-store/item/RLY-496/5-VDC-SPDT-REED-RELAY/1.html

I looked up flyback protection and I found that there were specific “flyback diodes” , could I use one of instead and be safe?

Standard cheap 1N4001 diodes will be fine. Be sure they are wired in the correct polarity so as not to conduct with normal current flow direction.

Thanks for all your help guys I think I am almost ready to get started :slight_smile:

[quote author=Coding Badly link=topic=152219.msg1144075#msg1144075 date=1362508611] The USB standard calls for 500mA per port. Three ports * 500 is 1.5 amps. Add about 200 mA for the Arduino brings the total to 1.7 amps. [/quote]

Apple change the game, The new motherboard usb port has more than 500mA. Even old motherboard board you could get it by install software driver.

Gigabyte Asus

FYI.

0.5 amps - the max current a typical USB port puts out 1.0 amps - the minimum current an iPad needs to slow charge. 2.0 amps - the minimum current an iPad needs to do its normal charge (ie same speed as the included wall adapter)

Apple change the game, The new motherboard usb port has more than 500mA.

Sorry to say that, but who cares for Apple? Apple isn't setting the USB standard and the iPad is not meant to be charged by a USB connection to a notebook, is it? An USB device is allowed to pull 500mA, if it draws more, it's not a USB device. Just because the USB connector is used as a standardized charging connector doesn't imply that an USB device is allowed to pull that much current. And I'm quite sure Apple has inserted some logic into their iPad charging circuit to recognize if it's a standard USB connector (so stay at 500mA) or if it's a wall charger with more current.

sonnyyu: Even old motherboard board you could get it by install software driver.

Bullshit. Every computer I've owned since USB was introduced has current-limiting built into the USB controller.

pylon:

Apple change the game, The new motherboard usb port has more than 500mA.

Sorry to say that, but who cares for Apple? Apple isn't setting the USB standard and the iPad is not meant to be charged by a USB connection to a notebook, is it? An USB device is allowed to pull 500mA, if it draws more, it's not a USB device. Just because the USB connector is used as a standardized charging connector doesn't imply that an USB device is allowed to pull that much current. And I'm quite sure Apple has inserted some logic into their iPad charging circuit to recognize if it's a standard USB connector (so stay at 500mA) or if it's a wall charger with more current.

Yes, this type of application is well outside the USB standards and really has nothing to do with USB devices directly. They (you) are just using the USB connector as a path to pass +5vdc current for most often charging of batteries.

Adafruit people ran into problems with Apple's 'tricks' when people were having problems using adafruit's MintyBoost® product to act like a charger for newer models of Apple iPhones. Turns out that on Apple 'approved' USB chargers must have specific voltage divider resistors installed that put specific DC voltage levels onto the USB D+ and D- signal lines to tell the iphone that it was an 'approved' USB charger and what current charging rates it could support. It was an interesting read, check it out:

http://www.ladyada.net/make/mintyboost/icharge.html

Lefty

[quote author=Coding Badly link=topic=152219.msg1145601#msg1145601 date=1362600314]

sonnyyu: Even old motherboard board you could get it by install software driver.

Bullshit. Every computer I've owned since USB was introduced has current-limiting built into the USB controller.

[/quote]

I got mine working after install new BIOS and software driver, your motherboard is either too old or B*llsh*t.

I got mine working after install new BIOS and software driver, your motherboard is either too old or B*llsh*t.

At least the Gigabyte version does enable that high power USB port for only one special port of the board not all connectors. And both manufacturers explicitly specify that this is a special support for Apples proprietary hardware and none of them says something about that being a part of the USB standard.

The Raspberry Pi is also powered by a USB cable but nobody will tell you to connect it to a standard USB port of a computer because it draws almost 1A from there.