Is it default that arduino nano gets hot?

hi all,
i have an Arduino Nano working for a model railway barier, it resides
at the model railway place for default,
but for programming i have a board near the personal-computer (PC).

the Ard.Nano drives two servos if placed at model railway,
but at PC there are LED's instead.

if i place the Ard.Nano at PC, getting supply voltage from the PC USB-Port ,
it seems all works fine.
the finger feeled temperatur of the chip is not significant higher than
room temperature.

In real-working situation at model railway Ard.Nano is supplied with exactly 5V from an L200-regulator which gets ca 15V from separate DC-Supplier.

Now Ard.Nano gets higher temparature - i can not leave finger on it because it is really hot . So i switched off supply to beware from overheating.

the control current from pin 5 of Ard. to servo's control wire(mostly white) is at 0,2 mA; is this too much ?

should i use opto-coupling devices to protect Ard. ?

at least, Ard. does Not work well in the model railway situation..
it does unmotivied actions with the servos...

here's the code ( comments in my mother tounge german, sorry)

//- sk_test_schranke_4 08.112021
#include <Servo.h>

#define FALSEVAL    1
#define TRUEVAL     0
#define STAT_OPEN   1
#define STAT_CLOSED 0
#define RESET       1

#define LED_RED     2
#define LED_YELLOW  3
#define LED_GREEN   4

#define  MAXPOS      135
#define  STARTPOS     45
#define  STEPP         5
#define  LOOP_DELAY   30
#define  SHOW_DELAY   1000
#define  PASSING_TRAIN 5000 //- Zug passiert Schrankenblock

Servo myservo1;  // create servo object to control a servo
Servo myservo2;  // create servo object to control a servo
//- gemaess INPUT_PULLUP - Definition ist 0=Event am Geber= True,
//- also 'umgedrehte' Logik-Werte , das wird dann halt hier durchgezogen..

//- nach Info von AZ-Delivery sind die PWM-faehigen PINS vom Ardi.Nano :
//- 5,6,9 - deswegen wurden die Geber (Reflexlichtschranken)
//- gegenueber Sketch-Version2 auf 7,8 gelegt ! 
int geber1 = 7;
int geber2 = 8;

int s_status = STAT_OPEN;
int val_g1 = FALSEVAL;
int val_g2 = FALSEVAL;
int alarm = FALSEVAL;

int g1_event = FALSEVAL;
int g2_event = FALSEVAL;

int count_g1 = 0;
int count_g2 = 0;

void setup()
{
  Serial.begin(9600);
  // put your setup code here, to run once:
  pinMode(LED_RED, OUTPUT);
  pinMode(LED_YELLOW, OUTPUT);
  pinMode(LED_GREEN, OUTPUT);
  //- die Geber sind erstmal Taster, Nicht Schalter !
  pinMode(geber1, INPUT_PULLUP);      // sets the digital pin 13 as output
  pinMode(geber2, INPUT_PULLUP);      // sets the digital pin 7 as input

  myservo1.attach(5);
  myservo1.attach(6);

}

void loop()
{
  show_vals();
  digitalWrite(LED_GREEN, HIGH);  //- Autos koennen passieren

    g1_event = digitalRead(geber1);
    if(g1_event == TRUEVAL)
      count_g1++;
      
    g2_event = digitalRead(geber2);
    if(g2_event == TRUEVAL)
      count_g2++;

    show_vals();

    if ( 
     ( (count_g1 > 0 && count_g2 == 0) ||
         (count_g2 > 0 && count_g1 == 0) )
         && 
         s_status == STAT_OPEN
        )
    {
      schranke_schliessen();
      digitalWrite(LED_GREEN, LOW);
      digitalWrite(LED_RED, HIGH);
      delay(LOOP_DELAY);
    }

    //if(s_status == STAT_CLOSED)
      //delay(PASSING_TRAIN);
    
    if ( 
     ( (count_g1 > 0 && (count_g1 ==  count_g2))  ||
         (count_g2 > 0 && (count_g1 ==  count_g2)) 
         )
         && 
         s_status == STAT_CLOSED
      )
    {
      schranke_oeffnen();
      digitalWrite(LED_RED, LOW);
      digitalWrite(LED_GREEN, HIGH);
      count_g1 = 0;
      count_g2 = 0;
    }  //- end g1+g2
    
} //- end-loop

void schranke_schliessen()
{
  if (s_status == STAT_OPEN)
  {
    for (int pos = STARTPOS; pos <= MAXPOS; pos += STEPP)
    { // goes from STARTPOS degrees to MAXPOS degrees
      // in steps of 1 degree
      myservo1.write(pos);              // tell servo to go to position in variable 'pos'
      myservo2.write(pos);
      delay(LOOP_DELAY);                       // waits 15ms for the servo to reach the position
    }
    Serial.println(" schranke geschlossen ");
    s_status = STAT_CLOSED;
  }
}

void schranke_oeffnen()
{
  if (s_status == STAT_CLOSED)
  {
    for (int pos = MAXPOS; pos >= STARTPOS; pos -= STEPP)
    { // goes from MAXPOS degrees to STARTPOS degrees
      myservo1.write(pos);              // tell servo to go to position in variable 'pos'
      myservo2.write(pos);
      delay(LOOP_DELAY);                       // waits 15ms for the servo to reach the position
    }
    Serial.println(" schranke offen ");
    s_status = STAT_OPEN;
  }
}

void show_vals()
{
  //- der print-Befehl ist Nicht identisch mit dem von Standard-C oder Standard-Java !
  //- 2. Parameter ist hier für das Ausgabeformat, nicht für nen numerischen Wert zur Ausgabe !

  Serial.print(" g1_count : ");
  Serial.print(count_g1);
  Serial.print(" g2_count : ");
  Serial.print(count_g2);
  Serial.print(" Status  : ");
  Serial.print(s_status);
  Serial.print(" alarm : ");
  Serial.println(alarm);
  delay(SHOW_DELAY);
}

It is not normal for any part on the Nano to get hot.

Post a schematic showing the wiring when at the railway. Show all components, their part numbers and/or values and all power supplies.

Post a photo showing what part is getting hot.

Any of the MCUs from AtTiny85 to Mega2560 are ideal for projects like model railways.
Lighting, movement are all candidates.
Of course it shouldn't be getting hot. I have a Nano in front of me driving two 8-digit 7-segment LED displays and after years of running, it is just warm, not hot.
I would suggest a rapid disconnection to avoid further expense.
Take @groundFungus advice. Without the actual wiring shown, the code is irrelevant.
The Nano does the controlling, definitely not any form of direct driving heavy loads.
And please, call it Arduino, not Ard.

@lupus51
I have moved this to a more appropriate section of the forum, not sure why you thought installation and troubleshooting was the right place.

Please read the forum guidelines for more information How to get the best out of this forum

Thanks

Oh come on!

It is perfectly obvious. :grin:

The OP has installed something on his model railway and it is not working properly, so he wishes to troubleshoot it!

Of course it looks like the right place to post. :roll_eyes: Hardly surprising.

It is only that you - we - the Arduino team - choose to think of "installation and troubleshooting" specifically in terms of getting the Arduino IDE to work.

1 Like

Maybe it would be a good idea to change the name to "IDE installation and troubleshooting". It happens very often that newbies select these category to post their problems.

1 Like

There is something wrong with your circuit. Therefore a schematic and a photo of the actual layout of the circuit is important. The processor should never get hot.

And there was me thinking any doubt or confusion would be cleared up by the words:

For problems with Arduino itself, NOT your project

ok, i have drawn schemtic of wiring..as i used a demo-version of
electronic-cad , painting points on crossing wires was unpossible
at now (until now i dot know how to do, 'Help' did not help :unamused:

here it is

hope, it helps you..
as any LED - visualizing by Ardiuno was omitted , its seems that heating is reduced in a way
i hope this was it !?

How did you connect the led's? With a correct resistor, the Arduino should not get hot either.

It is unclear to which pin the 5V output of the power supply is connected. If the output of the power supply is regulated 5V it should be connected to the 5V pin of the Nano, not Vin.

The servos should be connected to the 5V power supply, not the Nano 5V.

in the Arduino-Schema from 'AZDelivery ' this port is
named '5V Output or Input ' , the VIN is named '7-12 Power Input'
by them. This I didnt use , because someone wrote that the internal regulator cannot handle much.(?) power..

On the plugin-board for the Arduino Nano it is named '5V' .

All LED'S I use with 5V-Supplies are connected via 220-Ohm-resistors
as default directly soldered to them. This fits too for Light-barriers internal LED'S..

But I don't know what PWM-Output PINS 5, 6 may handle..
the servos are very small 'arcraft' with linear transmission..
as I wrote before there goes an current (measerd with old analog multimeter) of 0,2mA.. that seems less than a LED would need.

I suspect a wiring error or a short circuit. Please post a clear, focused, close up picture of your wiring.

The servo control signal requires virtually zero current (input impedance > 1MΩ) so any digital pin can control a servo. Since you are using the Servo library to control the servos the servo signal does not need to come from a PWM pin. Any digital pin will do. The analog inputs are also digital pins so can be used as servo control pins.

To power a servo you need a power supply that can handle the current required by the servo. Connect directly with the power supply. Make sure that the external power supply ground connects to Arduino's ground. You should not power a servo from an Arduino 5V regulator.

thanks many, but i've checked this again and again..
nothing found like this..

I'm waiting for additional Ardiunos.. may be the actual has any defect ..

after omitting the led's it does not go so hot as before..
and placed at pc-board i can work with it for different issues so far..
it seems to be in order.. :thinking:

But "Arduino" is clearly the board that they are using in their project, isn't it?

And - it doesn't seem to be working, does it? :face_with_raised_eyebrow:

So perhaps we would need to know what these LEDs are and how they are connected.

Correct. Best explained as "do not use "Vin" for any actual project.

Often reveals the problem. :grin:

Your schematic is more like a block diagram. Have you any capacitors across that regulator? If not it is probably oscillating which might explain the heating.

Hi,
Can you post a hand drawn schematic?
Use pen(cil) and paper and include component names and pin labels.

When you do this, draw it by reverse engineering your project.

As already asked, some picture(s) of your project would be appreciated.

What is your 15V power supply, link data/specs?
Did you make the L200 power supply, or purchase it ready to go?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

Do you have any current limiting resistors on your LEDs?