scswift:
Btw for your decoupling capacitors, get little ceramic ones. You don't need to worry about polarity with those.
In regards to this, can you give me an example? My local "electronics shop" is really terrible and the staff know less about electronics than your standard pizza delivery driver. So, when I go there, I need to know exactly what it is that I need.
A 100nF ceramic capacitor is a 100nF ceramic capacitor. If it doesn't say 100nF ceramic capacitor, or 0.1µF ceramic capacitor on the packet, then don't buy it. It may have the numbers "104" printed on the actual capacitor surface itself.
I found out that my local electronics shop works best if I go to them with their own inventory numbers and not component name, so take a look at their web site, if they have one, and see if they have their own code listed next to the part name.
I didn't know I needed one. I am quite new to electronics and am trying to control an LED matrix. What would I use a decoupling capacitor for in this situation?
The rule is simple, all digital logic chips should have a decoupling capacitor to ground on every supply right next to the
chip. (most chips have only one supply, here 5V). Typical symptoms of inadequate decoupling is random,
occasional misbehaviour. Unless you enjoy circuits that sometimes go wrong for no obvious reason don't
forget to decouple!
Without further information 0.1uF is a good default value that should work in most
circumstances, but the datasheet for the chip will have chapter-and-verse on decoupling requirements.
Buy decoupling capacitors in bulk, its much more economic!
I wasn't able to go to the shop myself today and my girlfriend may have gotten the wrong part. I have put all ground pings to ground and put a resistor between G pin and ground. These things seam to have really helped out but it hasn't totally fixed the problem. It still only works when a hand is near, but it is quite consistent and doesn't require much precision, just a human body nearby.
The capacitors I was able to get are 50V 0.1uF and 25V 10uF. I am not sure what the voltage here means, if it is a limit or what it should be run at.
Not sure if it matters, but I daisy chained another shift register on another breadboard and it seams like the closer the breadboards are to eachother, the more pronounced this problem is.
I have tried both capacitors across both shift registers but alas, nothing.
Should I just go myself to the store and ensure that I get the correct capacitors?
Edit: I also bought a few transistors to play around with but there is of course an issue here too. If I hold the wire that goes from the shift register to the base pin of the transistor between two fingers everything works perfectly with the transistor. But if I am not holding the wire, the current to the LED is super low, hardly any light up at all. I am not sure what would cause that but I can say that my wires are quite basic (my cables are just untwisted ethernet cables...).
Ok, my package finally arrived with bunches of jumper wires and another arduino (micro this time)! I was also able to get the proper decoupling capacitors. After using proper jumper wires to wire everything up, it all seams to work properly.
So, thank you everyone for your help. I learned quite.
My last question is - on the datasheet for the shift registers that I am using (http://www.adafruit.com/datasheets/tpic6b595.pdf), there are 3 ground pins per register. Do I need to put each of these pins to ground or can I just put 1 to ground and call it a day? I just want to make sure I don't fry my registers.
Follow the data sheet's recommendation... Always unless you KNOW SPECIFICALLY OTHERWISE...From the symptoms you quote you have a 'floating' input to the S.R.
Go over your wiring carefully and If you don't find it... POST YOUR CODE AND AN ACCURATE DRAWING OF THE DEVICE. An Accurate Schematic would be great but good pictures of your wiring are better than nothing. Without your code and drawings/pictures anything returned is at best a guess...
Connect all ground pins to ground.
There is also G pin (pin 9) that should also be grounded for the outputs to output.
When output enable (G) is held high, all data in the output buffers is held low and all drain outputs are off.
When G is held low, data from the storage register is transparent to the output buffers.
As promised, here is my wiring diagram and the exact code I am using. The Arduino that I am using is actually an Arduino Micro but I couldn't find that in the Fritzing program. All pins are correct though.
Right now, the shift registers are working properly, yay! I have not gotten any interference since I changed the wires to proper jumper wires.
//Pin to clear the register
const int clearPin = 7;
const int latchPin = 8;
const int clockPin = 12;
const int dataPin = 11;
int i = 0;
void setup() {
//set pins to output because they are addressed in the main loop
pinMode(clearPin, OUTPUT);
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
Serial.begin(9600);
Serial.println("*");
// delay a little and then set
delay(100);
// Always start by sentting SRCLR high
digitalWrite( clearPin, HIGH);
}
void loop() {
// write to the shift register with the correct bit set high:
if (i == 2) {
i = 0;
}
registerWrite();
delay(1000);
i++;
}
// This method sends bits to the shift register:
void registerWrite() {
// the bits you want to send
byte bitsToSend0 = 0;
byte bitsToSend1 = 0;
// write number as bits
bitWrite(bitsToSend0, i, HIGH);
bitWrite(bitsToSend1, i, HIGH);
// turn off the output so the pins don't light up
// while you're shifting bits:
digitalWrite(latchPin, LOW);
// shift the bits out
shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend1);
shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend0);
// turn on the output so the LEDs can light up:
digitalWrite(latchPin, HIGH);
}
From what I can make out from that tangled mess, you have your transistor wired up like:
That is wrong. Firstly your current limit resistor is in the wrong place (it is offsetting the transistor, which is bad), plus you don't have a current limit resistor on the base, which is bad, as it could kill your shift register.
I am not sure exactly how to read those diagrams but I gave it a shot. Alas, it doesn't work.
Attached is how i have wired up the LED with the transistor. Right now I only get some current through the LED when I am holding wire 2 between my fingers - but not much as the LED only lights up a little.
That looks right, and the fact that touching wire 2 turns it on (probably flickering at 50/60Hz) means it's wired fine. It sounds like the output you are connecting it to though isn't actually running as an output, and the connection is floating.
majenko:
That looks right, and the fact that touching wire 2 turns it on (probably flickering at 50/60Hz) means it's wired fine. It sounds like the output you are connecting it to though isn't actually running as an output, and the connection is floating.
Ok, but how could that be? If I take the transistor out and just have the LED connected like: 5V - resistor - LED - shift register pin - it all works just fine. I can I get it to work properly?
Yes. The "outputs" of the shift register act just like your transistor - they are "off" so then are high impedance (open circuit), or "on" and connected to ground. You need power from the 5V rail to turn your transistor on, and when you turn on the output to the shift register it connects the base of your transistor to ground, turning it off.
majenko:
Yes. The "outputs" of the shift register act just like your transistor - they are "off" so then are high impedance (open circuit), or "on" and connected to ground. You need power from the 5V rail to turn your transistor on, and when you turn on the output to the shift register it connects the base of your transistor to ground, turning it off.
Wouldn't this just connect the collector to the base of the transistor? How would this allow the power to flow to the emitter in of the transistor?