Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - amb9800

Pages: 1
1
I have a function we use to grab VCC on the AVR platform-
Code: [Select]
int getVCClevel(){
  //http://forum.arduino.cc/index.php?topic=133907.0
  const long InternalReferenceVoltage = 1100L;
  ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
  delay(1);
  ADCSRA |= _BV( ADSC );
  while( ( (ADCSRA & (1<<ADSC)) != 0 ) );
  int result = (((InternalReferenceVoltage * 1024L) / ADC) + 5L) / 10L;
  return result;//this should be in hundredths of a volt
}

You can use this and a general lithium ion discharge curve to guess approximate charge level.

Thanks,
Ben
Does the TinyScreen+ (ARM platform) have a similar function?

Pages: 1
SMF spam blocked by CleanTalk