Loading...
  Show Posts
Pages: 1 2 [3] 4
31  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 08, 2013, 02:24:38 pm
Then I will use your sequence, after all it looks like the best sequence out of the three i can choose. Thanks again!
32  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 08, 2013, 01:05:32 pm
Did some testing with 2 different codes today(changed the code in something easier for the forum):

1:
Code:
void loop(){
shiftOut(dataPin, clockPin, MSBFIRST, B00001);
digitalWrite(latchPin, HIGH);
delay(500);
digitalWrite(latchPin, LOW);
}

2:
Code:
void loop(){
shiftOut(dataPin, clockPin, MSBFIRST, B00001);
digitalWrite(latchPin, HIGH);
digitalWrite(latchPin, LOW);
delay(500);
}

As you can see the difference is the place of the delay(). I uploaded both codes, and both looks exactly the same, so i can assume it does not care where i place the delay?

]
33  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 07, 2013, 03:31:32 pm
Ok thank you very much smiley! Then i put around a 10k resistor between the latch and gnd on my 5x5x5 cube.
34  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 07, 2013, 03:18:06 pm
No you was right! The latch pin should be low so no data will be send to the outputs. If i put the resistor on 5v and the latch then the latch will be high, if i tie it to GND then it is low(atleast it's working if i put the resistor between latch and ground). However i'm not sure if I need to place a resistor on every latch pin or only 1 resistor from  latch to ground will be good enough (notice that all the latches from the 6 registers are tied together).
35  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 07, 2013, 02:39:45 pm
Thanks for the tip! Now the LEDs won't light up when i connect the USB to my laptop!

Btw: Does every latch pin from each shift register need a resistor to ground? *I tie all the latches from each shift register (6 in total) together*

I don't think every latch need a resistor though
36  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 07, 2013, 12:38:41 pm
I still have a small 'problem'. The shift registers are hooked up to the arduino (3 digital pins, GND and 5V), when I put my USB cable in my laptop all the LEDS light up for a second and then just run the code I what was uploaded to the arduino. Is there any way to let the LEDs not light up whenever I connect my arduino to my laptop?
Vid:

 
37  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 06, 2013, 03:51:51 pm
Yes I agree with you, failures are there to learn from as we say in Holland smiley.

Luckily the chip still works fine, I just keep it for experimenting and use new shift registers for my cube;).
38  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 05, 2013, 06:45:44 pm
Yes I discovered I made a bad mistake what mark mentioned. Instead of pulling out the ground from the arduino I should have pulled out the ground from the LED(so stupid). Mark, thanks for the info by the way now I know even more about shift register(I am still very new with electronics so it is a kind of learning experience for me), thanks smiley!
39  Using Arduino / General Electronics / Help needed with shift registers on: February 05, 2013, 05:37:21 pm
Hello,

After finishing my 3x3x3 LED cube I decided to go a little bigger (5x5x5). Now the arduino doesn't have enough pins to control the LEDs, so I decided to use (5)shift registers to expand my number of outputs. So I was searching on the internet and found this tutorial(http://arduino.cc/en/Tutorial/ShiftOut). So I ordered a few LEDs and the 74hc595N shift register (datasheet:http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf). After wired everything (only 2 LEDs hooked up) up as the tutorial shows, everything worked perfectly fine smiley. Because i'm gonna use 5 transistors to control the LED's  layers, I pulled out the ground (pin 8 on the shift register). I expected to see the LEDs go off though they didn't. So now I pulled out the 5v aswell and still the LEDs are on (less bright though).

Now I think the shift register is provided by current through the I/O pins 8, 11, 12. Now I don't why this happening so if someone can explain it to me (why and how??) it would be very helpful!

this code i'm using:
Code:
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;



void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  // count from 0 to 4 and display the number
  // on the LEDs
  for (int numberToDisplay = 0; numberToDisplay < 4; numberToDisplay++) {
    // take the latchPin low so
    // the LEDs don't change while you're sending in bits:
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay);  
    //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    // pause before next value:
    delay(500);
  }
}

this is what is happening:


40  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LED cube, newbie questions on: February 05, 2013, 05:07:42 am
Ok thanks:D! I only will use around 325 mA at the most so arduino will provide enough when connected to USB, thanks again!
41  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LED cube, newbie questions on: February 04, 2013, 04:12:34 pm
I have a question about the current draw from the arduino 5v pin. Is it true that i can pull around 450mA from that pin(Usb powered, arduino uno itself use around 50mA or something close to that, so that leaves me 450mA IF all the digital pins are turned low).

Thanks in advance smiley!
42  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LED cube, newbie questions on: February 03, 2013, 04:51:42 am
No problem, I just thought it was weird because I was sure I made the post  smiley-mr-green. Anyway, my next project will be 5x5x5. I already ordered some shift register to experiment with and learn the basics of them smiley, I probably going to use shift registers on my 3x3x3 cube first to make sure I understand the programming and the way the shift registers work.
43  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LED cube, newbie questions on: February 02, 2013, 12:04:09 pm
Don't know how, but Arduino001 should be me (WonderTiger),  Weird..... Thanks anyway for your positive reply smiley-grin! (and thanks ofcourse for sharing your code as well smiley-wink)
44  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LED cube, newbie questions on: January 30, 2013, 06:17:15 pm
Another video smiley, multiplexed so only 1 layer is lit on any given time(im using array's and for loops to turn on the LEDs, easier to program/the code is shorter):


edit:
this code has even less lines as the one that I showed 2 posts back smiley.
45  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LED cube, newbie questions on: January 26, 2013, 06:32:38 am
Got my LED cube build today smiley-grin! This code I made as a test:

I used for() loops as delay between the columns as well for making the led columns run at their full brightness.

Code:
int layer1 = 11;
int layer2 = 12;
int layer3 = 13;
int led1   = 10;
int led2   = 9;
int led3   = 8;
int led4   = 7;
int led5   = 6;
int led6   = 5;
int led7   = 4;
int led8   = 3;
int led9   = 2;
int r      = 1;




void setup()
{
  pinMode(layer1, OUTPUT);
  pinMode(layer2, OUTPUT);   
  pinMode(layer3, OUTPUT); 
  pinMode(led1,   OUTPUT);
  pinMode(led2,   OUTPUT); 
  pinMode(led3,   OUTPUT); 
  pinMode(led4,   OUTPUT); 
  pinMode(led5,   OUTPUT); 
  pinMode(led6,   OUTPUT); 
  pinMode(led7,   OUTPUT); 
  pinMode(led8,   OUTPUT); 
  pinMode(led9,   OUTPUT); 
 

}

void loop()
{
while(r<=5){
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, LOW);
  digitalWrite (led5, HIGH);
 
 for(int i = 0; i <= 15;i++){
  digitalWrite (layer1, HIGH);
  digitalWrite (led1, HIGH);
  delay(1);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(1);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(1);
  digitalWrite (layer3, LOW);
  digitalWrite (led1, LOW);
 }
 
 for(int i = 0; i <= 15;i++){
  digitalWrite (layer1, HIGH);
  digitalWrite (led2, HIGH);
  delay(1);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(1);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(1);
  digitalWrite (layer3, LOW);
  digitalWrite (led2, LOW);
 }
 
for(int i = 0; i <= 15;i++){
  digitalWrite (layer1, HIGH);
  digitalWrite (led3, HIGH);
  delay(1);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(1);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(1);
  digitalWrite (layer3, LOW);
  digitalWrite (led3, LOW);
 }
 
 for(int i = 0; i <= 15;i++){
  digitalWrite (layer1, HIGH);
  digitalWrite (led6, HIGH);
  delay(1);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(1);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(1);
  digitalWrite (layer3, LOW);
  digitalWrite (led6, LOW);
 }
 
 for(int i = 0; i <= 15;i++){
  digitalWrite (layer1, HIGH);
  digitalWrite (led9, HIGH);
  delay(1);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(1);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(1);
  digitalWrite (layer3, LOW);
  digitalWrite (led9, LOW);
 }
 
 for(int i = 0; i <= 15;i++){
  digitalWrite (layer1, HIGH);
  digitalWrite (led8, HIGH);
  delay(1);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(1);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(1);
  digitalWrite (layer3, LOW);
  digitalWrite (led8, LOW);
 }
 
 for(int i = 0; i <= 15;i++){
  digitalWrite (layer1,  HIGH);
  digitalWrite (led7,    HIGH);
  delay(1);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(1);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(1);
  digitalWrite (layer3, LOW);
  digitalWrite (led7, LOW);
 }
 for(int i = 0; i <= 15;i++){
  digitalWrite (layer1, HIGH);
  digitalWrite (led4, HIGH);
  delay(1);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(1);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(1);
  digitalWrite (layer3, LOW);
  digitalWrite (led4, LOW);
 }
 digitalWrite (led5, LOW);
 digitalWrite (layer1, LOW);
 digitalWrite (layer2, LOW);
 digitalWrite (layer3, LOW); // RESET all layers to OFF
 r = r++;                     
}
r = 1;                       
while (r<=10){
  digitalWrite (layer1, HIGH);
  digitalWrite (led1, HIGH);
  digitalWrite (led3, HIGH);
  digitalWrite (led7, HIGH);
  digitalWrite (led9, HIGH);
  delay(75);
  digitalWrite (layer1, LOW);
  digitalWrite (layer2, HIGH);
  delay(75);
  digitalWrite (layer2, LOW);
  digitalWrite (layer3, HIGH);
  delay(75);
  digitalWrite (led1, LOW);
  digitalWrite (led3, LOW);
  digitalWrite (led7, LOW);
  digitalWrite (led9, LOW);
  delay(75);
  digitalWrite (led2, HIGH);
  digitalWrite (led4, HIGH);
  digitalWrite (led6, HIGH);
  digitalWrite (led8, HIGH);
  delay(75);
  digitalWrite (layer3, LOW);
  digitalWrite (layer2, HIGH);
  delay(75);
  digitalWrite (layer2, LOW);
  digitalWrite (layer1, HIGH);
  delay(75);
  digitalWrite (led2, LOW);
  digitalWrite (led4, LOW);
  digitalWrite (led6, LOW);
  digitalWrite (led8, LOW);
  r = r++;
}
r=1;
}

Here a video smiley:
If anyone has some tips what I could do better on my code, feel free to let me know smiley.
Pages: 1 2 [3] 4