Go Down

Topic: Shift Register only works when hand is close (Read 3032 times) previous topic - next topic



Feb 26, 2013, 11:02 pm Last Edit: Feb 26, 2013, 11:40 pm by shiznatix Reason: 1
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...).

Last Edit: The only company around me is called Elfa and on their website I can't find any 100 nf ceramic decoupling capacitors. My search leads me to https://www.elfaelektroonika.ee/elfa3~ee_en/elfa/init.do?cat=0&sq=ceramic+decoupling+capacitor+100+nf&sel=1&solrRows=10&selectedCategory=&fq=|inStock%3Atrue|priceRangeMin%3A0|priceRangeMax%3A1&sortBy=&sortOrder=&priceRangeMin=0&priceRangeMax=1&searchFilterInStock=inStock


We have become so bogged down in decoupling capacitors that we have failed to look at anything else.

I see that you are using pin D1 in your wiring diagram.  You are also using the Serial port.

You can't do both.  Try moving D1 to D2 instead.

Also, you haven't posted your complete code.  You know how I can tell?  You're not defining your pin variables anywhere.  Please post your full code.


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.


Feb 28, 2013, 04:51 am Last Edit: Feb 28, 2013, 04:53 am by Docedison Reason: 1
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...

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard


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.


From the symptoms you quote you have a 'floating' input to the S.R.

Sorry, what is the S.R.?

As for the drawings and exact code - I will post these as soon as I get home after work with the remaining issues that I have.


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.

The problem though that I am having now is that my transistor is not working. If I screw around and plug things in and hold some wires, it will sometimes work. The transistor datasheet is here: https://www1.elfa.se/data1/wwwroot/assets/datasheets/cgON-BC546-548_en.pdf

My exact code is as follows:
Code: [Select]
//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);
  // delay a little and then set
  // 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;

// 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.

It should be like this:


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.

Am I doing this wrong?


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.


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?


Quote from: Datasheet
Outputs are low-side, open-drain DMOS transistors with output ratings of 50 V and 150-mA continuous sink-
current capability.

Add a 10K pull-up resistor between the shift register output and +5V.

Note that the output operation (HIGH/LOW) will be reversed.


Add a 10K pull-up resistor between the shift register output and +5V.

Note that the output operation (HIGH/LOW) will be reversed.

So I should put this pull-up resistor connecting wire 2 and 3?


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.

Go Up