I have been using the sparkfun shield succesfully for all the qaulity checks provided by the codes by Oleg. Now i am trying a new thing. Instead of using the Vin to supply power to the USB board, I am using a digital pin to supply the voltage. Therefore, I plug in the Vin of the Sparkfun board in to the digital pin of the board.
The sparkfun board in powered on but the USB host does not communicate properly and returns an invalid value. What may be the problem here ? Should i use a resistor to provide voltage to the USB host ? Can any one please help. I am trying to use the digital pin to cut off the power to the USB host as and when required.
The host shield may take 45 mA. You can't get that much from an Arduino pin (without damaging something). You will need to use a transistor to turn it on or off.
Thanks for the help. Can you tell me a general configuration for the transistor. Talking of BJT, what connections need to be made with gate, emitter and collector. On the other hand if we are to use a mosfet, which connection we need to make with source, drain and gate. I have some background in BJT and Mosfet but I am not sure how to use them.
Moreover, i posted something about the current measurements of Arduino in sleep and active modes in the general electronic section. I have been trying to find out some help. If possible, can you please help in that as I was comparing my results with your extensive work on current measurements on arduino currents.
I am trying to figure out where to place my USB Host shield. The voltage from the Arduino pin is to be supplied to the gate. Do you have any idea what would be the connection point for the ground and VCC of the USB Host shield. I am trying to understand the functionality of the switch. Once I apply gate voltage, current would start flowing from the battery towards the drain as the junction within MOSFET would become forward biased. Should we put Vout as the VCC of the USB host shield. Then where shall we join the ground of the USB Host ?
Is R1 really only 10 ohms? That is awfully small. I don't see it limiting much gate current.
A MOSFET doesn't get any (or hardly any) base current. The ideal MOSFET has an infinite gate impedance, unlike a BJT which is driven by current. For a BJT you want a current limiting base resistor. For a MOSFET it isn't needed.
majenko:
A MOSFET doesn't get any (or hardly any) base current. The ideal MOSFET has an infinite gate impedance ...
That's kinda what I was thinking. So I didn't understand the 10 ohms. I could understand 10K or 100K, things happen, parts go bad, and you want to protect your processor. You don't want a cascade of failures ... Load spikes ... MOSFET dies ... high current goes into chip.
What is the advantage of using a MOSFET over an NPN in your circuit?
The MOSFET behaves like a switch where a BJT is more like an amplifier. Provided you supply sufficient voltage (and a logic-level MOSFET should turn fully on at 5V) then it switches for very little current at the gate.
If you use a BJT then the more current you need to flow, the more current has to be supplied at the base, because it is just amplifying, not switching.
Is R1 really only 10 ohms? That is awfully small. I don't see it limiting much gate current.
Grumpy_Mike:
A FET gate looks like a small capacitor, and a discharged capacitor looks like a short circuit when you first apply voltage to it. So a resistor is to protect the output pin of the arduino from over current. Too big and it turns on slower, to small and it does not limit the current to below the maximum of 40mA.
Just a few tens of ohms should be enough but in practice for just a solenoidal anything up to 1K.
As I understand it, the resistor protects the output pin. Too high a value and the MOSFET takes too long to turn on.
There are whole PDF files with complex maths in the to work out the ideal resistor for a particular circuit. That takes into account the speed of switching, the characteristics of the MOSFET and so on. My 10 ohms is just a ballpark, and if someone said "but Nick it should be 22 ohms" I would have no real reason to doubt them.
So you could use 10 ohms or 10K ohms and the MOSFET would still turn on. The only difference is the 10K would turn in it on a little slower.
I bet you could set the pin mode to INPUT and then write HIGH and LOW to the pin to turn it on and off. You wouldn't even need a current limiting resistor. I've not done it but if you can safely short it to ground with a button you should be able to feed the voltage to a MOSFET without a resistor. (Just a random thought)
Please help me for the below questions i had posted
I am trying to figure out where to place my USB Host shield. The voltage from the Arduino pin is to be supplied to the gate. Do you have any idea what would be the connection point for the ground and VCC of the USB Host shield. I am trying to understand the functionality of the switch. Once I apply gate voltage, current would start flowing from the battery towards the drain as the junction within MOSFET would become forward biased. Should we put Vout as the VCC of the USB host shield. Then where shall we join the ground of the USB Host ?
I bet you could set the pin mode to INPUT and then write HIGH and LOW to the pin to turn it on and off. You wouldn't even need a current limiting resistor. I've not done it but if you can safely short it to ground with a button you should be able to feed the voltage to a MOSFET without a resistor. (Just a random thought)
You'd need to select your pull-down resistor carefully then though, or the built-in pull-up that you're connecting and disconnecting by writing high and low to the port won't be able to override it. You'd end up with a voltage divider, and in order to get over the threshold voltage and into the saturation zone you'd need a resistor in the order of megs (I forget what the internal pull-up is on these chips off hand).
Vik009:
I am trying to figure out where to place my USB Host shield. The voltage from the Arduino pin is to be supplied to the gate. Do you have any idea what would be the connection point for the ground and VCC of the USB Host shield. I am trying to understand the functionality of the switch. Once I apply gate voltage, current would start flowing from the battery towards the drain as the junction within MOSFET would become forward biased. Should we put Vout as the VCC of the USB host shield. Then where shall we join the ground of the USB Host ?
You have a good point. If you wire up the host shield like Nick's schematic shows, with the shield in place of the load, when the transistor is off then that is like pulling the ground from the shield. This is usually not a good thing. You usually want everything to share a common ground. The circuit works good for closing a relay or lighting a light, but does it work for powering a circuit board?
Perhaps what is needed is a different circuit, maybe using a P channel FET.
BTW: It's probably not important, but why do you want to be able to switch the shield OFF and ON?
I need to conserve power therefore when the arduino is sleeping, then the current is not flowing towards the USB Host shield and the USB attached to it.
Can you explain the circuit for P FET a bit further ?
Vik009:
Can you explain the circuit for P FET a bit further ?
As much as I would like to, I don't think I can should. I am not even sure that it is the solution. The solution could be moving the N Channel FET to the positive side, but I don't think so. I would prefer to remain silent and thought a fool, that to speak out and remove all doubt. I know enough about electronics to be dangerous, I would rather the danger be limited to me and my equipment.
I'm just a dumb redneck that don't know nothin' but if I follow those squiggly likes right, I would say that the diode is not needed. The need is to drive a circuit board and not an inductive load.
The "Load" is a circuit board and probably square, not round.
I assume the NPN transistor is to function as an invertor. But is it really necessary. You would need to change your logic to write HIGH to turn OFF and write LOW to turn ON.
The question would be:
If you write a HIGH (to turn off the board) and then go to sleep, does the board stay off?
What does your power usage look like while asleep?
(OK the questions).
RandallR:
I assume the NPN transistor is to function as an invertor. But is it really necessary. You would need to change your logic to write HIGH to turn OFF and write LOW to turn ON.
That particular circuit (I didn't do it today) shows a motor, hence the diode. But I think it is supposed to across the motor.
As for the transistor, I think the idea is that you can use an ordinary (not logic level) MOSFET and the transistor boosts the base enough to turn it fully on.
If it's asleep I'm guessing the transistor and MOSFET would be off, but I would really want to test that to be sure.