Author Topic: Low Voltage Readings  (Read 382 times)

wespwilson

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Low Voltage Readings
« on: February 28, 2017, 06:50:19 AM »
I have a simple circuit that consist of a Simblee Breakout Board (https://www.sparkfun.com/products/13632), a voltage divider, and a lipo battery.  The battery connects to Vin on the breakout board and also passes through the voltage divider to pin 4 on the breakout.  I am using the code below to read the analog value on pin 4 and it is always coming out lower than what I expect. 

Some of the actual and expected values are in the table below.  Vbatt and Vpin4 are read from a multi-meter and Reading pin 4 is from the code below.  The breakout board has a 3.3V regulator so Calc Vpin4 is calculated using the equation 3.3*Reading pin 4/1024.  Exp Reading is calculated using the equation 1024*Vpin4/3.3.

Any thoughts on what I'm doing wrong?  I feel like I'm missing something really obvious here.  Any help is really appreciated.  Thank you!

Vbatt     Vpin4     Reading pin4     Calc Vpin4     Exp Reading     
3.532.356532.1729
4.122.747562.43850

Code: [Select]
#define BATTERY_PIN 4

void setup() {
    Serial.begin(9600);
    Serial.println("Starting...");
}

void loop() {
  Serial.println(analogRead(BATTERY_PIN));
  delay(500);
}

tolson

  • Global Moderator
  • *****
  • Posts: 838
  • Karma: +19/-0
    • View Profile
    • Thomas Olson Consulting
Re: Low Voltage Readings
« Reply #1 on: February 28, 2017, 10:07:12 AM »
You didn't describe what resistors you used in your voltage divider.

wespwilson

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Low Voltage Readings
« Reply #2 on: February 28, 2017, 12:43:26 PM »
The voltage divider is a 100K ohm resistor and a 200K ohm resistor.  Vbatt is the voltage going into the 100K resistor  on the voltage divider and Vpin4 is the voltage coming out between the 100K and 200K resistors.  The other end of the 200K resistor goes to ground.  Vpin4 is coming out pretty close to 2/3's of Vbatt so I think that part is working right.  Are there any other details that may help?  Thanks for the response.

tolson

  • Global Moderator
  • *****
  • Posts: 838
  • Karma: +19/-0
    • View Profile
    • Thomas Olson Consulting
Re: Low Voltage Readings
« Reply #3 on: March 01, 2017, 06:49:39 AM »
What are you measuing for actual voltage on the VCC line. Almost calculates out to be 3.6 volts instead of 3.3 volts.

wespwilson

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Low Voltage Readings
« Reply #4 on: March 01, 2017, 08:09:53 AM »
Thanks for following up.  I'm measuring 3.31V on the breakout's 3.3V pin. 


tolson

  • Global Moderator
  • *****
  • Posts: 838
  • Karma: +19/-0
    • View Profile
    • Thomas Olson Consulting
Re: Low Voltage Readings
« Reply #5 on: March 01, 2017, 12:44:29 PM »
You can try and read some of the registers that control the ADC configurations. You will have to get the Nordic spec sheet.

For acccurately reading battery voltage you probably should compare against the precision internal reference instead of the VCC.

Attached is the block diagram to help figure out what to set in the registers.

 

anything