How to Control a Ton of Inputs using Shift Registers!

Ғылым және технология

This video explains how to use shift registers(74HC595) to control an insane amount of digital inputs.
Part 2:
• Part 2 - How to Contro...
Check these videos out first:
• How Shift Registers Work!
• Video
The code in the video: (note - I had the data and clock backwards in the video)
www.kevindarrah.com/download/a...
Check out my Tindie store (trigBoard is available) www.tindie.com/stores/kdcircu...
Thanks to all the Patrons for dropping a few bucks in the tip jar to help make these videos happen!
/ kdarrah
Twitter: / kdcircuits
For inquiries or design services:
www.kdcircuits.com

Пікірлер: 280

  • @serverguy2
    @serverguy29 жыл бұрын

    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.

  • @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

  • @jzgonzo
    @jzgonzo6 жыл бұрын

    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!

  • @shedactivist
    @shedactivist3 жыл бұрын

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

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

    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

  • @EddieVanHalen1977
    @EddieVanHalen197710 жыл бұрын

    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.

  • @wreckless_-jl6uu
    @wreckless_-jl6uu4 жыл бұрын

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

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

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

  • @darktherapy
    @darktherapy11 жыл бұрын

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

  • @BarrettSimms
    @BarrettSimms9 жыл бұрын

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

  • @codenothing
    @codenothing8 жыл бұрын

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

  • @funy0n583
    @funy0n583 Жыл бұрын

    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

  • @DOSTalks
    @DOSTalks9 жыл бұрын

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

  • @JayDAnderson
    @JayDAnderson10 жыл бұрын

    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.

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

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

  • @thebackyardguru3785
    @thebackyardguru378510 жыл бұрын

    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?

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

    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

  • @fierdawsbugiez
    @fierdawsbugiez3 жыл бұрын

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

  • @The1wsx10
    @The1wsx108 жыл бұрын

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

  • @MrManuHeel
    @MrManuHeel7 жыл бұрын

    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 !

  • @1Joren
    @1Joren8 жыл бұрын

    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

  • @user-zg6qh1bk8y
    @user-zg6qh1bk8y5 жыл бұрын

    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??

  • @cjmendoza8599
    @cjmendoza85995 жыл бұрын

    @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

  • @unity4alle1
    @unity4alle12 жыл бұрын

    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 :)

  • @luw1z
    @luw1z10 жыл бұрын

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

  • @YoussefEl.
    @YoussefEl.8 жыл бұрын

    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?

  • @mainkordormawblei
    @mainkordormawblei6 жыл бұрын

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

  • @T-FLoWW
    @T-FLoWW6 жыл бұрын

    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?

  • @maniamone
    @maniamone3 ай бұрын

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

  • @korbanomalley7002
    @korbanomalley700210 жыл бұрын

    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?

  • @souravdokania1929
    @souravdokania19298 жыл бұрын

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

  • @geraldmoritz8523
    @geraldmoritz85238 жыл бұрын

    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 !

  • @markpedretti3765
    @markpedretti37656 жыл бұрын

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

  • @13firebug13
    @13firebug1310 жыл бұрын

    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.

  • @chemistry7699
    @chemistry769910 жыл бұрын

    Thank you. I now more fully understand how CCDs work by shifting the data.

  • @Psykamaholik
    @Psykamaholik8 жыл бұрын

    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

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

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

  • @charnjit525
    @charnjit5256 жыл бұрын

    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,,,,,,,

  • @deltasecurity7135
    @deltasecurity713510 жыл бұрын

    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

  • @Gator198l
    @Gator198l9 жыл бұрын

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

  • @mbrumlow
    @mbrumlow10 жыл бұрын

    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?

  • @JurriaanPetersen
    @JurriaanPetersen11 жыл бұрын

    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

  • @thomasthiry4293
    @thomasthiry42935 жыл бұрын

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

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

    I think you just inspired me to make a followup video!

  • @DeeegerD
    @DeeegerD9 жыл бұрын

    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

    6 жыл бұрын

    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 жыл бұрын

    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

    5 жыл бұрын

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

  • @avdwio
    @avdwio11 жыл бұрын

    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.

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

    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

  • @electrik0
    @electrik09 жыл бұрын

    Great video, Thanks for sharing!

  • @avtargrewal7422
    @avtargrewal74227 жыл бұрын

    Hi Kevin .I am working on project where I need to switch on /off 16 LED with 16 switch with Arduino uno.Could you please show me how to edit the code for 16l LED's whit 16 switches

  • @ThirdPer3on
    @ThirdPer3on6 жыл бұрын

    Love your work!

  • @KJ7JHN
    @KJ7JHN5 жыл бұрын

    Complete awesomeness! Thank you.

  • @Lefterhs15
    @Lefterhs158 жыл бұрын

    Thanks man. Really helpful !

  • @ImaginationToForm
    @ImaginationToForm11 жыл бұрын

    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.

  • @flyingsquirrel3271
    @flyingsquirrel32715 жыл бұрын

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

  • @TexasSkyPilot2
    @TexasSkyPilot210 жыл бұрын

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

  • @PihkalTheTihkal
    @PihkalTheTihkal11 жыл бұрын

    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.

  • @hyperscitic92a
    @hyperscitic92a10 жыл бұрын

    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

    2 жыл бұрын

    @@ianthehunter3532 Did you manage to make the wiring?

  • @ianthehunter3532

    @ianthehunter3532

    2 жыл бұрын

    @@jacobstrous8929 no, gonna use io extenders

  • @nerdyneddy7887
    @nerdyneddy788711 жыл бұрын

    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

  • @anuragmahajan5919
    @anuragmahajan59193 ай бұрын

    Thanks, that was very helpful!!!

  • @alexstone691
    @alexstone6919 жыл бұрын

    You are the best dude!!

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

    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

  • @iam.masoudsamimi
    @iam.masoudsamimi4 жыл бұрын

    Do you have schematics/diagrams for the connections please?

  • @doomaster4
    @doomaster410 жыл бұрын

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

  • @bergweg
    @bergweg11 жыл бұрын

    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.

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

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

  • @dadholly3133
    @dadholly313310 жыл бұрын

    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.

  • @oscareriksson9414
    @oscareriksson94145 ай бұрын

    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

  • @yorgle
    @yorgle10 жыл бұрын

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

  • @edgarestebanroseroarmas2774
    @edgarestebanroseroarmas27743 жыл бұрын

    Amazing technique!

  • @zelra891
    @zelra8919 жыл бұрын

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

  • @abdoubobo7763
    @abdoubobo77632 жыл бұрын

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

  • @danielguevara9357
    @danielguevara93578 жыл бұрын

    exellent thats the best tutorial ever been made

  • @Neslekkim
    @Neslekkim11 жыл бұрын

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

  • @Leo.Martins
    @Leo.Martins3 жыл бұрын

    Thank God. Finaly found what i've needed!

  • @geertvancompernolle2586
    @geertvancompernolle25863 жыл бұрын

    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

  • @german.galvis
    @german.galvis6 жыл бұрын

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

  • @10magicalfingers27
    @10magicalfingers274 жыл бұрын

    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

    Жыл бұрын

    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?

  • @FreeApophis
    @FreeApophis10 жыл бұрын

    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.

  • @adriancastellanoszaragoza5878
    @adriancastellanoszaragoza587810 жыл бұрын

    Awsome tutorial

  • @bwoogie
    @bwoogie7 жыл бұрын

    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

  • @avdwio
    @avdwio11 жыл бұрын

    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.

  • @SkyhanViper
    @SkyhanViper8 жыл бұрын

    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

  • @Firashelou
    @Firashelou11 жыл бұрын

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

  • @4.0.4
    @4.0.47 жыл бұрын

    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.

  • @arkitson
    @arkitson10 жыл бұрын

    Would this work? bitWrite(Output,j,1-bitRead(Output,j)) Because 1-bitRead(Output,j) changes 0 into 1 (and 1 into 0).

  • @MrXiaofanZhang
    @MrXiaofanZhang11 жыл бұрын

    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.

  • @htkevo5273
    @htkevo52735 жыл бұрын

    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

    Жыл бұрын

    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.

  • @priyabratasaha5385
    @priyabratasaha53857 жыл бұрын

    Great idea BOSS!

  • @GIGLIndia
    @GIGLIndia11 жыл бұрын

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

  • @SimonKatimba
    @SimonKatimba7 жыл бұрын

    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

  • @DanieleFornaciari

    @DanieleFornaciari

    7 жыл бұрын

    did you found some schematics about it?

  • @Kevindarrah
    @Kevindarrah11 жыл бұрын

    yea that's a good idea, I still need to bust out my pi and figure out how to work with it

  • @chadjamesjohnson
    @chadjamesjohnson11 жыл бұрын

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

  • @sufiansiddiquee
    @sufiansiddiquee10 жыл бұрын

    There is another problem with this idea, if you want to use some digital sensors to use instead of switches and all or any two sensors read at the same time, then it will be wrong reading. Isnt it?

  • @Skandawin78
    @Skandawin787 жыл бұрын

    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)

  • @Yefatbastard
    @Yefatbastard8 жыл бұрын

    Diodes are like check valves, they only allow current to flow in one direction..

  • @TheRossiale
    @TheRossiale11 жыл бұрын

    Can it be used for analog readings? :)

  • @zelra891
    @zelra8919 жыл бұрын

    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.

  • @bitmeister
    @bitmeister11 жыл бұрын

    Wow, no dislikes, congratulations! Great vid!

  • @Ademan
    @Ademan10 жыл бұрын

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

  • @Yemto
    @Yemto8 жыл бұрын

    I had no idea the shift register could be used for inputs too, thanks so much.

  • @RFC3514

    @RFC3514

    8 жыл бұрын

    +Yemto - This is a pretty roundabout way of doing it, using a serial-to-parallel shift register, though (useful if you only have those available). Assuming you're not stuck with the 74HC595, though, you can use a parallel-to-serial (or bidirectional) shift register (ex., CD4021B) to do most of the work for you. Check the "Parallel to Serial conversion" tutorial page in the Arduino site for some examples.

  • @GordieGii

    @GordieGii

    7 жыл бұрын

    To use a CD4021B (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. His way is actually pretty clever.

Келесі