I would like some advice on using 3.3V vs 5V for my project.
I designed a beam-break race timer; powering it with a rechargeable 3.7V nominal lithium battery. At the time it seemed easier to run the Photon at 3.3V’s instead of 5V’s; always assuming I would re-work the system with the Adafruit Powerboost 500-C when needed. Since I need 4 independently powered poles for the project, it adds about $200 to the component costs for this project I intended to sell. Is there any reason I need to use 5V?
Unless you need 5V, you don't need 5V. I mean, if it works, it works. You could try cheap usb powerbanks if you want 5V, though they have a tendency to go into sleep if the current draw is too low.
You can power a Photon either by VIN at 3.6 to 5.5V, or via 3V3 at 3.3V. The only catch is that if you power by 3V3 you cannot use the USB port, as both the onboard Photon regulator and your 3V3 supply would be applying power to the 3V3 rail and one or both sides could be damaged. This isn’t an issue when powering by VIN as there is a Schottky diode on VIN that protects the USB port from power input on VIN.
If you power by 3V3, you must either not use USB, use an unpowered USB cable (data lines + GND only), or disconnect the 3V3 supply when powering by USB. This can be done by using a combination of an N-MOSFET and P-MOSFET triggered by VIN and controlling the power the 3V3.
Also, you do need a regulator on 3V3, you can’t just connect a LiPo to 3V3.
Does this mean that I can connect a regulated 5V supply directly to VIN, and then plug and unplug the USB port at will without any danger that the 5V from the USB cable won't try to fight with the 5V from my regulated supply?
Interesting ... can you whip up a quick schematic to show how this could be done? Thanks.
Exactly. However if your external supply would happen to provide less than (Vusb - 0.2V) you may want to protect that against back feeding with another Schottky Diode.
I am powering a Photon from a 3.3V regulator since I need more current than the Photon will output when powered from Vin. So I wired my regulator directly to the 3V3 pin. Then I though to search this forum regarding considerations when also using USB and I found this thread. I attempted to create the circuit that @rickkas7 mentioned to disconnect the 3.3V source when the USB cable is plugged in. Can anyone verify this is what he was referring to?
@ninjatill, a quick look says yes, that should work.
@peekay123, great, thanks!
@rvnash, if you didn’t figure it out, here’s the schematic.
@ninjatill, @rvnash, that circuit will do the opposite of what you want.
If you add another N-FET, then you can invert its operation.
All resistors should be 10k or lower to minimize the switching time (depends on the FETs you pick), but not too low to draw too much current.
Also, make sure you pick FETs with a low Vgs threshold, like the BSS138.
@Pescatore, thanks, not sure how I missed that. I think since @rickkas7 mentioned a P-Channel/N-Channel MOSFET pair, I just started going down that road with the mentality that I was trying to turn on the P-MOSFET when Vin goes HIGH… but, of course, that is backwards thinking. Instead of adding another N-MOSFET, wouldn’t it make sense to eliminate both N-MOSFETs leaving only the single P-MOSFET with a pull-down resistor on the gate with the gate attached directly to Vin?
Sorry about that, I managed to confuse myself and everyone else. I was thinking enhancement mode MOSFETs, which would require a P and N channel pair to invert the gate of the P channel. Of course a more logical solution would be to just use one P channel depletion MOSFET. Unless I’ve confused myself again.
Crap, I missed it also! But that’s way too complicated and shouldn’t take so many devices.
If the N-FETs were not there, I would add a diode in series with R1 to avoid feeding the 3.3V regulator with 5V.
However, it is not cleat to me what would the voltage be on the Vin pin. I guess it gets dragged down because it would be feeding the 3.3V regulator on the Photon and R1 being many kilo Ohms, the voltage should be low enough to turn on the P-FET and not provide power to the Vin pin. So, to be 100% sure, I would not take out the N-FETs.
I wouldn’t use a depletion FET because I am not sure there is enough negative voltage to turn it off.
You can save space and parts with an N/P FET pair like the FDG8842CZ.
Or, use a photomos like this
The drawback is that it wastes 10mA 18mA of current when Vin is present (if R=210Ohms).
Otherwise, use a normally closed photomos. The AQY410S has a 520us operate time, so it should be fast enough to not affect the regulator on the Photon.
Sorry, I deleted the blocking diode on the Photon idea. It will not work because you would also need one on the external 3.3V supply.
I personally really like load switches (with quick output discharge) for this type of application. I would suggest the following quick schematic for a disconnect circuit (its easier to draw then write):
- Internal 3.3V supply output connected to load switch input; input capacitor required
- load switch output (3.3V) connected to 3.3V pin on photon; output capacitor required
- tie Vusb to gate pin on N-mosfet; have a larger pulldown resistor to GND (to minimize Iq) on this line to ensure it is kept to 0V when USB is not applied
- connect N-mosfet source pin to GND
- connect N-mosfet drain pin to enable pin of load switch
- have pullup resistor between 3.3V and drain pin of N-mosfet. Suggest a larger value to minimize Iq.
That translates to the same 3 FETs topology with the N/P pair in a more sophisticated device (TPS229xx and Diodes Inc makes some). I wish they would provide an enable pin for both logic levels.
On further thought, one does not need to use the supplied 5V from the USB connection. The 5V is intended to power peripherals but is not required for serial communication (needs D+, D-, and GND). Since you created a 3.3V supply already, would suggest the following instead:
- Have the 5V Vusb a no-connect at the USB connector - only use the USB for serial communication
- Power Photon from your 3.3V supply to the 3V3 pin
- Eliminate the disconnect circuit altogether
@dmfische, regarding not using 5V from the USB cable, that would be an OK solution if I was the only one to ever hookup a USB cable to this board. However, I’m planning for the future (and I suppose and my own forgetfulness) by implementing the disconnect. I would rather have a solution where you don’t need to remember to use a special cable.
I did some research after you mentioned load switches and while I like having everything wrapped up in a single package, as @Pescatore points out, you still need an N-MOSFET to reverse the levels on the enable pin. I spent a few minutes looking and it doesn’t seem like they make one with an active low enable.
Looking at the Photon schematics again, there is a SS3P3 Schottky diode from Vusb to Vin. When the Photon is powered by 3.3V, then the Vin pin seems like it would float. And when powered by USB, Vin would be at (Vusb - 0.45V = 4.55V). I think by using the following circuit I would only be wasting approx. 1mA when powered by USB. That’s acceptable to me since debugging by USB is the exception, not the norm. I looked for a P-MOSFET with a low Vgsth and the DMG2301LK seems to fit the bill (-0.3Vgs min, -1Vgs max, fast response time of about 22nS total to turn off.)
@ninjatill, I like your solution. Very simple and effective.
One thing that has been bothering me is powering the 3V3 pin with no Vin, nor Vusb. I read in many posts that people do this without issues. I am not sure what the switcher on the Photon does and I didn’t notice this detail in the datasheet.
Looking at the RT8008 block diagram, it seems you would be providing 3.3V through the body diode of the output PFET, to Vin pin 4. I can’t tell if the switcher will try to pulse the synch FET, which would load down your supply.
A safer thing to do would be to disable the switcher, but you would have to modify the Photon.
@Pescatore, one last post on this… I checked the datasheet for the Rickteck RT8008 on the Photon. From that datasheet: " RT8008 enter shutdown mode and consumes less than 0.1μA when EN pin is pulled low." By putting a pull-down resitor on the P-MOSFET gate, it effectively pulls both Vin and the RT8008 EN pin low. So as soon as Vusb is disconnected, and there is no voltage source on Vin (as in my design), the RT8008 would enter shutdown mode. I think that proves a simple enhancement mode P-MOSFET will do the job.
Also, the RT8008 datasheet states, regarding the EN Pin, “(Active High, do not leave EN pin floating, and VEN < VIN + 0.6V).” It would seem that the Photon schematic allows the EN pin to float (along with Vin) when powered directly by 3.3V with Vin not connected. But the VEN<VIN+0.6V note might inject an issue seeing as Vin and VEN would both be pulled to the same GND level.
From the Photon Datasheet (unaltered): The EN pin is tied to Vin by a 100k resistor. The Vin pin floats when USB and Vin are disconnected. Adding a pull-down on Vin would pull the RT8008 EN pin low.
@ninjatill, I totally agree your solution works for switching the external 3.3V.
I am thinking that the regulator will not be disabled. This is because the 3.3V supply will create current flow into
the inductor, into pin 3 and out of pin 4 of the regulator. From the datasheet diagram, it seems the top NFET
body diode will be forward biased. The cap C4 will charge and eventually pull up the enable pin.
So, the EN pin should not be floating, but it seems the Photon is intended to be powered only from Vin or Vusb.
Rewiring the Photon’s input power would make a more robust design, but as I said, applying power to 3V3 seems to work fine for many who have done it. The input current of the enable pin is not specified, so maybe that’s the saving grace.