Teensy 3.0 and the 595!

Status
Not open for further replies.

Katsu

Member
I am fairly new to electrical stuff in general! I wanted to play around with it and a friend recommended the teensy. I like it a lot, and my first few setups worked beautifully.

I recently bought a 595 shift register, as I wanted to mess with controlling multiple LEDs in order to more efficiently use an LED counter display, and initial testing hasn't been stellar. I got a 3.0, which I had trouble figuring out what pins to use for the clock and latch, but I believe I have them down, as I can get an LED to light up. The program I am using takes input from the terminal window to determine which LED to light up, and while serial-write echo messages are showing it is executing the code as expected, I can only get the first LED to light up. I am not too knowledgeable and easily could have done something very stupid with the wiring, but I am not sure what!

Here are a few pictures of my board, I can't help but think it's a problem with the ground:
teensy01.jpg
teensy02.jpg
 
The problem might be wiring, or it might be code (or both). Can you post the code you are running? Also it would help to draw the schematic of your circuit, the wiring is a little hard to follow from the photos.

A shift register is a simple circuit, so you should be able to test out basic operation without using the Teensy at all. Just try manually connecting the the data input to logic high, and switch the clock input between logic high and low, and observe what the output pins do. Then try again with data input at logic low.
 
Last edited:
Just a thought, is your breadboard of the type where the power rails are in two halves? If so you need to connect them with jumper wires. I notice the LEDs are mostly on one side of the board, away from the Teensy and the power and ground connections.
 
Just a thought, is your breadboard of the type where the power rails are in two halves? If so you need to connect them with jumper wires. I notice the LEDs are mostly on one side of the board, away from the Teensy and the power and ground connections.

I have a similar breadboard, and its power rails are actually separated into 4 quadrants. You need to connect the ground and power on each quadrant if you are using a single power source. This gives you the advantage that you could use a different power source for a particular quadrant, such as 5v or even higher to run servos (control would still be 3.3v from the Teensy, but the servos typically draw higher power). You would still typically need to connect the grounds together. If you don't have a multimeter or circuit tester, you can use a LED to see whether there is power between the rails.
:cool:
 
If you don't have a multimeter or circuit tester, you can use a LED to see whether there is power between the rails.

...and just to be very clear, since you mentioned being new to hardware, he means a LED in series with a current-limiting resistor :). Also the LEDs, being diodes, need to be the right way around (the more positive voltage goes to the anode side, and the cathode side goes the other way, eg. towards ground)
 
Last edited:
Thanks for all the input, I was putting together a diagram when I realized something else has happened to my teensy. It stopped even lighting the one led, I tried loading the hello world program into it and it is not responding, I can only hope it isn't fried..

I am aware of the led leg length relating to polarity, I am not sure if the board has quadrants on the rails but I will test it to see.

Here is the code:


const int latchPin = 8;
const int clockPin = 13;
const int dataPin = 11;

void setup() {
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
Serial.begin(9600);
Serial.println("reset");
}

void loop() {
if (Serial.available() > 0) {
int bitToSet = Serial.read() - 48;
char buf[100];
sprintf(buf,"%d\n",bitToSet);
Serial.write(buf);
registerWrite(bitToSet, HIGH);
}
}

void registerWrite(int whichPin, int whichState) {
byte bitsToSend = 0;

digitalWrite(latchPin, LOW);

bitWrite(bitsToSend, whichPin, whichState);

shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend);

digitalWrite(latchPin, HIGH);

}

I'll need to poke the teensy to see if I didn't break it.. Windows detects it being connected, but arduino (set into teensy 3 mode) doesn't respond when I hit the reset button on the teensy.
 
There was a problem with my USB cord, preventing me from properly synching the teensy, I swapped it out and was able to test the problems.

The original problem was of the board being split on the rails, so there are two sets of two columns of rails on either side of the main rows. I connected the rails I was using for ground and the other LEDs came up like a charm, thanks for the tip!
 
Status
Not open for further replies.
Back
Top