Go Down

Topic: Possible wiring problem? (Read 15319 times) previous topic - next topic

Vinter


Because when the transistor base is connected to an input it is floating and can pick up interference which can cause a small current to flow which would light up LED slightly. A pull down resistor would stop this from happening.


I thought this only mattered if doing input readings. Can a pin set as input create an external signal?

MAS3

#16
Aug 18, 2013, 11:31 am Last Edit: Aug 18, 2013, 11:34 am by MAS3 Reason: 1
That wire forms an output to the processor, but an input to the transistor.
Some interference to a floating pin can tip the transistor into conductance.
Interference typically is caused by external factors.
But also a signal in the wire next to it, can be picked up and have this effect.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

Vinter

#17
Aug 18, 2013, 11:46 am Last Edit: Aug 18, 2013, 11:48 am by Vinter Reason: 1

Some interference to a floating pin can tip the transistor into conductance.


This is what I don't get. I understand how interferance can affect input readings but I don't see how this could affect the external circuit.  Then again I have limited knowledge when it comes to the details of logic gates.

MAS3

There is not that much of a difference between the input that needs to be read, and the transistor that needs to be controlled.
As you are not controlling the input (base) of the transistor, you can't tell what it gets.
A wire might act as an antenna and push the transistor into conductance.
By adding a pull down resistor, you are controlling that input.
Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

alnath

#19
Aug 18, 2013, 12:02 pm Last Edit: Aug 18, 2013, 12:06 pm by alnath Reason: 1
From the wiring, he is actually driving the transistors bases, they are connected to outputs through 150Ohm resistors. AFAIK, outputs, once they are configured as outputs, are either LOW or HIGH ( at least, frome the moment they are sent a HIGH or LOW order) , not in a open collector state.
I don't see the need of a pulldown resistor here .

Edit : Vinter, you say :
Quote
Also I sat down yesterday and checked every led individually . Also checked combinations of leds in each column and it seems that it works as expected. This looks like a programming problem but I can't spot the error.

What power source did you made your tests with ? Is i the same that is used for your arduino wiring ?

Vinter

#20
Aug 18, 2013, 01:09 pm Last Edit: Aug 18, 2013, 01:12 pm by Vinter Reason: 1

From the wiring, he is actually driving the transistors bases, they are connected to outputs through 150Ohm resistors. AFAIK, outputs, once they are configured as outputs, are either LOW or HIGH ( at least, frome the moment they are sent a HIGH or LOW order) , not in a open collector state.
I don't see the need of a pulldown resistor here .

Edit : Vinter, you say :
Quote
Also I sat down yesterday and checked every led individually . Also checked combinations of leds in each column and it seems that it works as expected. This looks like a programming problem but I can't spot the error.

What power source did you made your tests with ? Is i the same that is used for your arduino wiring ?


I am using the 5 volts pin of the arduino for now so the circuit isn't standalone yet. Maybe I should had mentioned this earlier but I don't think it makes a difference. By the way, I wrote a very simple sketch to lit the leds in my previous example and it works perfectly without lighting any extra leds. I am almost sure it's the code now but I just can't track down the error.

Grumpy_Mike


From the wiring, he is actually driving the transistors bases, they are connected to outputs through 150Ohm resistors. AFAIK, outputs, once they are configured as outputs, are either LOW or HIGH ( at least, frome the moment they are sent a HIGH or LOW order) , not in a open collector state.
I don't see the need of a pulldown resistor here .

Because he is using charlyplexing some pins spend some time being inputs. Therefore your argument does not apply. Pull downs are needed.

A base is an input to the transistor. This is susceptible to interference pickup just like any other input. The pull down resistor will help suppress this. This is something I have seen on simple transistors in a noisy environment, which is what you have here multiplexing a load of LEDs.

Quote
I am using the 5 volts pin of the arduino for now so the circuit isn't standalone yet. Maybe I should had mentioned this earlier but I don't think it makes a difference.

Makes no difference.

Quote
By the way, I wrote a very simple sketch to lit the leds in my previous example and it works perfectly without lighting any extra leds.

That is very likely because of the lack of heavy multiplexing reduces the amount of interference that is knocking about.



Vinter

#22
Aug 18, 2013, 01:33 pm Last Edit: Aug 18, 2013, 01:35 pm by Vinter Reason: 1


From the wiring, he is actually driving the transistors bases, they are connected to outputs through 150Ohm resistors. AFAIK, outputs, once they are configured as outputs, are either LOW or HIGH ( at least, frome the moment they are sent a HIGH or LOW order) , not in a open collector state.
I don't see the need of a pulldown resistor here .

Because he is using charlyplexing some pins spend some time being inputs. Therefore your argument does not apply. Pull downs are needed.

A base is an input to the transistor. This is susceptible to interference pickup just like any other input. The pull down resistor will help suppress this. This is something I have seen on simple transistors in a noisy environment, which is what you have here multiplexing a load of LEDs.

Quote
I am using the 5 volts pin of the arduino for now so the circuit isn't standalone yet. Maybe I should had mentioned this earlier but I don't think it makes a difference.

Makes no difference.

Quote
By the way, I wrote a very simple sketch to lit the leds in my previous example and it works perfectly without lighting any extra leds.

That is very likely because of the lack of heavy multiplexing reduces the amount of interference that is knocking about.





I will look to this but the simple sketch works the same way as my code. It only modifies the columns if they have to be lit. It just doesn't provide varying brightness. Also is the transistor as sensitive as the high impedance input pins?

Grumpy_Mike

Quote
Also is the transistor as sensitive as the high impedance input pins?

Not as sensitive as floating FETs but sensitive to cause the problem you are seeing.

alnath



Because he is using charlyplexing some pins spend some time being inputs. Therefore your argument does not apply. Pull downs are needed.

A base is an input to the transistor. This is susceptible to interference pickup just like any other input. The pull down resistor will help suppress this. This is something I have seen on simple transistors in a noisy environment, which is what you have here multiplexing a load of LEDs.



OK, thanks.  I couldn't open the sketch, so I have not seen the code .
agreed also about the interferences in this environment

Vinter


Quote
Also is the transistor as sensitive as the high impedance input pins?

Not as sensitive as floating FETs but sensitive to cause the problem you are seeing.


I don't know. It doesn't happen with the new sketch and I'm skeptical since it works the same way as my code but with higher frequency.Most other charlieplexed projects I have seen also don't use pulldown resistors. Maybe it's a common mistake but I also don't experience a completely random behavior. The stray leds that light up share the same cathodes as the ones I want to be lit and I think it's more likely to be a mistake in the port manipulation for example.

Grumpy_Mike

OK I am not going to argue any more.
You asked for advice and I gave it.
Good luck hunting the "error" in your code.

Vinter

#27
Aug 18, 2013, 02:24 pm Last Edit: Aug 18, 2013, 02:32 pm by Vinter Reason: 1

OK I am not going to argue any more.
You asked for advice and I gave it.
Good luck hunting the "error" in your code.


I just want to be sure since I have soldered everything and it will need hours of work to add the pulldown resistors. Meanwhile the interferance is supposed to come from the charlieplexing but in my simple test sketch that works the same but doesn't use BAM and has higher frequency, I don't notice any problems. Is it that far fetched to doubt my code? I have literally posted it 3 times but I haven't gotten any answers about it yet and I am prone to mistakes since I am self-taught when it comes to coding. Sorry if I offended you,, I just don't have time and I don't want to spend three days for the resistors and transistors to arrive and solder everything just to find out I get the same problem and that it's because of the code. I am merely trying to find problems with the circuit here and I want to be completely sure before doing anything.

alnath



OK I am not going to argue any more.
You asked for advice and I gave it.
Good luck hunting the "error" in your code.


I just want to be sure since I have soldered everything and it will need hours of work to add the pulldown resistors. Meanwhile the interferance is supposed to come from the charlieplexing but in my simple test sketch that works the same but doesn't use BAM and has higher frequency, I don't notice any problems. Is it that far fetched to doubt my code? I have literally posted it 3 times but I haven't gotten any answers about it yet and I am prone to mistakes since I am self-taught when it comes to coding. Sorry if I offended you,, I just don't have time and I don't want to spend three days for the resistors and transistors to arrive and solder everything just to find out I get the same problem and that it's because of the code. I am merely trying to find problems with the circuit here and I want to be completely sure before doing anything.


as I said earlier, I've been unable to open your ino file, maybe you could post your code between
Code: [Select]
code  tags :)
you've got no time..... I hope people here have much to spend on your code  :smiley-mr-green:
Sorry, I don't see how you could spend 3 days, or even hours to solder 10 resistors  :smiley-eek:

For me,  based on hours of hardware and software debugging (a few years ago, I admit ;) ) , I try to never think that if something appears illogical to me, it can't be ! The only way to find out is to try. That doesn't mean to leave out other possibilities, just consider everything as possible, even if unlikely.
Moreover, the persons who pointed that out are experimented ones, most of their posts prove it  ;)




Vinter

#29
Aug 18, 2013, 03:02 pm Last Edit: Aug 18, 2013, 04:28 pm by Vinter Reason: 1



OK I am not going to argue any more.
You asked for advice and I gave it.
Good luck hunting the "error" in your code.


I just want to be sure since I have soldered everything and it will need hours of work to add the pulldown resistors. Meanwhile the interferance is supposed to come from the charlieplexing but in my simple test sketch that works the same but doesn't use BAM and has higher frequency, I don't notice any problems. Is it that far fetched to doubt my code? I have literally posted it 3 times but I haven't gotten any answers about it yet and I am prone to mistakes since I am self-taught when it comes to coding. Sorry if I offended you,, I just don't have time and I don't want to spend three days for the resistors and transistors to arrive and solder everything just to find out I get the same problem and that it's because of the code. I am merely trying to find problems with the circuit here and I want to be completely sure before doing anything.


as I said earlier, I've been unable to open your ino file, maybe you could post your code between
Code: [Select]
code  tags :)
you've got no time..... I hope people here have much to spend on your code  :smiley-mr-green:
Sorry, I don't see how you could spend 3 days, or even hours to solder 10 resistors  :smiley-eek:

For me,  based on hours of hardware and software debugging (a few years ago, I admit ;) ) , I try to never think that if something appears illogical to me, it can't be ! The only way to find out is to try. That doesn't mean to leave out other possibilities, just consider everything as possible, even if unlikely.
Moreover, the persons who pointed that out are experimented ones, most of their posts prove it  ;)






I don't have access to a computer with internet since I'm at our village atm and so I can't copy and paste that much code via the phone. I need 3 days for the parts to arive and solder them afterwards. Also I didn't reject Grumpy's advice, it just didn't go well with my simple sketch. Because I know Mike is experienced,I actually opened the simple sketch to see if something is wrong with it and in fact there is. I had put a small delay between switching modes so there weren't much interference. I removed the delays and the stray leds lit up like a chistmas tree. I will try to post my code by sections using my phone later on but so far it seems Mike's hypothesis was spot on.

Here is the code. I had to remove the comments though.
Code: [Select]

#include <avr/pgmspace.h>
byte led[9][9] ={0};
byte PORTB_CATHODES;
byte PORTD_CATHODES;
byte ANODE;
int BAM_Counter =0,BAM_Bit =0;

prog_uchar PIN[] PROGMEM = {
 B00000100,
 B00001000,
 B00010000,
 B00100000,
 B01000000,
 B00000001,
 B00000010,
 B00000100,
 B00001000,
 B00010000
};
void setup(){
 noInterrupts();
 TCCR1A = B00000000;
 TCCR1B = B00001001;
 TIMSK1 = B00000010;
 OCR1A= 2500;
 interrupts();

}

void loop() {

 LED(1,2,2,63,0,0);
 LED(1,3,3,0,63,0);

}

void LED(int col1, int col2, int row, byte red, byte green, byte blue) {

 if (col1 != 2) {
   led[3*(col1-1) + col2 -1][3*(row-1)] = red;        
   led[3*(col1-1) + col2 -1][3*(row-1)+1] = green;
   led[3*(col1-1) + col2 -1][3*(row-1)+2] = blue;
 }

 else {
   led[map(2+col2,3,5,5,3)][3*(row-1)] = red;
   led[map(2+col2,3,5,5,3)][3*(row-1)+1] = green;
   led[map(2+col2,3,5,5,3)][3*(row-1)+2] = blue;
 }

}

ISR(TIMER1_COMPA_vect) {

 switch(BAM_Counter) {

 case 1 :
 case 2 :
 case 4 :
 case 8 :
 case 16:
 case 32 :
   BAM_Bit++;
   break;
 case 64 :
   BAM_Bit =0;
   BAM_Counter =0;
   break;

 }


 for(int col =0; col<9; col++) {
   PORTD_CATHODES = 0;
   PORTB_CATHODES = 0;
   ANODE = 0;
   for(int row =0; row<9; row++) {
     if(led[col][row] >> BAM_Bit & 1) {
       ANODE = pgm_read_byte(&(PIN[col]));
       if(row < col && row < 5) {
         PORTD_CATHODES = PORTD_CATHODES | pgm_read_byte(&(PIN[row]));
       }
       else if(row < col && row >=5) {
         PORTB_CATHODES = PORTB_CATHODES | pgm_read_byte(&(PIN[row]));
       }
       else if(row >= col && row < 4) {
         PORTD_CATHODES = PORTD_CATHODES | pgm_read_byte(&(PIN[row+1]));
       }
       else if(row >= col && row >= 4) {
         PORTB_CATHODES = PORTB_CATHODES | pgm_read_byte(&(PIN[row+1]));
       }
     }
   }

   if (col <5) {
     PORTD = PORTD & 3;
     PORTB =0;
     DDRB = PORTB_CATHODES;
     DDRD = ANODE | PORTD_CATHODES | (DDRD & 3) ;
     PORTD = (PORTD & 3) | ANODE;

   }

   else {  

     PORTB =0;
     PORTD = PORTD & 3;
     DDRD = (DDRD & 3) | PORTD_CATHODES;
     DDRB = PORTB_CATHODES | ANODE;
     PORTB = ANODE;

   }

 }
 BAM_Counter++;
}





Btw when it comes to the pull down resistor would this be an ok configuration ? The img is from someone else's project so ignore the 12 V source.



Also, could the problems that I am experiencing be partly due to the transistors' capacitance ?

Go Up