Hello,
I am trying to read the battery voltage level with an easy partition resistance method.
I am using this schematic:
It's very easy.
But every time I connect the battery (at this moment about 16V) the Arduino nano gets burning.
Code is very easy:
int sensorPin = A6; // select the input pin for the potentiometer
int relayPIN = 1; // select the pin for the LED
int VoltsValue = 0; // variable to store the value coming from the sensor
void setup() {
//pinMode(sensorPin, INPUT) ; //this should be just optional: A6 in nano is only ADC
pinMode(relayPIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
// read the value from the sensor:
int anaRead = analogRead(sensorPin);
VoltsValue = anaRead/1024 * 3.3;
Serial.print("A:");
Serial.println(anaRead);
Serial.print("V:");
Serial.println(VoltsValue);
delay(1000);
}
Can anyone explain why is nano burning even I read a voltage level lower than 3.3V before I connect the arduino??
No, what you described is not the cause of the Nano burning. There must be some other reason. Post a more complete schematic showing the Nano and the power supply/supplies.
It's burned without anything else connected.... and not only 1 pcs, I burned 5 pcs! I could not believe it could be caused by the circuit, and after checking again everything I tried again and again. After 5 pcs... I asking for help here.
@AlessandroLecce
You shouldn't connect any voltages to the I/O pins when the Nano is off, it could damage the Nano.
First turn on the Nano then connect the battery.
Then disconnect the battery before turning the Nano off
Before you do what @paulpaulson asked in Post #2, I will go ahead and tell you that anaRead will always be zero here because analogRead returns a value between 0 and 1023 and the your division there is performed with integer arithmetic, yielding 0. Always.
Besides that, the formula itself is wrong, you will not calculate the voltage correctly.
Finally, VoltsValue is declared as an integer, and can only store …integer values.
And do not use Pins 1 for the relay if you plan to use Serial. Nor 0.
But, let’s first see how you are connecting the Nano
I don't want to argue with you, but my experience contradicts what you say. I have a device that consists of a powerful consumer (LED panel) and a control unit with microcontroller. The panel and MCU both has its own power supplies.
I always turn on the screen first, and then the control unit - and turn it off in the reverse order.
I’ve been doing this for 5-6 years now - and so far not a single MCU has burned out.