Forum Rule: Always post complete source code & details to reproduce any issue!

# Thread: 14,5 V voltage divider

1. ## 14,5 V voltage divider

Best regards from Spain...ç
Thx for let me take part into your community. I have a little question about voltage dividers and power supplies higher than 5 volts.
Im trying to make an script who reads the voltage of a 18650 battery pack, with a voltage divisor, but im not sure if will be posible ....if the Vin in more than 5 volts,...
I used two resistors 100 KOhm and 53 kOhm y serial
and the led of the teensy will be used then the idea is to show each lecture in serial port of TeensyDuino IDE.

The script I did is:
//
int x=0;
float voltios;
void setup(){
Serial.begin(9600);
}
void loop(){
voltios = (analogRead(A0))*0.004887585533*2.886;//Convierte lectura analogica en voltios
x=voltios; //Guarda valor de voltios como entero
if (voltios<=3)
{
digitalWrite(6, HIGH); //Si el valor de voltios es menor de 3 se enciende el led
Serial.println(x); //Imprime el valor en el puerto serie
}
}
//

Thx a lot for your response.
inigohe

2. AFAIK, max voltage for Teensies ADC is 3.3 V if external reference set or 1.2 V if internal reference chosen.
All voltage above 5 V will kill at least analog port of TLC and T3.6.

3. Thx...Then I have to recalculate voltage divisor to 3,3 volt Vin,..to assure no damage will be,...isnt??
R1=100 kOhm R2= 29,72 kOhms Vin= 3,3 Multiplicator =4,33 3.3V / 1023 = 0,003225806452
//
int x=0;
float voltios;
void setup(){
Serial.begin(9600);
}
void loop(){
voltios = (analogRead(A0))*0,00322581*4,33;//Convierte lectura analogica en voltios
x=voltios; //Guarda valor de voltios como entero
if (voltios<=6,6)
{
digitalWrite(6, HIGH); //Si el valor de voltios es menor de 6,6 se enciende el led
Serial.println(x); //Imprime el valor en el puerto serie
}
}
Thx.