How to Control a Ton of Inputs using Shift Registers!

Поделиться
HTML-код
  • Опубликовано: 24 дек 2024

Комментарии • 280

  • @serverguy2
    @serverguy2 9 лет назад +7

    I was a maestro of IBM 370/390 assembler. You are a maestro of at least Arduino coding. So maybe also C and others. Anyway, I appreciate your coding. Even with the quick hacks you write for these little demos, the code is still tight without being so tight to be incomprehensible like some C/C++ coders like to do. You show off just the right amount. It is easy to understand and "elegant" for demo level programs. I have seen MUCH worse. Thank you for taking the time to do these demos. I understand the electronics and have for decades but your integration with programming is enlightening at the next level of HW/SW integration. Well done.

  • @jzgonzo
    @jzgonzo 7 лет назад +5

    I'm not an electronic engineer but your explanation was pretty clear. Now i'm ready to solve a problem that seemed very complicated to me before watching this great video. Thanks!

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yes, you have a good point, and I just added an annotation, but this does allow you to mix inputs and outputs in the same shift register bank

  • @JurriaanPetersen
    @JurriaanPetersen 11 лет назад +2

    The while loop at the end of the ISR should not be necessary, if the IRS is only called on the rising edge. And if you did want to improve your code(or make it shorter) you could also replace the whole check variable by replacing it with "1

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    my code was to simply toggle the LED on or off, but if you just need to read the value in as being just on or OFF, that is simple, since a double tap wouldn't affect you. Like the ISR being called would not flip your output

  • @avdwio
    @avdwio 11 лет назад +2

    Methinks an array or two would help to clean up the code.
    You could remove the while loop at the end and repeat the pin read function without actually writing to the leds. Run pin_read, get an array for which buttons are pressed, compare it to the array for the buttons which were previously pressed. From that you can find which buttons have gone from 0 to 1. If nothing's changed, there's no difference, so pin_read can just keep looping while the input is high.

  • @EddieVanHalen1977
    @EddieVanHalen1977 11 лет назад

    I am 2 minutes in and I already know I am going to subscribe. This guy is soooo good. Like butter. Thank you Kevin. Your presentation is just flawless and perfect. I cannot wait to watch many of your videos. Thank you so much. I am fan.

  • @DeeegerD
    @DeeegerD 10 лет назад +30

    Good button technique but all those delays in an ISR is very bad practice. You should only record the state of the buttons into variables and let the main loop process debounce and determine if the buttons have been pressed. Another way is to check a clock state and determine if the button has been pressed long enough in the ISR and set a state. The objective is to manage the button state as quickly as possible in the ISR and return to the main loop (rest of the code).

    • @DupczacyBawol
      @DupczacyBawol 7 лет назад +2

      Agreed, but the author was saying he had not prepared himself to the video, and he appologized to us. As for ISR, indeed the 'routine' (not function) should only set some flag to true/false, and that is all. Hardware interrupts work aside normal program execution. MC/CPU stops normal program execution for checking all that interupt stater and running ISRs. And I think unless the current ISR() routine finishes it halts executing next ISRs, thus stops running the code and other interrupts (timers?). I think, such behavior prevents also from multiple execution of the same ISR over, and over again berore the first one finishes. (we would experience interrupts interrupted by interrupts - endless loop). The loop function should do the job. Anyway great lecture, thank the author. Have a nice day.

    • @Gilhad1
      @Gilhad1 6 лет назад +1

      You are right, but purpose of THIS video was not ISR, but the button/diode/pin 2 trick, no more. So the code is just as demo, how it is possible to read that, not how it should be done in "real" program and even waiting in ISR does not matter, as there is no other code to execute, nor other interrupt to take care of.

    • @HDFoxra
      @HDFoxra 6 лет назад

      @@DupczacyBawol As pointed out, yea... this has nothing to do with ISR or anything like that. And even if he apologized for not being prepared to make a video... if you haven't prepared, why make the video? Lol. EVEN then, again, being prepared for a video has nothing to do with implementation. I could set up 20 servers for a business, but then go 'I wasn't prepared to give an orientation on how to use these servers', and yet that orientation would have NOTHING to do with me actually installing an OS onto the hardware and installing the necessary drivers/software...

  • @hyperscitic92a
    @hyperscitic92a 11 лет назад +16

    Could you please post schematic of this circuit on your website. I understand shift registers pretty well but I'm a bit confused how you wired this project up.

    • @Leilektsoglou
      @Leilektsoglou 3 года назад

      +Kyle Leser Did you manage to make the wiring?

    • @ianthehunter3532
      @ianthehunter3532 3 года назад

      @@Leilektsoglou Did you manage to make the wiring?

    • @jacobstrous8929
      @jacobstrous8929 3 года назад

      @@ianthehunter3532 Did you manage to make the wiring?

    • @ianthehunter3532
      @ianthehunter3532 3 года назад

      @@jacobstrous8929 no, gonna use io extenders

  • @JayDAnderson
    @JayDAnderson 10 лет назад +1

    Very efficient way to sense the actuation of any one or more of a number of buttons. Great. You are basically setting each button on a single bit then polling all the bits in the byte to see which one are on or off.

  • @nerdyneddy7887
    @nerdyneddy7887 11 лет назад

    As you had as a baloon at the start, a parallel in serial out is the way ti go for input. 3 pins, clock, load & data.
    cheers

  • @bergweg
    @bergweg 11 лет назад

    I was about to post the same question. The 74HC595 is a Serial to Serial/Parallel IC, I'd use a Parallel to Serial IC with internal pull-up resistors.

  • @darktherapy
    @darktherapy 11 лет назад

    Cheers Kevin, you did a better video explaining this technique than in possibly could.

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yep this will work for you... sounds like an awesome project! You may want to review the other comments below to see what others have suggested

  • @wreckless_-jl6uu
    @wreckless_-jl6uu 5 лет назад

    *Very nice, I actually under stand shift registers a lot better now!! Specifically the 74HC595!! Thanks!!!*

  • @funy0n583
    @funy0n583 2 года назад

    first he says he's going to assume we understand how shift registers work and then he says "I'm sure if you guys are familiar with diodes or not" haha I appreciate you explaining everything

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    hmmm, maybe? I think there might be a way to modify what I have here for something like that, but this is interrupt driven, so if you only care about a reading above a threshold then yea, I think this coudl work

  • @PihkalTheTihkal
    @PihkalTheTihkal 11 лет назад

    I was going to ask why you didn't use a regular parallel in - serial out shiftregister but since multiple people already asked it I'm not going to ask it again.)
    It's actually a pretty neat technique that I've never seen before so thank you for explaining it.
    Using outputs as inputs if that's not thinking outside of the box, I don't know what is.
    Great video, as always.

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yea, I know... I need to do that. Many people have suggested the same. Just been really busy lately

  • @BarrettSimms
    @BarrettSimms 10 лет назад +1

    This is really great. Thanks. It would be good to see how you wired everything up when you do these.

  • @bwoogie
    @bwoogie 7 лет назад +1

    The diodes are required if anyone is wondering :) I didn't have any on hand so I just used some LEDs! for testing purposes, anyways.

    • @AnimilesYT
      @AnimilesYT 5 лет назад

      Aren't LEDs horrible diodes? I have no facts to back it up, but I've heard that LEDs were made to emit light, and not to block the current. But if it works for testing purposes then I don't really see a problem either xD

  • @thebackyardguru3785
    @thebackyardguru3785 10 лет назад +2

    Awesome tutorial, any chance i can get a schematic.. been at it for a week and i just cant get it to work. I am from South Africa, not sure where i am going wrong... difference in IC maybe... PS i am still a newbie, what is the best way of trouble shooting where i am going wrong?

  • @ClokworkGremlin
    @ClokworkGremlin 5 лет назад

    So it's basically a ghetto MUX, which is pretty cool if you don't have an 8-to-1 MUX lying around, but the really interesting thing about this is that since you're strobing the source voltage across the pins, it should actually work with analog inputs as well as pushbuttons. When you do the strobing pass, the pulldown resistor will reduce the voltage across the inactive pins to 0, so you can theoretically get the voltage across only one input at a time.
    You may need to do some resistor math to figure it out exactly. It's been a few years since I had to calculate circuit diagrams, but could be especially useful if you have a limited number of ADC pins available.

    • @ClokworkGremlin
      @ClokworkGremlin 5 лет назад

      Back to say: I just tried this, and it actually works way better than I expected, but not exactly how I described 2 months ago.
      Your analog inputs each have one reference pin tied to VCC or ground, depending on whether you want them to be active-high or active-low. (VCC for active-low, VSS for active-high)
      The other reference pin is tied to the shift register, and is strobed through just like in this example (or the later one where he switched from ISR to polling)
      Analog values are connected to a single analog pin via a diode. If the circuit is set up in Active-High mode, the diodes should be pointing *from the analog sensor into the MCU analog input pin.* In Active-Low mode, point them the other direction.
      The analog pin will read whatever the highest/lowest (depending on mode) value among all of the analog sensors is. By setting the shift register pin to inactive mode (low for active-high, high for active-low), you effectively remove that sensor from the circuit. Set only one sensor active at a time and strobe through them to read 8 analog values on a single input pin.

  • @10magicalfingers27
    @10magicalfingers27 5 лет назад +1

    Hi Kevin, I'm trying to make a small simple midi keyboard with 25keys (nothing fancy, just digital switches reading on and offs and sending the data to the computer) . I just need it to be polyphonic upto 10keys. I.e it should be able to detect (on or off) for 10 keys at them same time. And it should be very responsive in reading it. Are multiplexers okay or shift registers? Which shift register do I need need. And i saw you pressing multiple buttons at once. How many can actually be pressed at the same time and still work in your setup.

    • @Obzy98
      @Obzy98 2 года назад +1

      Hey @10magicalfingers27
      I'm curious to know if you got a solution for your project. Did it work? And do you mind sharing your thoughts?

  • @greatideasgreatlife
    @greatideasgreatlife 11 лет назад

    i was making 5*5*5 led cube using 595 shift register and bc 547 transistor. it worked in starting and is not working properly. i have not attached any resistor in the base emitter of transistor and 220 ohms in the collector emitter .CAN THIS BE A PROBLEM. or can you guess...

  • @maniamone
    @maniamone 8 месяцев назад

    hi, are you using two 74HC595 for both controlling inputs and outputs? and is it possible to have the circuit schematic of this tutorial?

  • @SkyhanViper
    @SkyhanViper 8 лет назад

    u can use data lactches for same porpose.
    74hc374
    no code needed.
    just use external data read command
    74138 demultiplexer will also help u for more inputs

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yea they are, but no prob since we are debouncing in software. A simple delay is all that's needed

  • @htkevo5273
    @htkevo5273 5 лет назад +1

    I think u can also use a 74165 parallel in serial out that has its output pin hooked to DS of the 74595 to achieve this

    • @LikeVHD
      @LikeVHD 2 года назад +1

      I think. If using 74165 then no need to use 74595 anymore. It is possible to connect the push button directly to the 74165 to reduce complexity. The rest is just programming.

  • @shedactivist
    @shedactivist 3 года назад

    Perfect. I was looking for a way to use BCD switches as inputs to Arduino and you have shown me the way.

  • @bluedeath996
    @bluedeath996 8 лет назад +15

    Only 3 years late on commenting but a bitwise XOR (^) with a 1 would be a better way to toggle the bit, rather than the if else.

    • @Ano_ny
      @Ano_ny 5 лет назад +1

      Only 3 years late but I don't have anything to say

    • @Ano_ny
      @Ano_ny 4 года назад +1

      ​@z3 Respectively to the comment it is 3 years

    • @simonmasters3295
      @simonmasters3295 4 года назад

      Respectfully it's never to late to learn a better approach

    • @Leilektsoglou
      @Leilektsoglou 3 года назад

      @@simonmasters3295 Is it possible to help me with the wiring?

    • @Ancipital_
      @Ancipital_ 2 года назад

      I really wish I knew how this would look

  • @FreeApophis
    @FreeApophis 11 лет назад +1

    That is pretty neat.
    However for a thousand inputs it would probably be a good idea to be a bit more efficiant: You could make this even faster by divide and conquer instead of a linear search. For 1024 Inputs you only would need 10 checking cycles compared to 1024 in the linear search.

  • @mbrumlow
    @mbrumlow 11 лет назад +2

    I am just getting into Arduino, but have experience with programming.
    I was just wondering about your code a bit.
    I was thinking that it may be better to make pen_read set a global boolean, then in your loop you would do basically what you are doing in pen_read right now.
    loop would be while(pressed) { *current_pen_read_code*; pressed = false; };
    Like I said, I am new, and don't have the parts to test this yet. Can you think of why that would not work, or why that would be less effective?

  • @andrewalexander3079
    @andrewalexander3079 10 лет назад

    Not sure if it works in the Arduino IDE, but just a suggestion for the future. In the for loop, instead of having the "Check" variable shifted and then run through the loop again, the parameters of the loop could be:
    for( Check = 1, Check >0, Check

    • @bjarnieinarsson3472
      @bjarnieinarsson3472 9 лет назад

      Hmmm.. byte becoming -1, I thought bytes was unsigned number between 0..255 with values at every bit (seat) as follows.. 1 2 4 8 16 32 64 128. No minus for bytes.. at least in the language Pascal I use most of the time.
      Left shifting just shift value of bits to higher places, that is, race the value to power of two. You could also easily use 8 bit array values of bytes.
      When pushing two or more buttons, two or more hardware interrupts will occur. This "dirty" technics he is showing by overloading interrupt function in endless loop is very scary and against every thing I would even consider.
      Kind of challenge to optimize this, one idea is to save the state of prior interrupt's and use binary search, test first by using byte value of 15 (4 least bits signed) if no signal, then you know it is one of them who gives you 240, halve that and 3 readings is enough in worst scenario etc. and of cause take prior state of buttons in to those calculations with masking.

    • @lloydrmc
      @lloydrmc Год назад

      @@bjarnieinarsson3472 wait, wut?
      By "-1" I think the conditional tests true in that instance
      And "Endless loop"? Where?

  • @TexasSkyPilot2
    @TexasSkyPilot2 10 лет назад +1

    Good explanation of good design. Cinematography should be front lighting to remove glare from back light on desktop.

  • @lloydrmc
    @lloydrmc Год назад

    Brilliant! Provision for debounce, (frequently not the case with shift register videos). Plus SPI library for speed.
    Lots of lateral thinking here. Earned you a subscription

  • @luw1z
    @luw1z 10 лет назад

    Thanks alot for the explanation. I was wondering if you have the part numbers for the diodes you used?

  • @oscareriksson9414
    @oscareriksson9414 10 месяцев назад

    Cool trick! I was thinking of letting the last output shift everything back to the micro controller. As in insted of connecting another shift register in series, I would connect it back to the arduino in this case. There I would shift the bits into a byte and after the 8 clocks I would have the output byte back and could mask for the correct buttonpress. I figured it would maybe work since it shifts out from there. But maybe your loop is better hmm I'll try and see. This gave me inspiration! Thanx

  • @MrManuHeel
    @MrManuHeel 8 лет назад

    Hi Kevin ! I'm working on a project using your setup (actually, using the "piano" version as it's exactly what I'm trying to achieve), and I can't figure out something. I don't get the usage and difference between the data and what you call "Input from the buttons" (pin 2). What exactly is this pin 2 doing and how to connect it to my buttons ? We can't really see the board or schematics in your video :/
    Thanks !

  • @geertvancompernolle2586
    @geertvancompernolle2586 3 года назад

    Yes, this is an old thread, but still very, very useful. The technique to find out which buttons are pressed is super! And this, with a 595 which is supposed to drive something, not to (indirectly) detect if something is changed/pressed... Very clever indeed...
    Problem is that I don't know which Arduino has been used for this demo (if an Arduino has been used at all) but I struggled with the SPI communication because with the Arduino Uno, the clock and data pins are switched. In my case, the clock pin is Arduino pin 13 (and not 11 as per the tutorial) and the MOSI pin is Arduino pin 11 (and not 13 as per the tutorial). In the video where the code is explained (e.g. time 12.14) it's mentioned otherwise. Unless the comment written next to the pins is wrong, in which case I step back silently...
    Can this be confirmed?
    Best,
    --Geert

  • @Sidney-l6b
    @Sidney-l6b 5 лет назад

    Hey I appreciate the video, but it would be very helpful to beginners like myself to have a schematic. Is there a wiring diagram that you could share with us??

  • @Neslekkim
    @Neslekkim 11 лет назад

    The buttons you are using here, are they not giving you any bounceproblems?, if so, what buttons are they?

  • @ImaginationToForm
    @ImaginationToForm 11 лет назад

    Hi,
    Very useful information. I wasn't needing thousands but I am going to be making a control panel for a spaceship game I play to make it more interesting to play than just keyboard. Going to use different switches and types of lights. Was probably needing about 20 inputs and more outputs. Was going to add extra just to give it more of a spaceship feel too :) I thought I was going to have to use analog multiplexers for input but I guess I can just use the shift registers now.

  • @4.0.4
    @4.0.4 7 лет назад +1

    Isn't this simplier with the CD4021 chip instead of the 74HC595 chip?
    I'm a novice so I really don't know, but it does seem like one chip is made to shift out (e.g., to a bunch of LEDs) and another to shift in (e.g., many buttons)
    On the other hand most arduino kits come with a 74HC595 and not a CD4021 so maybe I'm missing something.

    • @GordieGii
      @GordieGii 7 лет назад

      To use a CD4021 (or other parallel to serial shift register) you have to constantly read in the register to know whether anything changed. With the '595 you just turn on all the outputs and you forget about it until an interrupt occurs. When an interrupt occurs then scan to see which one(s) caused the interrupt.

  • @deltasecurity7135
    @deltasecurity7135 10 лет назад

    Hello Mr.Darrah , Kevin ,
    First of all , congratulations for you excellent job. That being said , I wonder if you can post a tutorial with the wiring diagram of the circuit, because I tried several times and could not make it work.
    Thank you in advance.
    Wagner Hiroshi

  • @TimoBenkhard
    @TimoBenkhard 8 лет назад

    I am confused as to why you are using the 10k resistor, im quite new to this so I hope its not a stupid question. Your explanation was very clear!

    • @RFC3514
      @RFC3514 8 лет назад +1

      +Timo Benkhard - Arduino pins configured for input are in high-impedance mode, and react to very small amounts of current, so they can pick up noise and appear to change state when they're not connected to anything. They have built-in pull-up resistors (that you can enable via software), but no pull-down resistors, so if you want the pin to always appear low when there's nothing connected (as in this case), you need a resistor between that pin and ground. 10k is a typical value (low enough to ensure the pin gets set to low when it doesn't have a signal, but high enough to make sure the pin goes to high when signal arrives).
      Check the "DigitalPins" page on the Arduino Tutorial website for more details.

    • @geertvancompernolle2586
      @geertvancompernolle2586 8 лет назад

      @RFC3514 - I don't think it has something to do with the Arduino inputs directly. If the 10k resistor is not present and you put an output of the shift register IC to 1, you're making a short circuit between that output and ground (apart from the diode which is in between, but this one will conduct).
      I'm afraid this won't be healthy for the shift register device because I don't think there's protection inside the chip itself...

    • @RFC3514
      @RFC3514 8 лет назад

      Geert Vancompernolle - Just try it, and you'll see. Or read the page I mentioned above; the Arduino manual makes it pretty clear.

  • @avdwio
    @avdwio 11 лет назад

    So what happens if you're holding down one button and then press another? I'd assume that while loop at the end screws you over a bit there.

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    nice one! Thanks for the tip. I was just goofing around with these

  • @abdoubobo7763
    @abdoubobo7763 3 года назад

    Thank you so much Kevin. Please i need the diagram?

  • @1Joren
    @1Joren 8 лет назад

    Erhm honestly thanks for showing that circuit with the analogRead at the start. That'll actually do for my project since it's only 4 buttons I'm using and they shouldn't/can't be pressed at the same time in my interface. I'll definitely start playing with shift registers in the future though when time is a less pressing issue :P

  • @geraldmoritz8523
    @geraldmoritz8523 8 лет назад

    Great Video ! I want to use a Rotary Encoder and need the Interrupt for this one. But I could use any PinChangeInterrrupt for checking any pressed button, right ? Greetings from Austria !

  • @chadjamesjohnson
    @chadjamesjohnson 11 лет назад

    Hey, I'm curious. What microcontroller are you using in this video?

  • @cjmendoza8599
    @cjmendoza8599 5 лет назад

    @kevin darrah sir im asking for help do you have a schematic diagram of 4 or 5 or more inputs interlocking circuits...for example i have a four inputs push button 1 to 4 and output LED 1 to 4 the sequence is like this..if i press push button 4 the LED4 will turn on then when i press push button 1 the LED 4 will turn off then the LED 1 will turn on then when i press push button 3 the LED 1 will turn off then LED 3 will turn on and so on..it always one LED will acivate on OUTPUT...please...thanks in advance

  • @jimmatheson9125
    @jimmatheson9125 Год назад +1

    Why not use a 74HC165 and just read the buttons directly

  • @mainkordormawblei
    @mainkordormawblei 7 лет назад

    thank you so much Kevin for that awesome video, can you do another for 74HC165? it would really helpful. thank you.

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yes you are right! Ha, this actually got me as well! will update the code

  • @unity4alle1
    @unity4alle1 2 года назад

    Hi Kevin, I am trying to figure out how to make simple led selection indicator, so I want 8 LED to be shifted in an infinite loop by a press of a button. So one press next LED is lit, another press next to last LED is lit and so on in circle. I hope you understand what I want to do. Please help, thank you :)

  • @Gator198l
    @Gator198l 9 лет назад

    Kevin, how is this wired? I'm having problems getting this set up. Thanks.

  • @T-FLoWW
    @T-FLoWW 7 лет назад

    Hi. I have a working circuit which has 4 digit 7 segment led display. I want to to read the Data and make my arduino send Smae numbers to my serial monitor tgat what my segment display shows simultaneously. What u wld advice? And umm this segment display has total 12 inputs which 8 for leds and 4 for shifting from eacg 1 number block cathodes(or anodes). Any advice?

  • @DOSTalks
    @DOSTalks 9 лет назад

    Just want to say man, really good video very clear and understandable you have a great channel

  • @Psykamaholik
    @Psykamaholik 9 лет назад

    Just wondering if you could offer suggestions as to why this code works on an UNO but not on a mega2650? I've tried changing the pins in the code to the appropriate MOSI and SCK pins on the mega but still no luck. Any help appreciated

  • @fierdawsbugiez
    @fierdawsbugiez 4 года назад

    Tq for the detail explanation,..about to build something and learning for shift reg, already watch many vid n good input

  • @german.galvis
    @german.galvis 7 лет назад

    I couldn't find schematics for this in your site! are those published anywhere else? :O :O

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    oh boy, the only advice I have is to keep playing! Interested in something? Buy it, and start tinkering!

  • @korbanomalley7002
    @korbanomalley7002 10 лет назад

    I am relativity new to programming shift registers. How could I modify this code to use only 1 register for inputs and then do something like print "high" to the serial monitor?

  • @doomaster4
    @doomaster4 11 лет назад

    Have you tried connecting this to the arduino in your cube to change the animation that is running?

  • @learn7302
    @learn7302 9 лет назад

    There is an error in the code. 595's are activated by rising edge, but your code is written in such manner digitalWrite(HIGH), then digitalWrite(LOW);

    • @stevenvanhulle7242
      @stevenvanhulle7242 9 лет назад

      Learn It's not necessarily an error, but he has to be sure the output was low before he makes it high. But you're right, reversing the order (first low, then high) would be better.

  • @YoussefEl.
    @YoussefEl. 9 лет назад

    How would you apply the same principle for an analog signal ? The Arduino has only 6 analog inputs, what could we use to extend that to say 20+ analog inputs?

  • @jamielewis4149
    @jamielewis4149 9 лет назад

    What type of diode would I need for my push buttons? What type of diode are you using? Many thanks

    • @abdulrhmankhallil8254
      @abdulrhmankhallil8254 9 лет назад

      any type of diodes should work correctly in this case... it doesn't matter as long as they are forward baised as shown on the tutorial

    • @stevenvanhulle7242
      @stevenvanhulle7242 9 лет назад

      Jamie Lewis He's probably using 1N4148s. These are cheap and more or less the standard for small signal diodes.

  • @iam.masoudsamimi
    @iam.masoudsamimi 4 года назад

    Do you have schematics/diagrams for the connections please?

  • @ArturBernardoMallmann
    @ArturBernardoMallmann 7 лет назад

    Basically the register connected to the buttons just send one bit per cycle to identify if the actual checked button is pressed!? This a is a amazing idea.

  • @dadholly3133
    @dadholly3133 11 лет назад

    Can a automatic style casino keno game be made up with Arduino or some micro controller. It would show game number as well as drawing 20 random numbers out of 80 leds.

  • @TomLeg
    @TomLeg 4 года назад

    What pushbutton are you using?

  • @zelra891
    @zelra891 9 лет назад

    thanks. clear video on how it works. but i'm not familiar with SPI, so the code is a little hard to understand.

  • @charnjit525
    @charnjit525 6 лет назад

    As any arduino board all pins can be used as digitalRead. My arduino Pro micro board has 18 pins for use as digitalRead. I
    Need to 42 pins for input to my arduino board(for different outputs) . Is it possible using 74HC595 shift register????? . If yes, please help me with arduino sketch & wiring diagram arduino board to 74HC595 and push buttons,,,,,,,

  • @13firebug13
    @13firebug13 11 лет назад

    Is there a reason why I can't get my led circuit, the circuit is from a double ended light saber thing that have I think 6 leds on one circuit that has one + cable for each and one - cable for all of them.

  • @Mark-PY2NA
    @Mark-PY2NA 6 лет назад

    I'm looking for something similar but I need to press a button and it will turn off the other. it's possible?

  • @zelra891
    @zelra891 9 лет назад

    I'm thinking about it. if you control the LED via 74HC595, you can control about 4x4 LED's with every shift register. But if you use it as an input, it's almost 8 at a time. That means if you have a lot of inputs, like 200, you will also need a ton of registers, like 25 for 200. I feel that there will be problems if the inputs are grouped in matrix, any idea?

    • @GordieGii
      @GordieGii 7 лет назад

      You could possibly make a matrix input but I don't know if you could maintain the interrupt driven feature of this scheme. Therefore you would have to constantly scan the matrix.
      How about this:
      Use the '595 to drive 8 rows high. Use a parallel to serial shift register to read the columns, and constantly clock it with a PWM output. Don't actually read the input, just let it wait for an interrupt. When any button is pressed the input will go high within 8 cycles of the PWM. Then read the input shift register to see which column is on, then scan the '595 to see which row is on.

  • @SFORSANDEEP
    @SFORSANDEEP 7 лет назад

    Sorry.. am only a beginner.. I got little confused.. I heard 74hc595 is an output shift register (Serial in parallel out) and 74hc165 is actually an input shift register.. But here (05:40) you are mentioning it(74HC595) connected with push buttons.. Little confused

    • @Gilhad1
      @Gilhad1 6 лет назад

      you output 1 sequencially to each button and read the common part (pin2) to see, if there is 1, so if the respective button is pressed. Input is pin 2, the output register 165 shifts the "voice" to particular buttons.

  • @serhioromano
    @serhioromano 8 лет назад

    Kevin, I would like to discuss one idea with you. How could I contact you?

    • @Kevindarrah
      @Kevindarrah  8 лет назад

      +Sergey Romanov kdcircuits.com

  • @yorganyog
    @yorganyog 4 года назад

    I love this project, really, but it would be incredible if we had schematics. In the end, becomes a very dark and cloudy tutorial. How to work the outputs, I get loads of info, but I'm having trouble knowing where to connect the pin 2 to the shift register as said in the code. Actually, I can't find any documentation of using 74HC595 as an input expander. Only with other shift registers like 74hc165. I see 74HC595 as an output expander.

  • @souravdokania1929
    @souravdokania1929 8 лет назад +1

    This did blow my mind, it was so awesome. I could have never imagined such an amazing technique was even possible.

  • @nerdyneddy7887
    @nerdyneddy7887 11 лет назад

    I don't know about mechanical switches though, rather hard to use code to debounce using switches comomg through shift registers, can be done though, resposiveness may be a trade off that needs to be made.
    cheers

  • @thomasthiry4293
    @thomasthiry4293 6 лет назад

    Hi! Does all this can work on a raspberry pi (and domoticz)? Thanks :)

  • @Flapjackbatter
    @Flapjackbatter 11 лет назад

    That`s genious.
    Who ever came up with using shiftregisters this way should have a madal.

  • @yorgle
    @yorgle 11 лет назад

    This is remarkably similar to how a Diode Matrix Rom works. Very clever!

  • @SimonKatimba
    @SimonKatimba 8 лет назад

    could you please show me a schematic of how i would connect 8 switches(input) to my 74HC165 to Arduino and then to my 74HC595 to my 8 LEDs(output)?When a correspong switch is off, then a corresponding LED should go on

  • @Ademan
    @Ademan 11 лет назад +2

    Nice walkthrough. On the software side you should be able to replace your bitRead()/bitWrite() with just Output ^= Check; Someone's probably already brought it up but I have no desire to fight youtube's comment system long enough to make sure...

  • @flyingsquirrel3271
    @flyingsquirrel3271 5 лет назад +3

    This is so cool! Thanks for explaining!
    And also: Fix your indentation!!! :-P

  • @The1wsx10
    @The1wsx10 8 лет назад

    very nice video. i only have a basic knowledge of what different components do and i was able to understand this very clearly

  • @MrXiaofanZhang
    @MrXiaofanZhang 11 лет назад

    Hi there,
    Has anybody got any tips/ advice for a relative beginner in electronics? I've got some basic knowledge about basic components(leds, resistors, caps) and the picaxe system. But I was wondering if there are any good websites or other resources that could help me broaden my knowledge/ understanding and work with more complex things with more integrated circuits driving a wider variety of outputs.
    Thanks.

  • @BrianCofer
    @BrianCofer 7 лет назад

    If I want to use 4 total shift registers, 2 for buttons, 2 for lights, do I just wire them all up together from the same clock/data/latch pin? And what changes in the code when you add more registers?

    • @Gilhad1
      @Gilhad1 6 лет назад

      Yes, you just chain them as many as you want (and even may play with the order) and in the code you need more "Output" variables (array?) and loop the "Change" over all inputing chips. Also note, that you can use part of chip for LEDs and part for buttons, if you wish so. Just little complicated code, but not too much. The idea is still the same - cycle 1 over buttons, detect, what is pressed, the restore outputs to proper state and wait for another interrupt.

    • @claudedada6504
      @claudedada6504 3 года назад

      @@Gilhad1 please sir could you write the code for us? i'm desperate for searching and i need only 16 input and 16 output just with the same i dea of Kevin

  • @lcf4359
    @lcf4359 2 года назад

    It would really be helpful if you upload the circuit schematic

  • @Kevindarrah
    @Kevindarrah  11 лет назад

    yes, that is a very cool method. You can roll that same technique into what I'm showing you. Hmmm, that's funny he also discovered the diode issue... guess it is pretty obvious

  • @bitmeister
    @bitmeister 11 лет назад

    Wow, no dislikes, congratulations! Great vid!

  • @codenothing
    @codenothing 9 лет назад

    Thank you so much for this video! you answered a lot of questions I had for my pinball project.

  • @Skandawin78
    @Skandawin78 7 лет назад

    how many shift registers I need to control 25 key keyboard ? what is scan matrix? with 9*3 scan matrix can I control all 25 keys . how to set up that? pls advise

    • @Gilhad1
      @Gilhad1 6 лет назад

      4 registers using this idea verbatim. to read matrix you need different aproach. Depends on many factors, what is the best, I woul use one mcp23017 over I2C for matrix up to 16 (rows+cols total)

  • @btasler
    @btasler 7 лет назад

    The first switch scheme is flawed because it assumes that all the switches and wiring will remain pristine, but what happens when the switch contacts get tarnished and slightly resistive? It works good when the equipment is new, but what happens in a couple/few years?
    The shift register button scanning scheme, as you explained it, starts out with all 1s then upon getting the interrupt it shifts a 1 through the chain. You would have to continue shifting that 1 until none of them came back high, at which point you could then re-enable the interrupt, otherwise you would miss the successive switch closures because they wouldn't be generating an interrupt. Since you are stuck using a '595 anyway, just use a PISO shift register like a 4014- same number of pins, none more of the headache.
    Yeah I know this is old.

    • @jay.rhoden
      @jay.rhoden 2 года назад

      Yes, I am confused about the chip choice. Isn't the 595 intended for parallel out? vs the 165 for serial in?

  • @alexstone691
    @alexstone691 9 лет назад +2

    You are the best dude!!

  • @Firashelou
    @Firashelou 11 лет назад

    hello, can you please put a fritzing picture or a schematic for the circuit ?