SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
User avatar
By rmeyer
#167115
I suspect a painfully simple question, but I cannot find a clear answer here. My new Pro Micro 3.3V is working great- my question now is, can I supply another power source, which is handling my higher current devices, to the RAW pin, while at the same time continuing to program and run the board with the USB plugged in? What if the RAW power is 5V instead of 3.3? (It's not in this case, but that could change.) I do also understand that if I am sure that my power source is clean and close to 3.3V that I can connect it directly to VCC instead.

The schematic makes it clear how RAW routes through the regulator where it comes out as VCC, which is the same VCC as is connected to the USB port, so it would seem that this just creates two parallel 3.3V sources whenever power is on the RAW pin and USB is plugged in. I just want to be sure before I connect it this way. So far I have been testing the code on USB power, then unplugging USB and connecting power separately. I do know that on all the other BASIC Stamps, Picaxe boards and such that I have worked with, they could be programmed through USB while external power was connected. I am assuming this to be the case here, but this is my first Arduino so I want to be sure.

Rob
By Valen
#167130
I don't have such a Pro Micro 3.3v, but judging from the schematic it should be safe to connect an external power source to RAW, at the same time as the USB is connected. There is a blocking-diode (and fuse) between the USB 5 volt line and the input to the 3.3v regulator. This diode should protect the USB port from getting more than 5 volt pushed into it from the RAW input. BUT!, this is only safe if the SJ1 jumper is open (no solder bridge). It should be open for the 3.3v version, so you are probably good to go. If you solder it closed, then the 3.3v on the Pro Microboard will be connected to the 5v USB output, and Vcc wil get pulled upto 5v, likely killing any connected 3.3v devices.

Since RAW needs to go through the regulator, it must be higher than 3.3v. I don't know what the voltage drop is of this regulator. ([EDIT]datasheet: typical 350 mV @ 500mA, max 600mV @ temperature extremes)

But realise that the voltage regulator is only capable of sourcing 500ma (atleast, in this hardware version) in the first place. A USB port probably only gives 100ma, so it would be an improvement. But don't expect more than 500ma, even if you have a (for example) 2 Amp capable power source connected to RAW.
User avatar
By rmeyer
#167132
Thanks! That should do it. Just to clarify, I do not intend to power the other devices through the onboard regulator, they are connected to the power bus itself. I just wanted to be sure that I could have my batteries connected to that bus while the USB was connected. The other devices are mostly sensors and such that are not drawing much current from the Arduino pins, they are just providing an analog signal to them.

Rob
By Valen
#167133
Ok. Just realize that when battery voltage drops, sensors might give out lower responses in proportion. But since the Pro Micro is fed through a regulator it has a somewhat more stable voltage applied to it's analog reference pin. That would be trickier to calibrate. If connected to the same 3.3v bus calibrating the sensors output would be more reliable. But that would ofcourse depend on the sensor used, if it has an internal voltage reference or not.

[edit]Also make sure the sensors or whatever that is fed through the RAW pin gives it output in the same range as the 3.3 volt pins can accept.
User avatar
By rmeyer
#167160
Thanks again. Yes, the sensors are working perfectly within range, however I was having a problem which I just sorted out, which made me think maybe I should have provided more information with my first question.

Perhaps it was assumed that my RAW power source was more than 3.3V. It was, however, two 1.5V AA cells. So everything seemed to work fine at first. I had all my sensors connected and worked through few small revisions of my code, after which I disconnected my AA battery pack and unplugged everything, which is normally what I do to save batteries as I write the next section of code for the project.

After a few minutes, one of the AA batteries suddenly "popped" and leaked fluid all over the battery holder. It was just sitting there not connected to anything. Since nothing was connected at that point I had nothing to suspect other than maybe a defective cell. I cleaned things up, put two new batteries in and went about my business until essentially the same scenario happened again. I was at a break in testing, the batteries were unplugged, and the "pop" and another mess to clean up.

This forced me to take another look at the Pro Micro schematic and at my breadboarding, all the while still keeping in mind that functionally the whole project was still working flawlessly. I then noticed that the USB power is not connected to the same VCC as everything else, it is labeled as UVCC.

There is a diode on the input of the regulator that appears to be intended to protect the USB from being backfed too high a voltage if a higher voltage is connected to RAW. What it does not do is keep a greater voltage on the USB from feeding through to a lower RAW voltage source.

So whenever I had my two new AA batteries plugged into RAW and I plugged the USB into my computer to program, I was essentially trying to charge my 3V AA battery pack with the 4.59 some-odd volts my laptop's USB connection is putting out. I don't know why the batteries in both instances waited until after they were disconnected to "cook off", but I suspect that it would have happened eventually had I left them connected.

Even though I was hopping for the simplest solution, I now suspect that I cannot run a AA source on this project at the same time I am programming it, unless maybe I find a place on the board where I can open the UVCC connection. I know I can run regulated power to VCC on the board, or run a higher source voltage to RAW. I designed my project to run on two AA cells, which I suppose is below the 3.3V called for anyway. It all works fine, but I think maybe a four-cell battery pack is in order.

[EDIT]...and after studying the schematic a bit more, it seems that one more properly oriented diode at the RAW pin would have provided simple protection from this sort of thing, allowing for voltage to flow from RAW into the regulator, while blocking current from flowing back to the external RAW connection from UVCC. Of course, the voltage drop involved would just end up necessitating a greater than 3V battery pack anyway, but it would still be good protection against UVCC trying to "charge" a dying 4.5V or 6V battery pack.

Rob
By Valen
#167166
Ahh, lessons learned the hard way. I didn't consider the case of the USB voltage charging up (non-rechargable) 2x AA batteries. Asking exactly what your battery setup implies would have been more prudent, before saying it is ok.

The external voltage applied to RAW should be more than 3.3v+regulator drop) for the regulator output to be operating properly at 3.3v. And higher than USB voltage minus diode-drop to prevent backflow into the external source on RAW. Adding a diode to prevent backflow into your battery pack would help keeping the batteries alive, but also be somewhat of an energy waste, in addition to the waste over the regulator.
User avatar
By rmeyer
#167179
Yes, it sounds like we are now both on the same page. I am learning a great deal from this and I appreciate your assistance. I was brought up in the TTL world, so aside from this being my very first Arduino project, it is also my first CMOS-based, or should I say, my first project based on 3.3V.

In my mind I was considering the 3.3V Pro-Micro as opposed to the 5V version based upon the idea that it could be powered by a 3.3V source. My understanding now is that the 3.3V version is offered not so much as an alternative for a lower voltage power source, but more for its compatibility with 3.3V sensors and other peripherals. Your comment about the voltage level on the analog reference pin got me to thinking about the real reason for having the two voltage options on the Pro Micro's.

All that being said, the project as I mentioned is working great and after building many many other projects based upon Basic Stamps, Propellers, Picaxe and BasicX, I am thus far thoroughly enjoying the performance and development process with the Arduino. My motor control PWM routines are smooth and responsive, my analog sensors are responding in real time and with accuracy and reliability, and I just can't wait to do more with it.

Rob
By aris
#169499
I have been having a look at this issue too for a 5V Pro Micro based portable device that I want to power either with batteries (using a 5V step-up DC/DC converter) or USB. The best I could come up with, though I have not made it, is an op-amp based power source selector. Example:

http://www.edn.com/design/analog/436830 ... r-selector

I do not understand the electronics yet but you use op-amps as comparators and the mosfets switch between the input lines.

I think the full-sized arduino schematics have a section in them that allows you to connect and disconnect the USB power while batteries are connected. If you look there you may get a power source selection circuit. Some people have critisised it but it obviously works.

I also had a look at "power path management" because Li-ion powered circuits also have to deal with selecting power from charger or battery but I did not really get anywhere there due to patience/understanding issues. There seem to be dedicated chips for that.

Maybe another solution could involve a 2 position mechanical switch that allows either battery power OR usb power to be on. This way you can cut off one and supply only the other. If it is a 2-pole-2-throw (2P2T) switch you can also switch grounds.
Advantages: simple, cheap, can be done in minutes
Disadvantages: not so elegant, have to hack open a USB cable

Then regarding your high-current devices, power those independently of how you power the Pro Micro.

Thoughts?

First post! Woot!
:violin:
User avatar
By rmeyer
#182634
(I know... It has been over a year since I visited this thread but thanks for the input.)

I left off on this project nearly a year ago after learning that a major component of my design had been discontinued in lieu of a new design that had not yet been released (hell of a way to do it if you ask me).

So the last year has been spent waiting for the new version of the component and redesigning my board to accommodate it. Soooooo.... I am now back to the same power supply issue on the Arduino part. I just connected my new board for testing and I was immediately reminded of the power supply issue.

With the main 12V battery disconnected from the board, I plugged the Arduino into USB to load a simple "hello world" blinky program and as soon as USB was plugged in the VIN power indicator LED on my board lit up as well as the 5V Power indicator downstream of the switching power supply circuit and the 3.3V power indicator downstream of the 3.3V regulator my board has. So essentially the USB was feeding back out of the RAW pin on my Arduino where it found a connection to the output of the 5V switching regulator, which powers the entire board.

Thankfully I had not populated the speech controller module and all the other plug-in sensors yet, I imagine it would have overloaded either the Arduino's regulator or my laptop's USB port.

In the short term I think a diode between the Arduino's RAW pin and my board's 5V switching regulator output should keep the USB from feeding the rest of the board in this arrangement.

That leaves just one more question: The diode will keep the Arduino's RAW pin from backfeeding the board, but it does not address a higher input voltage (12V in this case) on my board from possibly damaging the USB connection. I read mention earlier in this thread that the Arduino has a diode onboard to protect against that scenario. Before I proceed I will re-read the schematic and maybe do a quick check of the levels on the programming pin with my board's 12V input connected.

(**** EDIT ****) So I just reviewed the schematic and it does indeed look as if D2 protects anything coming in on the RAW pin from feeding back to VBUS. I should be good to go with just adding the one additional diode on my board. I will post back with the results either way.

Rob