Calculating the chip's VCC (From hackaday.com)

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now this is clever. You can calculate VCC by using VCC as a reference to measure the 1.1v reference. VCC then is 

 

(1.1v * 1024) / ADC

 

A little harder with xMega since the "VCC" reference is actually VCC/1.6, but nothing you can't figure out.

 

http://wp.josh.com/2014/11/06/ba...

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tom,

 

I have been using that for years. Haven't you?cheeky

 

Cheers,

 

Ross

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A few years ago I 'invented' the same technique. I thought I was sooooo clever and innovative... until I googled it and found that I was several years too late ;)

 

But it is a neat trick isn't it?

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ummm--

 

There have been other similar threads.  Cal of internal ref, etc.

https://www.avrfreaks.net/forum/a...

http://legacy.avrfreaks.net/inde...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Sun. Nov 9, 2014 - 03:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually, I never wanted to measure vcc, till recently. It comes from a regulator, so who wants to measure it.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Torby,

 

If you would switch your trains from coal burning to battery operations you would suddenly find the need for monitoring Vcc! wink

 

BTW, can an AVR do that calculation without a hardware floating point module? wink wink

 

JC

Last Edited: Sun. Nov 9, 2014 - 07:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BTW, can an AVR do that calculation without a hardware floating point module?

An ARM9  is the usually-recommended co-processor to calculate an AVR8's battery voltage level.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Interesting...

 

VCC = (1.1v * 1024) / ADC

 

implies that the 1.1 Vref has quite a bit of variance with Vcc.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

Last Edited: Sun. Nov 9, 2014 - 11:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:

Hi Torby,

 

If you would switch your trains from coal burning to battery operations you would suddenly find the need for monitoring Vcc! wink

 

BTW, can an AVR do that calculation without a hardware floating point module? wink wink

 

JC

 

Nope! VCC comes from a regulator 'cause the train's 19.2v battery would blow an avr to bits.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

microcarl wrote:

Interesting...

 

VCC = (1.1v * 1024) / ADC

 

implies that the 1.1 Vref has quite a bit of variance with Vcc.

 

Nope. The 1.1v reference is pretty stable, you're looking for changes in VCC.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Torby wrote:
the train's 19.2v battery would blow an avr to bits.
badumbum

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

implies that the 1.1 Vref has quite a bit of variance with Vcc.

I will just add no :) it's very stable because the bandgap don't change by temp.

 

http://en.wikipedia.org/wiki/Bandgap_voltage_reference