Go Down

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

Shpaget

Connect all ground pins to ground.
There is also G pin (pin 9) that should also be grounded for the outputs to output.

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


shiznatix


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.

shiznatix

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);
  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);
}

majenko

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:

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

shiznatix

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?

Go Up