ATMEGA2560 died inside a arcade game circuit

Hi, I am building arcade game with 10 player buttons (5 for each player) and one start button. All buttons have build in LED inside. Player buttons has LED for 12V and start button has led for 5V. I am using ATMEGA2560 pro boar. I have also 4 TM1637 displays (two for each player) showing time and score. I am using 12V adapter. This is my schematic:
schematic.pdf (11.4 KB)

This is test code which I had:

#include <Arduino.h>
#include <TM1637Display.h>

#define BTN_A1_PIN 16
#define BTN_A2_PIN 18
#define BTN_A3_PIN 28
#define BTN_A4_PIN 26
#define BTN_A5_PIN 47

#define BTN_B1_PIN 44
#define BTN_B2_PIN 36
#define BTN_B3_PIN 39
#define BTN_B4_PIN 46
#define BTN_B5_PIN 37

#define LED_A1_PIN 13
#define LED_A2_PIN 17
#define LED_A3_PIN 11
#define LED_A4_PIN 15
#define LED_A5_PIN 19

#define LED_B1_PIN 25
#define LED_B2_PIN 27
#define LED_B3_PIN 23
#define LED_B4_PIN 21
#define LED_B5_PIN 29

#define BTN_START_PIN 32
#define LED_START_PIN 35

#define DISPLAY_A_SCORE_CLK 20
#define DISPLAY_A_SCORE_DIO 10

#define DISPLAY_A_TIME_CLK 40
#define DISPLAY_A_TIME_DIO 43

#define DISPLAY_B_SCORE_CLK 42
#define DISPLAY_B_SCORE_DIO 33

#define DISPLAY_B_TIME_CLK 34
#define DISPLAY_B_TIME_DIO 38

typedef struct
{
  uint8_t btnIn;
  uint8_t ledOut;
} btn_t;

btn_t btn[] = {
    {
        .btnIn = BTN_A1_PIN,
        .ledOut = LED_A1_PIN,
    },
    {
        .btnIn = BTN_A2_PIN,
        .ledOut = LED_A2_PIN,
    },
    {
        .btnIn = BTN_A3_PIN,
        .ledOut = LED_A3_PIN,
    },
    {
        .btnIn = BTN_A4_PIN,
        .ledOut = LED_A4_PIN,
    },
    {
        .btnIn = BTN_A5_PIN,
        .ledOut = LED_A5_PIN,
    },
    {
        .btnIn = BTN_B1_PIN,
        .ledOut = LED_B1_PIN,
    },
    {
        .btnIn = BTN_B2_PIN,
        .ledOut = LED_B2_PIN,
    },
    {
        .btnIn = BTN_B3_PIN,
        .ledOut = LED_B3_PIN,
    },
    {
        .btnIn = BTN_B4_PIN,
        .ledOut = LED_B4_PIN,
    },
    {
        .btnIn = BTN_B5_PIN,
        .ledOut = LED_B5_PIN,
    },
    {
        .btnIn = BTN_START_PIN,
        .ledOut = LED_START_PIN,
    },
};

TM1637Display displayAScore(DISPLAY_A_SCORE_CLK, DISPLAY_A_SCORE_DIO);
TM1637Display displayATime(DISPLAY_A_TIME_CLK, DISPLAY_A_TIME_DIO);
TM1637Display displayBScore(DISPLAY_B_SCORE_CLK, DISPLAY_B_SCORE_DIO);
TM1637Display displayBTime(DISPLAY_B_TIME_CLK, DISPLAY_B_TIME_DIO);

void setup()
{
  for (int i = 0; i < 11; i++)
  {
    pinMode(btn[i].btnIn, INPUT_PULLUP);
    pinMode(btn[i].ledOut, OUTPUT);
  }
  displayAScore.setBrightness(0x0f);
  displayATime.setBrightness(0x0f);
  displayBScore.setBrightness(0x0f);
  displayBTime.setBrightness(0x0f);

  displayAScore.showNumberDec(1111, false);
  displayATime.showNumberDec(2222, false);
  displayBScore.showNumberDec(3333, false);
  displayBTime.showNumberDec(4444, false);
}

void loop()
{
  for (size_t i = 0; i < 11; i++)
  {
    if(0 == digitalRead(btn[i].btnIn))
    {
      digitalWrite(btn[i].ledOut, HIGH);
    }
    else
    {
      digitalWrite(btn[i].ledOut, LOW);
    }
  }
}

And this is how it looks like inside:


The problem is ATMEGA2560 just burned. I was testing it firstly without TM1637(they were connected to power but I did not used lib for them at that time) and it was working okay (buttons were lighting up upon pressing). Then I added lib for TM1637 to code and for 2 seconds I saw "1111" "2222" ... so on as it is in code, so there is no bad connection. But after a 2 seconds it started buzzing (probably linear regulator temp protection was kicking in) and ATMEGA just burned. Now when I plug 12V in it gets hot pretty fast. I had always connected only 12V no power from USB. I know my wires are not shortest but I would not expect that MCU dies. Could you help please? I don't want to plug next 20€ chip just to see another expensive smoke.

The 5V pin of the Mega is not a power source! Connecting 4 TM1637 to it is much too much.
Power the displays from a separate buck vonverter.

2 Likes

Thanks for answer, but I don't think this could cause MCU to die. Also, linear regulator should have overcurrent protection. But I will power them from buck converter. Do you have any other ideas?

It can - we had this more than once here. Do you have a DMM? The linear regulator may provide a short circuit between Vin and Vcc(5V) when it burns. You can measure if it is. And with 12V the MCU will die too.

The 7805's have a nasty habit of failing shorted. Do not feed 12v in the Vin pin. I know the specs say it works, but only with a bare board, and then its still marginal.
Rewire to supply a nice clean 5V on the +5V pin and your problems should clear. You can still use the 12V for everything else, just tie the grounds together.

I have measured 5V on regulator output, so it is not shorted.

Okay, I will power displays and mcu as well from buck converter, also I have oscilloscope, so if you have idea what should I measure, I can.

At 12V the 7805's overheat and go into thermal shutdown easily. With a heavy load they'll shut down in seconds. So the board will die and recover -- a few times.
PS: Some lead dress and zip ties will clean up your project internals.

Yes I would expect that, but atmega is burned, it is getting hot and program execution does not work. So it is no shutdowning because of linear regulator thermal protection it's just damaged. And yes using zip ties is great idea, currently it is a rat nest, this will make it neat and tidy.

Time for lower voltage and a new Arduino.

Okay, so I have tried powering it separately and so far it is working. Thank you all for help.

Great! Please close the topic and the message that got you going.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.