Escolar Documentos
Profissional Documentos
Cultura Documentos
Table of Contents
Step 3: Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/
Author:chienline
Just an ordinary person
Arduino Uno needs 5 volts power to run, then we need at least 7.4 volts to 9 volts battery. Since Arduino pins support only 5 volts maximum, then we need a Voltage
Divider. It is simply made up of two resistors in series. To divide the voltage to half, we need two resistor with the same value. 1K to 20K resistors can be used, but the
larger the resistance the lower the power consumed by the Voltage Divider. I am not that good in calculating such thing but that is what I summarize from sources I read.
You can correct me if I am wrong and any better explanation to this is most welcome on the comment section.
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/
Step 2: Arduino Sketch
Well, I would like to upload this sketch to Arduino first before connecting it to a battery for testing. Uploading this will show you nothing before you connect all the parts
needed for this project, but sooner or later you will still need to upload this sketch. I am not sure what will happen if you have power from usb and also from Vin at the
same time. I guess it will be okay, Arduino designers must have think of this possibility and prevent this power conflict. But I will never try it on purpose and risking my
Arduino to get burnt :P
In this instructable, I am not explaining about "how to get your LCD display works", but I will leave some links here (which I use) to get your LCD works through I2C
connection:
I2C LCD - Setup instructions for 16x2
F Malpartida's LCD library
I2C Scanner
SainSmart I2C LCD Screen 16x2
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27 //Add your address here. Find it from I2C Scanner
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
#define led_pin 13
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
void setup()
{
lcd.begin (16,2); //My LCD was 16x2
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home
pinMode(led_pin, OUTPUT);
digitalWrite(led_pin, LOW);
}
void loop()
{
printVolts();
}
void printVolts()
{
int sensorValue = analogRead(A0); //read the A0 pin value
float voltage = sensorValue * (5.00 / 1023.00) * 2; //convert the value to a true voltage.
lcd.setCursor(0,0);
lcd.print("voltage = ");
lcd.print(voltage); //print the voltage to LCD
lcd.print(" V");
if (voltage < 6.50) //set the voltage considered low battery here
{
digitalWrite(led_pin, HIGH);
}
}
Step 3: Circuit
The wire connections are simple as you can see on the images above.
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/
Connect the other end to Arduino Vin and also to Battery + (positive).
When you plug the battery to Arduino Vin, it should work right away showing the voltage of your battery on your 16x2 LCD because Arduino is powered by that battery. If
it is not working, please re-check your connection or the battery you use might be lower than 5 volts needed by Arduino to power up. Please try another battery or check it
with your voltmeter.
On my test with multimeter, the voltage shown on the LCD is slightly lower then the multimeter display. We are loosing around 0.05V to 0.15V on breadboard and Arduino
circuits. But that is not a big problem for me (I don't know what about you), as long as I know whether my battery has enough power to run my robot. That's all.
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/
Step 4: From Mini to Micro
Well, I don't want that "mini" breadboard goes along on my Panzer, then I make it "micro".
The first resistor : One end soldered to pin 1 from the left. The other end to pin 4 from the left.
The second resistor : One end soldered to pin 2 from the left. The other end to pin 4 from the left.
Soldered the connector inner pins to pin 1 and pin 2 from the left.
Put the black connector jacket on.
Pull out pin 3 from the left.
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/
Step 5: Re-Connect And Run
Now re-connect the LCD and Battery, we have simpler connection without breadboard.
On my test I lost 0.1V and pretty stable. Actually we lost only 0.05V on Arduino circuit. 7.79V is shown on my multimeter. Voltage Divider reduced it to half, that is 3.89V
entering the A0 pin. The Arduino reads 3.84V. Then we double it to show the exact voltage back, that is 7.68V.
We can fix this in the sketch, but we need more data population to see the stable voltage lost. One more question is : "Is it my multimeter that is not accurate? Because I
bought a cheap one."
Again, I don't mind that little difference as long as I know my battery is fit enough to run my RC toys :)
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/
Related Instructables
PowerBanks
"How it Works"
Lithium Polymer by rodski LiPo-Powered Lithium Battery
Etiquette: A Warming up! by Arduino Restoring/Recharging
Solar USB/
Comprehensive contrechoc over-discharged iPhone/ Arduino
(Photos) by
Guide to LiPo (Lithium
Radioactive_Legos Polymer) Charger by
Working with JoshuaZimmerman
LiPo by batteries! by
Radioactive_Legos panther3001
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/
Advertisements
Comments
http://www.instructables.com/id/Arduino-Battery-Voltage-Indicator/