I have read, and (hopefully) understood, that a LiPo battery with a max voltage of 4.2 can be used as a direct supply on VCC pin on a Pro Mini 3.3V. I will only have a 1306 display attached to it.
I got that "the microprocessor is the same" and the tolerance is up to 5.5V - does it extend to the measurement on the analog pins? (I also want to measure its charge level using an analog pin to know when to charge it). Can I connect it directly or do I need a voltage divider? Does not need to be precise, just give a 100>82> 70% (4.2*0,7=2.9 prior to resetting!). BUT if "Max voltage on any pin is Vcc + 0,5V" I also wonder if going in with a 4.2V "descending" has any influence. Measuring the charge as a % of itself won't do. Has "analogReference()" anything to do with it?
I also read several mentions of "remove (!) the voltage regulator and the power LED" :-o ... do they really mean tampering with dot sized components on the board? Any articles to read on this surgical op?
Thanks
Flavio
in the default settings Vcc is the ADC reference, so you always get 1023 regardless of how full or empty the battery is. Use the internal (1.1V?) ADC reference and a voltage divider to bring the Vcc into that range.
Some regulators do not accept an output voltage without input voltage or higher than their nominal (3.3V) output voltage. Some do.
Yes it can. The processor is the same as a 5v Pro-mini, but the crystal controlling the clockspeed is 8MHz (compared to 16MHz for a 5v version)
If all other external components run at the same voltage, that is the easiest.
The measurement of the analog pins is referenced from VCC.
For that you will need some kind of reference voltage, something that is always at a particular voltage.
They probably do, but i don't see any real need for it. The onboard LED's current limiting resistor is large enough to work at 5.5v as well, The voltage regulator is connected between Vin and Vcc to step down from whatever input voltage is applied to 3.3v, i don't see why it should be removed if you power the board through Vcc.
As far as i know there is diode in line somewhere to prevent reverse voltage. Most regulators do not even accept voltage on the output if there is no power on the input.
Regardless if you remove the regulator, you will not be able to power the board through USB, which will complicate uploading a sketch.
Thanks. Will study the ADC reference. I suppose you mean I should use analogReference(INTERNAL) to set the pin voltage and then the 1024 value would be referred to that. I should be able to find the divider value.
My concern was more about consumption. With no switch if the LED stays on it will "drain" the battery - same they say for the regulator (in reverse??? prevented by a diode?). I will also have to study how to power down with interrupts to save energy.
Tks
F
When DrDiettrich mentions concerns with the regulator not tolerating excess voltage on its output terminals, the point is that the regulator may start conducting some current into the voltage reference. That may not hurt the regulator (which is designed to dissipate some power) but - like the pilot LED, it may waste battery capacity.
Which is of course, irrelevant as it relates to the Nano, not the Pro Mini. (which does not have USB!)
Precisely.
Well, power down does not use interrupts as such, but the interrupt functionality is used to wake again.
The Pro Mini made by SparkFun (and maybe some of the clones) actually has jumper pads with a small trace between them, allowing you to disconnect the voltage regulator and LED by cutting the trace. The jumper pads can be solder bridged if you need to reconnect the circuitry.
Regulator:
All the low voltage drop regulators I've ever found on my Arduino's will withstand voltage on the output. However you must not put a load on the Vcc pin (essentially the input of the regulator.
Programming w/o regulator:
If you decide to remove the regulator you can still easily program the board by powering it with your battery and disconnecting power coming from your programmer.
Regulator / LED removal:
I would simply crush the parts to be removed with a needle nose pliers. Not very elegant but relatively safe.
Low Voltage:
The ATmega will operate down to ~ 2 volts, however the lower the voltage goes, the lower the clock frequency it will operate at. I can't say if you will have issues operating your board a the 2.5V of the battery low voltage.
If you Must go to 4Mhz then you will have to load a new bootloader capable of operating at 4 Mhz.
A/D input:
You should put a 0.1ยต Capacitor between the analog input pin and a ground pin nearby. This will reduce the noise getting into the A/D conversion.
Reducing power:
For power savings look into the processor sleep modes.
To disconnect the input divider you will need two mosfets. A P channel to shut off the divider at the high side and an N-channel to control the P channel.
The regulator has nothing whatsoever to do with programming. Never ever did.
It is basically completely unnecessary. Just a "retro" hangover from days gone by when we did not have cheap and readily available 5 V regulated power supplies such as "phone chargers".
Much better to power the pro mini from the programmer, unless there are peripherals connected to the pro mini that cannot withstand the programmer voltage (in which case you need a programmer that will run at 3.3v). Last thing you want is to have a programmer running at 5v connected to a pro mini running at a lower voltage.
I stand corrected, for some (erroneously) reason I thought the "programming" pins when through the regulator. However it is still valid to power with an external source.
You do not need to use a voltage divider to measure the battery voltage. If you examine the ADC registers in the datasheet, one of the options for which channel to measure is the 1.1V internal reference. So you can leave the ADC set to the default Vcc for the range, and measure the 1.1V. You will get a higher value out of the ADC as the battery discharges. No external parts are needed, and no current draw is needed.
Forgive but I am not sure I understand, practically, how it should be done. I will look for the registers in the Datasheet and try to get a better understanding. If you could point me out to some specific resource or example... thks.
As a parameter in AnalogReference INTERNAL1V1, as I am going to use the PRO MINI, should not be available (it says "(Arduino Mega only)"). Was it that?
F
The ADMUX register selects the reference for the measurement, which will be Vcc, and channel of what is being measured - that will be channel 14, the internal 1.1V bandgap voltage. I don't know of a library that includes this option, but below is an example sketch that produces the value of the Vcc voltage based on the bandgap reading. It should work for the 328P in the Pro Mini. The ADMUX register is described in detail in Section 24.9.1 in the datasheet for the 328P. The bandgap waries a bit from chip to chip, so the sketch provides for a way to calibrate for a particular chip.
// Function created to obtain chip's actual Vcc voltage value, using internal bandgap reference
// This demonstrates ability to read processors Vcc voltage and the ability to maintain A/D calibration with changing Vcc
// Now works for 168/328 and mega boards.
// Thanks to "Coding Badly" for direct register control for A/D mux
// 1/9/10 "retrolefty"
int battVolts; // made global for wider avaliblity throughout a sketch if needed, example a low voltage alarm, etc
void setup(void)
{
Serial.begin(9600);
Serial.print("volts X 100");
Serial.println( "\r\n\r\n" );
delay(100);
}
void loop(void)
{
battVolts=getBandgap(); //Determins what actual Vcc is, (X 100), based on known bandgap voltage
Serial.print("Battery Vcc volts = ");
Serial.println(battVolts);
delay(1000);
}
int getBandgap(void) // Returns actual value of Vcc (x 100)
{
// For 168/328 boards
const long InternalReferenceVoltage = 1059L; // Adjust this value to your boards specific internal BG voltage x1000
// REFS1 REFS0 --> 0 1, AVcc internal ref. -Selects AVcc external reference
// MUX3 MUX2 MUX1 MUX0 --> 1110 1.1V (VBG) -Selects channel 14, bandgap voltage, to measure
ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
delay(50); // Let mux settle a little to get a more stable A/D conversion
// Start a conversion
ADCSRA |= _BV( ADSC );
// Wait for it to complete
while( ( (ADCSRA & (1<<ADSC)) != 0 ) );
// Scale the value
int results = (((InternalReferenceVoltage * 1024L) / ADC) + 5L) / 10L; // calculates for straight line value
return results;
}