Maker Pro
Maker Pro

current from usb port and AT90USBKEY

Kardo22

Mar 7, 2014
36
Joined
Mar 7, 2014
Messages
36
Hi
I'm thinking of using AT90USBKEY (http://www.atmel.com/Images/doc7627.pdf) to control my circuit.
The problem is, I don't know if I will get enough current from the USB port and output ports of the controller. USB should always give at least 100mA and more if it has a high power supply but can the AT90USBKEY also supply enough?

I need to run 7 optocouplers from the output ports. I'm thinking of using 4N25-M:
http://www.farnell.com/datasheets/683405.pdf
If I understand it rigth then it needs a min of 10mA? Would the AT90USBKEY be able to give over 70mA in total, I'll probably need to add some other stuff too but that takes less current?

If its not a great solution, where could I get the power from? Would taking the 5V from USB power pin (I'm thinking from the AT90USBKEY board before it is converted to 3,3V) be a bad idea?
I have a 12V power supply to run relays and LEDs. Would it perhaps be more effective to convert it to 5V and use this? Would converting about 100mA from 12V to 5V make a lot of heat?

Thank you
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,725
Joined
Nov 17, 2011
Messages
13,725
As far as I can see the 5V on Vbus in USB host mode are directly controlled via transistor M1 which in turn receives 5V from an LM340 regulator.
The LM340 is capable of delivering up to 1A, provided it is cooled to remove excess heat. The manual of the AT90USBKEY does not show whether and how the LM340 is cooled.
Use as low an external voltage (e.g. 9V) to minimize losses in the LM340. With a 12V supply, as you suggest, 7V will have to drop across the LM340 causing it easily to overheat.

The port pins of the AT90USB128 are specified for a load current of +10mA/-20mA, therefore 10mA should be o.k.
Note that the integrated LEDs on the board use a 1kOhm series resistor, resulting in less than 5mA per LED. The 4N25-M are tested at 10mA (tahat's the number from teh datasheet you probably refer to). However, you can use them from approx. 2mA...20mA, see figure 2 in the datasheet. The current through the LED will restrict the current through the transistor via the current transfer ratio (ctr): I(transistor)=I(led)*ctr - of course depending on the load resistor on the transistor side.
The min. ctr for the 4N25-M is 20 (datasheet, table on page 3). This number has to be multiplied by the "normalized ctr" figure 2).
Example
at 5mA the normalized ctr is ~1.1
The resulting ctr is 20*1.1=22
The resulting collector current is 22*5mA=110mA
The practical transistor current is defined by the operating voltage and the load resistor on the transistor side of the photocoupler. Assuming 5V and 1000Ohm, this gives Í(load)=5V/1000Ohm=5mA (I have neglected the collector emitter saturation voltage of the transistor.
 

Kardo22

Mar 7, 2014
36
Joined
Mar 7, 2014
Messages
36
Thanks Harald.
If I understood correctly then its enough to give f.e. 5mA to the optocoupler. In that case I'll connect it to the AT90USBKEY port without transistor.

About the used voltage. I don't think I could use 9V. I have 12V relays that switch at 9V, using 9V power supply would probably not be enough.
 

Kardo22

Mar 7, 2014
36
Joined
Mar 7, 2014
Messages
36
The current through the LED will restrict the current through the transistor via the current transfer ratio (ctr): I(transistor)=I(led)*ctr - of course depending on the load resistor on the transistor side.
The min. ctr for the 4N25-M is 20 (datasheet, table on page 3). This number has to be multiplied by the "normalized ctr" figure 2).
Example
at 5mA the normalized ctr is ~1.1
The resulting ctr is 20*1.1=22
The resulting collector current is 22*5mA=110mA
The practical transistor current is defined by the operating voltage and the load resistor on the transistor side of the photocoupler. Assuming 5V and 1000Ohm, this gives Í(load)=5V/1000Ohm=5mA (I have neglected the collector emitter saturation voltage of the transistor.
Hi Harald
I did some more reading on optocouplers and came across this: http://electronics.stackexchange.com/questions/43071/how-do-i-choose-my-optocoupler
According to this the CTR is in % not a regular number. Would the max collector current then be 1,1 mA?

I'm thinking of driving a ULN2803 (http://www.ti.com/lit/ds/symlink/uln2803a.pdf) with the optocoupler. The uln2803 drives a relay. I read that optocouplers migth not give enough current to switch a relay but it should be enough for uln2803(on datasheet its typical 0,93mA and max 1,35mA)?? Seems like the optocoupler would be enough?
Also I read about dark current. This optocoupler has a max of 50nA@10V. could that be a problem?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,725
Joined
Nov 17, 2011
Messages
13,725
Sorry, you're absolutely right, ctr is in %, which reduces my numbers by a factor 100.
It should be no preoblem to drive an ULN2803 from an optocoupler. If you connect the optocoupler from Vcc to the Input of the ULN, just add a resistor from teh Input of the ULN to GND to kepp it at defined low when the optocoupler is turned off. A resistor of e.g. 10kOhm will develop 10kOhm*50nA=500µV from the dark current. This is way below the low treshold of an ULN chip.
 
Top