Arduino nano crash

Hello everyone, I have a problem with my arduino nano, I’m trying to create a gear indicator for my motorcycle using an arduino, I correctly found the sensor and connected it to my arduino and I also connected a 7segment display, the code worked perfectly when I was connected through USB but when I switch to the Vin supply it stop working after 20~ seconds and sometimes the arduino loses the program itself so I have to reprogram it. What should I do, should I use a step down DC to DC converter so the integrated regulator do not heat or something else?

i assume there is no Bad Wiring when using vin supply.
here is my thought
arduino vin can handle 7- 12v, if your vin supply higher than 12 volt then you need a step down

but there is something sketchy
arduino program can't lose easily without accident.
your program might be loaded more than 87% of memory,
based on my experience low memory space causing bad performance.

if you are not facing those problem switch with other nano board could be a fix
thx~

Please show us the code and the schematics of the project and the installation including part numbers/manufacturer info on the DCDC converter.

When powered via USB the onboard 5V regulator is bypassed. When powering through Vin the 5V rail is powered by the onboard 5V regulator. The regulator is poorly heat sinked so will provide limited current before it overheats and shuts down. If the Vin is connected to a motorcycle the input voltage can be 14V. That means that the regulator must drop 9V. The recommended max power dissipation for the regulator is 1 Watt. So with 14V in the max current is 110mA (1W / (14V-5V)). The Nano uses about 50mA leaving 60mA (max) for the display and other things on the 5V rail. The peripherals on the 5V rail could be drawing enough current to shut the regulator doen.

You are right in thinking a 5V buck converter connected to the 5V pin is an answer. That bypasses the weak 5V regulator and also isolates the 5V rail from most of the nastiness of an automotive power supply.

Thanks y’all for your replies, I bought a XL4005 from bangood, now just waiting for it

rzk:
i assume there is no Bad Wiring when using vin supply.
here is my thought
arduino vin can handle 7- 12v, if your vin supply higher than 12 volt then you need a step down

but there is something sketchy
arduino program can't lose easily without accident.
your program might be loaded more than 87% of memory,
based on my experience low memory space causing bad performance.

if you are not facing those problem switch with other nano board could be a fix
thx~

Just a note here, high % of memory usage does and can cause issues, but not in performance, it can cause crashes because of the stack overlapping with application memory, and can cause the program to perform erractically and giving out bad results (data corruption) or even freeze up., but this won't mess with the flash, which is where the "program code" is running from, this is eeprom, and cannot be errased by bad memory (RAM) management.

The current being drawn from the arduino might cause reboots which can look like malfunctioning and erratic actions on the intent of program, also atmel does state that no more than 40ma should be draw from one pin and maximum 200ma overall, altough the chinese regulator by specs should provide only 150ma (in most cases by spec), also arduino nano on average draws around 27ma of current, your power to the arduino should be independent (for stability reasons) from periferals like lcd, leds or any other type of higher current devices.
One way you can reduce that consumption is removing the SMD leds from the nano board, but i don't think thats a big issue. Even with your buck converter, you should power the arduino and LCD independently.

It's just a 7 segment display not an lcd, I don't think it takes too much current, I measured the total current used by the arduino while running and it was 53mA

But still too much for the regulator on the Nano which has virtually no heatsink. 350 mW at 12 V.

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :slight_smile:

nofax354:
It's just a 7 segment display not an lcd, I don't think it takes too much current, I measured the total current used by the arduino while running and it was 53mA

53ma with the 7 segment right? because the single nano board with nothing attached uses around 27ma

mrdata:
53ma with the 7 segment right? because the single nano board with nothing attached uses around 27ma

Yep, there's only a 7 segment display connected and the sensor connected to the analog A0

TomGeorge:
Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :slight_smile:

int taille = 9;

void setup() {
  for(int i = 2 ;i <= taille;i++){
    pinMode(i,OUTPUT);
  }
  Serial.begin(9600);
}
int valeur = 0;
int rapport = 0;
int lastRapport = 0;

void loop() {
 valeur = analogRead(A0);
 Serial.print(valeur);
 Serial.print(",");
 Serial.println(rapport);
 //reset();
  if(valeur > 1020 || valeur < 200){
  rapport = 0;
 }
 if(valeur >= 189 && valeur <= 270){
  rapport = 1;
 }
  if(valeur >= 288 && valeur <= 351){
  rapport = 2;
 }
 if(valeur >= 387 && valeur <= 504){
  rapport = 3;
 }
 if(valeur >= 522 && valeur <= 666){
  rapport = 4;
 }
 if(valeur >= 675 && valeur <= 824){
  rapport = 5;
 }
 if(valeur >= 828 && valeur <= 1020){
  rapport = 6;
 }

  if(lastRapport != rapport){
    //reset();
    anim();
    //reset();
  }
  

switch(rapport){
  case 0:
    neutral();
    break;
  case 1:
    one();
    break;
  case 2:
    two();
    break;
  case 3:
    three();
    break;
  case 4:
    four();
    break;
  case 5:
    five();
    break;
  case 6:
    six();
    break;
}
 lastRapport = rapport;
 delay(10);
}

void anim(){
  digitalWrite(2,1);
  digitalWrite(3,0);
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(6,1);
  digitalWrite(7,1);
  digitalWrite(8,1);
  digitalWrite(9,1);
  delay(50);
  digitalWrite(2,0);
  digitalWrite(3,1);
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(6,1);
  digitalWrite(7,1);
  digitalWrite(8,1);
  digitalWrite(9,1);
  delay(50);
  digitalWrite(2,1);
  digitalWrite(3,1);
  digitalWrite(4,0);
  digitalWrite(5,1);
  digitalWrite(6,1);
  digitalWrite(7,1);
  digitalWrite(8,1);
  digitalWrite(9,1);
  delay(50);
  digitalWrite(2,1);
  digitalWrite(3,1);
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(6,1);
  digitalWrite(7,1);
  digitalWrite(8,0);
  digitalWrite(9,1);
  delay(50);
  digitalWrite(2,1);
  digitalWrite(3,1);
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(6,1);
  digitalWrite(7,1);
  digitalWrite(8,1);
  digitalWrite(9,0);
  delay(50);
  digitalWrite(2,1);
  digitalWrite(3,1);
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(6,1);
  digitalWrite(7,0);
  digitalWrite(8,1);
  digitalWrite(9,1);
  delay(50);
}

void neutral(){
  digitalWrite(2,1);
  digitalWrite(3,1);
  digitalWrite(4,0);
  digitalWrite(5,1);
  digitalWrite(6,0);
  digitalWrite(7,1);
  digitalWrite(8,1);
  digitalWrite(9,0);
}

void one(){
  digitalWrite(2,0);
  digitalWrite(3,1);
  digitalWrite(4,0);
  digitalWrite(5,1);
  digitalWrite(6,1);
  digitalWrite(7,1);
  digitalWrite(8,1);
  digitalWrite(9,1);
}

void reset(){
  digitalWrite(2,1);
  digitalWrite(3,1);
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(6,1);
  digitalWrite(7,1);
  digitalWrite(8,1);
  digitalWrite(9,1);
}

void two(){
  digitalWrite(2,0);
  digitalWrite(3,0);
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(6,0);
  digitalWrite(7,1);
  digitalWrite(8,0);
  digitalWrite(9,0);
}
void three(){
  digitalWrite(2,0);
  digitalWrite(3,0);
  digitalWrite(4,0);
  digitalWrite(5,1);
  digitalWrite(6,0);
  digitalWrite(7,1);
  digitalWrite(8,0);
  digitalWrite(9,1);
}

void four(){
  digitalWrite(2,0);
  digitalWrite(3,1);
  digitalWrite(4,0);
  digitalWrite(5,1);
  digitalWrite(6,0);
  digitalWrite(7,0);
  digitalWrite(8,1);
  digitalWrite(9,1);
}

void five(){
  digitalWrite(2,1);
  digitalWrite(3,0);
  digitalWrite(4,0);
  digitalWrite(5,1);
  digitalWrite(6,0);
  digitalWrite(7,0);
  digitalWrite(8,0);
  digitalWrite(9,1);
}

void six(){
  digitalWrite(2,1);
  digitalWrite(3,0);
  digitalWrite(4,0);
  digitalWrite(5,1);
  digitalWrite(6,0);
  digitalWrite(7,0);
  digitalWrite(8,0);
  digitalWrite(9,0);
}

Hi,

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.

Please attach your image, jpg, then it will automatically be inserted into your post.

Thanks.. Tom.. :slight_smile:

I see a 7-segment display, powered form 3.3volt (NOT ok with a Nano),
without the required seven LED current limiting resistors.

Need to see a circuit diagram to confirm this.
Leo..

I’ve seen issues in the past (on PICs), where removing +Vcc, while the I/O pins are still high by the surrounding circuitry, can cause an effective NEGATIVE voltage in the chip (they don’t like that), and it did actually corrupt the program FLASH !

I see an UNO, not a NANO...

I'm sorry but I don't see an image, I had to open it in another tab.

Hi,
Where are the current limit resistors?
What is on the other protoboard?
It might be worthwhile look at this,

Tom... :slight_smile:
PS. A CIRCUIT DIAGRAM PLEASE!!!!!!!!!!!!!
You were kindly asked back at post #2.

Hi everyone, after buying the XL4005 everything works correctly, thank you all for helping

ps: That's not because there's a uno in the image that I actualy used a uno, it was only while testing before using a nano on my motorbike

Hi,
Please answer post#17, in particular;

  • A circuit diagram.
  • Have you got current limit resistors on the 7seg display?

If you are driving the segments directly, then you will be over loading the digital outputs.

Thanks.. Tom.. :slight_smile: