I had a project that worked... now it won´t work

Hi everyone, so I have a problem, and can´t find whats wrong for quite some time

I had this project done about 3 years ago and everything worked, it has 2 8x8 led matrix, 1 micro servo motor and a buzzer. Initially the led matrix were attached to a protoboard, and all my problems began when I needed to simply make the leds work outside the protoboard.

So I have bought the parts needed from a online schematic and put all together and now it is even worse than before. Here is the schematics of how it is now:

The only thing I change was the port for the buzzer and servo to work with the code (but tried to change the code to be ok with schematics and also didn´t work)
I had tested with a voltmeter the componets and they all work.

Here is the code:

#include <LedControl.h>
#include <Servo.h>

Servo servo1;

int DIN = 12;
int CS =  11;
int CLK = 10;
const int buzzer = 9;
unsigned long delaytime=10;
int d = 50;
int row;
int col;
int i;
int j;
int l = 0;

LedControl lc=LedControl(DIN,CLK,CS,1);

void setup(){
 lc.shutdown(0,false);       //The MAX72XX is in power-saving mode on startup
 lc.setIntensity(0,15);      // Set the brightness to maximum value
 lc.clearDisplay(0);         // and clear the display
 servo1.attach(8);
 pinMode(buzzer, OUTPUT);
 
}

void loop() { 

 // if((servo1.read() != 0) || (servo1.read() != 180) ){ 
    //servo1.write(0);


//if((servo1.read() != 0) || (servo1.read() != 1) || (servo1.read() != 2) || 
//(servo1.read() != 178) ||
//(servo1.read() != 179) || (servo1.read() != 180) ){ 
    //servo1.write(0);
   
   // } 

l = 0;
d = 50;

while(l<10){
  for(i=8;i>-1;i--){
    
      func(i,d);
  }
  l = l +1;
  d = d - 5;

}

    pinta(0);
   
      if((servo1.read()) == 0 ){ 
        
      servo1.write(180); 
      delay (1);
      } else{ 
        
      servo1.write(0); 
      delay (1);
      }

  
}




void func(int i, int d){
  for(int j=0;j<i;j++){
    pinta(j);
    pinta(j+1);
    apaga(j,d);
    tone(buzzer, 882);
    delay(d);
    noTone(buzzer);
    delay(d);  
  }
}

void pinta(int r){  
  for(int row=r;row<r+1;row++) {
    for(int col=0;col<8;col++) {
        //delay(delaytime);
        lc.setLed(0,row,col,true);
        lc.setLed(1,row,col,false);
       // delay(delaytime);   
    }
  } 
}

void apaga(int r, int d){
    for(int row=r;row<r+1;row++) {
    for(int col=0;col<8;col++) {
        delay(d);
        lc.setLed(0,row,col,false);
        lc.setLed(1,row,col,false);
        delay(d); 
        
    }
   } 
}

(translation for two word from the code:
pinta=color
apaga=erase)

Yesterday the led matrixes were working a little bit but stopped after 1 minute, now only the buzzer is working and with a lower tone than before, bought a new matrix but also same problem

Please help in any way you can, I tried everythig in this last month, you guys are my last resort, thanks !

Quick edite here: The arduino uno will work with both usb connection and the other one, but when I turn it from the other one only the buzzer is workin, and when I attach to power via usb not even the buzzer works, only the arduino, and nothing else :frowning:

velamini:
I had this project done about 3 years ago and everything worked, i

Yesterday the led matrixes were working a little bit but stopped after 1 minute, now only the buzzer is working and with a lower tone than before,
Quick edite here: The arduino uno will work with both usb connection and the other one, but when I turn it from the other one only the buzzer is workin, and when I attach to power via usb not even the buzzer works, only the arduino, and nothing else :frowning:

Sounds like inadequate power.

The problem is, all this stuff is in front of you, you could look at any part of it right now, but none of us can do that. You have to do the simple stuff first - basically just verify all your connections and all of your code lines (especially any changes that you made from 3 years ago).

If that doesn't work you have to use "divide and conquer" methodology. For that, you divide a problem into parts. If part A works and part B doesn't, divide part B into C and D. if C works but D doesn't, divide D into E and F and so on until you get down to the defect itself.

The division could be something as simple as testing components with independent code, for example loading a LED matrix example sketch that does nothing but light up the displays. Then you know that it is good and you look at something else... and so forth.

aarg:
If that doesn't work you have to use "divide and conquer" methodology. For that, you divide a problem into parts. If part A works and part B doesn't, divide part B into C and D. if C works but D doesn't, divide D into E and F and so on until you get down to the defect itself.

The division could be something as simple as testing components with independent code, for example loading a LED matrix example sketch that does nothing but light up the displays. Then you know that it is good and you look at something else... and so forth.

Ok, thanks, I will begin testing this way :slight_smile:

While divide and conquer is generally good advice, Nick_Pyner nailed it for you in reply one. Almost every problem relating to servos posted here is related to power and you have additional components besides. The servo needs its own power supply. That 7805 is a bit of a mystery too.

Nick_Pyner:
Sounds like inadequate power.

So it is better to attach a separeted battery?

wildbill:
While divide and conquer is generally good advice, Nick_Pyner nailed it for you in reply one. Almost every problem relating to servos posted here is related to power and you have additional components besides. The servo needs its own power supply. That 7805 is a bit of a mystery too.

Thanks I will look into that, do you have any suggestions for a power source?
Well I didnt had any of those extra components before, just the jumpers, buzzer, leds and motor, and it worked when everythig was linked through the board. These components were a suggestion of the website circuito.io so I gave it a try but i don´t know if they are really needed...

It depends on the specification of your servo. Hobby servos, as a rule of thumb, take 6V and each one needs 1A. Some headroom on the current would be nice. A common solution is to use 4 AA batteries.

velamini:
So it is better to attach a separeted battery?

Not necessarily. If you do the job properly, the real job is supplying the peripherals and Arduino simply rides as a passenger. You are implying more than one supply, and there should never be a need for that.

I did not specifically address this because I don't know anything about servos, the servo have may be some flea-power demonstration toy, and you say the general setup you have is the same as what you had before, so I didn't look too closely at the diagramme. Needless to say, your setup may have always been marginal, and the fact that it worked before may have been more down to good luck than proper practice.

Since you mention batteries, you should note that they are a bit of a black art.
If you are trying to use a 9v PP3, it is best that you don't admit to it, just cease and desist immediately, and replace it with AAs or 18650. PP3s are not really batteries in the general sense, they are just things that wave 9v in the general direction of devices that barely need them - this does not normally include Arduinos.

I would be inclined to use 6xAA rather than four. You can always reduce them later. The voltage regulator may be a mystery now, but more usefully employed later!

Hi,
Can you please post a picture of your project?

Thanks.. Tom... :slight_smile:

TomGeorge:
Hi,
Can you please post a picture of your project?

Thanks.. Tom... :slight_smile:

here you go Tom ! :slight_smile:

can't attach it , I got some error message so the link is above

Nick_Pyner:
I did not specifically address this because I don't know anything about servos, the servo have may be some flea-power demonstration toy, and you say the general setup you have is the same as what you had before, so I didn't look too closely at the diagramme. Needless to say, your setup may have always been marginal, and the fact that it worked before may have been more down to good luck than proper practice.

Thanks for the advice on the batteries!

Everything began to fall apart when I needed the matrixes outside the protoboard, then I tried this setup that circuito.io told me to do, before I had only the essentials and it worked for 3 years. I am relativtly new when it comes to putting together those parts and what I can figure out is why it doenst work if I followed what it said to do.

First I was afraid that something was burning but then discovered that the voltage regulator gets really hot and thats how it works. I still haven't been able to figure out what I am doing wrong.

You quite possibly fried the 7805 regulator. What voltage are you putting in at the barrel jack? That’s the connector below the usb connector?

The 7805 is a rather poor solution as the power dissipated by the device is a function of its input voltage minus the output voltage multiplied by the current consumed.

This power is usually way over the devices capability unless it’s attached to a rather large heat sink. Just as an example, let’s assume you’ve got 12 volts on the barrel jack and your components need 0.5 amps which is not unreasonable for a servo and two led displays.

12 - 5 * 0.5 is 3.5 watts which is about 3 watts too much for a device with no heatsink. The 7805 will turn off the output when it overheats. Continued thermal abuse will eventually cause the device to fail.

A couple of thoughts: disconnect the loads (servo and LEDs), power it up and see if you have 5 volts out on the 7805. If not, it’s dead. If that’s the case, you could solve the problem by purchasing a switching buck regulator good for 3 amps. They’re inexpensive and don’t operate in the same manner, that is by just generating heat. Problem solved.

If the 5 volt supply is okay, I would move the two 7805 bypass capacitors, the disc capacitor on the input and the electrolytic on the output, to the breadboard pins directly attached to the 7805. Eliminate those four jumper wires that make the connections as all that extra wire length is not good and could be causing the device to go into oscillation under load. Once the caps have been moved, reconnect the devices, power up and measure the 5 volts output again. It might be okay. If not, it’s probably time to purchase the switch mode regulator mentioned above.

Hi,
Ops pics.

velamini:
First I was afraid that something was burning but then discovered that the voltage regulator gets really hot and thats how it works. wrong.

7805s are pretty old school and rather inclined that way, the hole is there so you can conveniently attach it to a heat sink. I'm sure there are better choices, but the 7805 would be just fine for supplying the mega. Your Fritzing diagramme is far better than the photos, but none of them show the power supply

The Fritzing diagram is very blurred but it appears to show the CS pin on the dot matrix chain attached to pin 10 on the Arduino. The sketch shows this CS as pin 11. The clock pin also appears inconsistent between the wiring diagram and the sketch. Maybe others too.

6v6gt:
The Fritzing diagram is very blurred but it appears to show the CS pin on the dot matrix chain attached to pin 10 on the Arduino. The sketch shows this CS as pin 11. The clock pin also appears inconsistent between the wiring diagram and the sketch. Maybe others too.

The pins are connected as in the diagram, din 12 - cs 11 - clk 10

Nick_Pyner:
Your Fritzing diagramme is far better than the photos, but none of them show the power supply

For power supply I has simply attaching it to a AC/DC adapter, input 100-240Voutput 12VAC - 2A
Quick edit here: just noticed I was an idiot using this power supply, changing it will perhaps make everything run smoothly
WattsThat thanks I will test the 7805 now

WattsThat:
You quote possibly fried the 7805 regulator. What voltage are you putting in at the barrel jack? That’s the connector below the usb connector?

This power is usually way over the devices capability unless it’s attached to a rather large heat sink. Just as an example, let’s assume you’ve got 12 volts on the barrel jack and your components need 0.5 amps which is not unreasonable for a servo and two led displays.

Yes I am using a 12v on the barrel jack, a battery would be better?

WattsThat:
A couple of thoughts: disconnect the loads (servo and LEDs), power it up and see if you have 5 volts out on the 7805. If not, it’s dead. If that’s the case, you could solve the problem by purchasing a switching buck regulator good for 3 amps. They’re inexpensive and don’t operate in the same manner, that is by just generating heat. Problem solved.

If the 5 volt supply is okay, I would move the two 7805 bypass capacitors, the disc capacitor on the input and the electrolytic on the output, to the breadboard pins directly attached to the 7805. Eliminate those four jumper wires that make the connections as all that extra wire length is not good and could be causing the device to go into oscillation under load. Once the caps have been moved, reconnect the devices, power up and measure the 5 volts output again. It might be okay. If not, it’s probably time to purchase the switch mode regulator mentioned above.

First I tested the 7805 and it worked, but then making the changes in the protoboard as you said, it didn't work. I will go ahead and purchase this switching buck regulator good for 3 amps
I will let you know how it goes, thank you :slight_smile:

velamini:
output 12VAC - 2A
........... I was an idiot using this power supply

Probably true.

changing it will perhaps make everything run smoothly

Also probably true, but make sure you know the difference between AC and DC before you rush out and buy one. Stick to DC.

velamini:
The pins are connected as in the diagram, din 12 - cs 11 - clk 10
. . .

The diagram in the OP shows a turquoise coloured wire from Arduino pin 10 to the CS pin of the first LED matrix module. The code in the OP contains this: int CS = 11;
The diagram is blurred so I could have misinterpreted it, but even on magnification of it my statement appears correct.

Fritz.JPG

Fritz.JPG

Hi, sorry for the mega delay to answer all of you, I was without a computer so I didnt continued that project at that time. I had finished the project now and in the end I just took out all those extra elements and stood only with the leds, buzzer and servo motor, and everything got back to normal and is working lie a charm.
Thank yo very much for yo help people, hope you are all safe :slight_smile: