Read VCC supply level without external components #123
Replies: 9 comments 44 replies
-
Very cool feature ! |
Beta Was this translation helpful? Give feedback.
-
@LaZsolt , should be added to the compatible library list in the wiki, if it's ok for you? |
Beta Was this translation helpful? Give feedback.
-
I run in my 328d, show 1.48v? I will meaure it by multimeter to confirm. |
Beta Was this translation helpful? Give feedback.
-
Okay, I found some errors in |
Beta Was this translation helpful? Give feedback.
-
Hi, what is this VCCM pin? |
Beta Was this translation helpful? Give feedback.
-
Hi Guys, |
Beta Was this translation helpful? Give feedback.
-
Hi Jim!
Yes, the datasheet is'nt clear. As I figured out, the internal voltage source has 3 outputs (1.024V, 2.048V, 4.096V), but only has one common calibrating register. So when you write the VCAL regiser, it doesn't select the reference output voltage, it just adjusting it.
You can write the VCAL register any time, not only after power up, but mostly before you start using the internal voltage source. Along with setting the VCAL the IVSEL0 and IVSEL1 bits of the ADCSRD register must also be set. (Fifth and fourth bits.) But ADC reference voltage is must be set as AVCC or AVREF. (ADMUX register)
Before you start using DAC, it's reference voltage source muts be selected. Set DACON register bit DAVS1 to 1 and DAVS0 to 0. (I didn't know these either until now.) |
Beta Was this translation helpful? Give feedback.
-
Slightly off topic but I noticed this statement:
It sounds like you are saying LGT8Fx cannot operate reliably when Vcc for is 4.5V or less and it is operating at 16Mhz. I couldn't find verification of this in the datasheet. Is it there or are you basing this on your emperical evidence? If <4.5V is not enough, what is the correct voltage for 16Mhz? I assume the voltage need to be the same or higher for 32Mhz? Am I correct that I cannot run below 32Mhz without adding an external oscillator? Context: currently I have a circuit where the LGT8Fx is powered at 3.3V and running on the internal 32Mhz and I'm wondering if some of the flakey behavior I'm seeing could be related to too low a voltage supply. It would not be trivial to test because of other components but I'm up for it if this could be the problem. |
Beta Was this translation helpful? Give feedback.
-
Hello. I would like to ask if it is possible to switch between the internal reference voltage source and the VCC voltage (external) when using the analog input to read the values without damaging the microcontroller. I'm using a project where the analog input goes from 0V to almost the supply voltage. I don't use voltage dividers. Can I stop reading the analog input, switch to an internal voltage reference, measure the supply voltage with your code, switch to an external voltage reference, and read the analog input again? The voltage at the analog input is greater than the voltage of the internal reference voltage source. I can't use the internal 4.096V reference voltage source because the microcontroller is battery powered. Will my plan damage the microcontroller? |
Beta Was this translation helpful? Give feedback.
-
I modified the Arduino_Vcc library and now could work on LGT8F328P microcontroller: https://github.com/LaZsolt/Arduino_Vcc
Now you can measure your AVR microcontroller's Vcc even if it is a LogicGreen.
The story:
I bought a new Arduino compatible nano style board with ATmega MCU. I started to use it, but it regularly stopped. It was powered by USB charger. One day later I discovered, the power source selector diode dropped the USB voltage by 0.5 V so the Vcc was only 4.5 V. This Vcc not enough for a safe operation on 16 MHz. At the end I applied a hihger voltage power supply on the VIN pin.
So good to know your board's Vcc.
Edit:
However if you using LGT8F328P or D microcontrollers, reading the Vcc supply level is much easier, but must use board package v2.0.0 or newer. Watch this:
The
lgt8f328p_qfp48_case02.ino
sketch gave me the idea, from libraries of this lgt8fx package.Beta Was this translation helpful? Give feedback.
All reactions