HariFun

Поділитися
Вставка

КОМЕНТАРІ • 190

  • @user-eq7iu4cv8f
    @user-eq7iu4cv8f 4 місяці тому +1

    I was scratching my head just now. took me two days wrestling around this keypad problem until i saw your tutorial.

  • @nosuchthing4789
    @nosuchthing4789 6 років тому +9

    Best approach is ALWAYS through practical example. Thx!

  • @raagamparmar179
    @raagamparmar179 5 років тому +8

    I made myself a 3x3 keypad and it is working really fine just like professional 4x4 or
    4x3 keypad! Thanks Hari Winguna!!!!

    • @HariWiguna
      @HariWiguna  5 років тому

      Thanks for sharing your success. That's awesome!

  • @AndreasSpiess
    @AndreasSpiess 7 років тому +18

    I like the basic idea. Very creative!

    • @HariWiguna
      @HariWiguna  7 років тому +5

      Thanks for the comment Andreas, but I could not take credit for the idea. I stumbled into the circuit in Google Images while researching keypads.
      www.microchip.com/forums/download.axd?file=0;694632&where=&f=1pin%20keymatrix.gif

    • @azizahtas
      @azizahtas 6 років тому +1

      Yeah but you implemented it and explained it fantastically! Thankx to you it saved me! Your awesome

    • @anthonyrossetti7509
      @anthonyrossetti7509 6 років тому

      4:14 wait you said the more resistors the higher the voltage but wouldn't it be the opposite? , the more resistors you put in series the more the voltage should drop between VCC 5v and the GND pin not increase, this makes no sense

  • @shinevisionsv
    @shinevisionsv 7 років тому +11

    Thats the smartest thing i've seen today! Big thanks and Hats down to you sir.

    • @HariWiguna
      @HariWiguna  7 років тому +1

      Thank you for the kind words. Much appreciated. :-)

  • @SpencerSkelly
    @SpencerSkelly 5 років тому

    Great walk through the concept. Thanks for sharing your work.

  • @robinsonprofis7501
    @robinsonprofis7501 5 років тому

    Really nice and simple explanation! Keep the good work an nice videos coming!👍

  • @gabrielcocenza
    @gabrielcocenza 6 років тому +1

    It works like a charm! Thank you for sharing.

  • @LunguCalin
    @LunguCalin 7 років тому

    Can't wait to see the finished product ! Nice video , clear explanations congratulations

    • @HariWiguna
      @HariWiguna  7 років тому

      Thanks Călin ! I appreciate the encouraging words.
      The custom PCB has arrived, but I've been too busy to solder the parts. Hopefully I will have time to do some soldering this weekend. :-)

  • @aswahd
    @aswahd 5 років тому +1

    really cool! I'm looking forward to another amazing video👍️👍️

  • @TRFrench
    @TRFrench 3 місяці тому

    That was brilliant. you've saved my life!

  • @hstrinzel
    @hstrinzel 2 роки тому +2

    How is it possible to read out 16 keys WITH JUST ONE PIN? Concentrated MAGIC! Wow, thank you! THAT's how it needs to be done. :)

  • @nobody2.076
    @nobody2.076 6 років тому +1

    OMG!!! This is so incedible smart! Its also so simple but so smart! I still can´t belive it...
    Thank you so much!

  • @myksmith
    @myksmith 4 роки тому

    Great example.
    I would totally buy this component addition to the keypad!

  • @ranieldenicen.marpuri6544
    @ranieldenicen.marpuri6544 5 років тому +1

    awesome video! the way you explained the keypad wow! inspired me to 3dprint a keypad of my own.

    • @ranieldenicen.marpuri6544
      @ranieldenicen.marpuri6544 5 років тому

      OMG ! just an update. I can make a whole keyboard with this ! HAHA I feel empowored.

    • @HariWiguna
      @HariWiguna  5 років тому

      @@ranieldenicen.marpuri6544 That's fantastic! Thank you for sharing your success!

  • @j3_
    @j3_ 7 років тому

    Every video you come to surpass the previous ... congratulations !!

    • @HariWiguna
      @HariWiguna  7 років тому

      I will work hard to continue that trend.
      Thank you very much!!!

  • @adaltonsantos9687
    @adaltonsantos9687 2 роки тому +1

    Very good man. Really a smart idea!

  • @ashleyhouse9690
    @ashleyhouse9690 7 років тому +1

    After days messing about trying to get this to work I had all but given up. The problem was the voltage out numbers I was getting were nothing like the progression you were demonstrating in your video, they were all over the place. On top of that they kept fluctuating over time so I couldn't program the threshold values with any certainty.
    Then I had a spare keypad delivered so I thought I would try that as a last resort - SORTED!! The voltage numbers were spot-on and gave consistant results. Anyone else having trouble with this should try different keypads to see what results they get. The first keypad was brand new as well by the way.
    Thanks for a very useful video Hari.

    • @HariWiguna
      @HariWiguna  7 років тому

      Grrr... sorry to hear about all the problems. I probably should have included a step to test just the keypad membrane switches themselves. Glad you persevered and got it figured out! Good job!

  • @rajatsaxena1990
    @rajatsaxena1990 7 років тому +2

    Exceptional logic. Really great !!

  • @MkmeOrg
    @MkmeOrg 7 років тому

    Well done Hari! Thumbs up as always. Great work

    • @HariWiguna
      @HariWiguna  7 років тому

      Hi Eric! Appreciate the comment. Thank you!
      I really need to get a better mic. I have to be a few Angstroms from my Blue ICE mic for it to have decent volume, so I often use the mic on my Samsung S7 camera, but of course it sounds different. Grrr. Do you have a lav mic recommendation? Do you use a separate audio recorder?

    • @MkmeOrg
      @MkmeOrg 7 років тому

      Hari Wiguna I use a super cheap battery powered lav from Amazon into my H4N recorder. I post process it in Audactiy (There's a whole video on my channel) Cheers Sir

    • @HariWiguna
      @HariWiguna  7 років тому +1

      Oh, I remember seeing your Audacity video before. I'll have to re-watch and apply it. Thanks Eric!

    • @MkmeOrg
      @MkmeOrg 7 років тому

      Hari Wiguna No prob at all Bud. Cheers

  • @jcduplessis1
    @jcduplessis1 2 роки тому

    I can't use the adjective that I want to use, so I will just say "Really" brilliant man! Nicely done and thanks for this!

  • @RyanJosephLong
    @RyanJosephLong 7 років тому

    Amazing! I would hire you!

  • @GenuineSoundware
    @GenuineSoundware 7 років тому +3

    Cool. It's a very old technique that was (and probably still is) widely used with small passive controllers for professional appliances such as the Alesis LRC which was a tiny controller for the Alesis Adat digital recorders; it has 13 buttons and terminates on a TS jack; I made a PIC18 project to read this controller and use it as a generic MIDI controller; the downside is that you have to apply a debouncing algorithm with a rather long debounce time in order to get a stable voltage before trying to recognize which button was depressed.

    • @HariWiguna
      @HariWiguna  7 років тому

      zioguido , i didnt know that it is good enough for commercial use. i thought it would not be reliable enough. do you have photos or videos of your hack? I'd love to swe it.

    • @GenuineSoundware
      @GenuineSoundware 7 років тому

      Yes, it's quite a reliable technique as long as the resistor network is done with high precision resistors, the rest is done by the software. The only remark I feel to make based on my experience is that you need to implement a rather long debouncing algorithm, say 200 mS, and it's even better if you have an high resolution ADC, 10 bit should be enough. No, I have no pictures of my project, but it must be somewhere down my basement :) it was only a part of a more complex control system that I made for my old recording studio and no longer use.

  • @XerotoLabs
    @XerotoLabs 7 років тому

    way cool . love the way you explained that .

    • @HariWiguna
      @HariWiguna  7 років тому

      Thanks Scott! It was a tough finishing the shoot and edit of this video because the PCB arrived from China while I was working on this video. I couldn't wait to try the board! I hope I didn't make any mistakes in the layout...

    • @XerotoLabs
      @XerotoLabs 7 років тому

      Video was great . and now i cant wait to see the new board . Like wise , having my printer so close to where i can start dry runs and testing .
      heck im so excited but trying to slow and methodical as needed so as not to break stuff that i would have to re order. must resist the urge to just mash it together . LOL

  • @djluchocrescente
    @djluchocrescente 7 років тому

    Excellent, Thank you!!!

  • @ChunkySteveo
    @ChunkySteveo 7 років тому +1

    Great explanation of the keypad. Liking your videos and just subscribed to watch more.
    Like the logical breakdown from start to finish of writing the code and understanding just what is going on. Better than just "copy paste" into Arduino without learning anything, Now I need to buy one of those pads... for no reason other than to tinker!
    I'm from a PHP background, and still got a lot to learn with Arduino and C... seeing that a 'char' and an 'int' look like arrays is baffling to me!!
    Steve

    • @HariWiguna
      @HariWiguna  7 років тому +1

      Thanks for the comment Stephen!
      Keys in Arduino arrays are always numeric, but the values could be any type, ie: an array of ints or an array of chars.
      If you enjoy coding, I think you'd enjoy Arduino. It's like coding with the bonus of physical input outputs (beyond keyboard and screen). Cheers!

  • @zeffofx
    @zeffofx 7 років тому

    Thanks to this!, I could save a lot of pins because of this trick.

    • @HariWiguna
      @HariWiguna  7 років тому

      Yeah, I'm already using a ton of shift registers for the 9x9 Seven-Segment displays, so I wanted to keep the input as simple as possible. Zero pin is not an option, so I had to settle for one pin. lol :-)

  • @Wilson84KS
    @Wilson84KS 4 роки тому

    Thank you, this is so complicated, if you don't know how, but as soon as someone pushes your nose on that or you realise it yourself, it is so amazingly simple and logic, I mean the analog pin reads voltage, so what is more logic than adress each button with a different voltage? And as soo you got it, you just think "why I didn't had the idea myself or why didn't it came earlier to me, grrrr, D'oh?", I'm using this already simply with the oneWireKeypad.h library, because it makes it all very simple and most important it isn't using any delays, but still interesting to watch, the way you explain it, the exited voice shows me that you are still amazed about how simple it actually is.

  • @AntonioSouza
    @AntonioSouza 7 років тому +1

    Very cool!

  • @MiggyManMike
    @MiggyManMike 7 років тому

    That's ingenious :)

    • @HariWiguna
      @HariWiguna  7 років тому +1

      I agree! However, I cannot take credit for the idea. :-(
      I stumbled into the circuit in Google Images while researching keypads.
      www.microchip.com/forums/download.axd?file=0;694632&where=&f=1pin%20keymatrix.gif

  • @StevenLawler
    @StevenLawler 5 років тому

    It's a good idea. It only allows one button to be pressed at a time though.

  • @siddharth_pasupuleti
    @siddharth_pasupuleti Рік тому

    i think my brain finna explode from how genius this is

  • @sahrulramadhan1967
    @sahrulramadhan1967 Рік тому +1

    This is Genius !!

  • @mankee2211
    @mankee2211 7 років тому +1

    beautiful breadboardOnAbreadboard / test setup :)

  • @SamBatti88
    @SamBatti88 7 місяців тому +1

    You are a Genius ! Can you share a schematic with all resistors on the matrix ?
    Do you think that this method can work for a 900 switchs ?

  • @robjohnson7024
    @robjohnson7024 6 років тому

    based on watching this video i pulled apart an old microwave and have made a 15 button keypad. And all it cost was a few resistors. top video and explaination

    • @HariWiguna
      @HariWiguna  6 років тому +1

      That's awesome Rob! Thanks for sharing your story!

  • @avejst
    @avejst 6 років тому +1

    Thanks for sharing :-)

  • @robimaulidana4683
    @robimaulidana4683 Рік тому

    Wow thats amazing

  • @bibel2k
    @bibel2k 5 років тому

    Amazing !

  • @RazoQuinnvanBerkel
    @RazoQuinnvanBerkel 6 років тому

    Thanks, it helped alot!

    • @HariWiguna
      @HariWiguna  6 років тому

      Awesome! Thanks for leaving a comment!

  • @falconhawker
    @falconhawker 2 роки тому

    If random noise is added to the output to the 4x4 keypad outputs this method has a failure rate !
    noise measurement: 0.01% rms of 5Vdc =5/10,000 v will cause a miniscule error
    say 1 error / 10^8 keypad outputs .
    Theoretically: a 5/10,000 v rms includes a few -5v pulses witihin a group of 10^8 noise intervals
    where 10^8 = 100.000,000 random pulses

  • @evonite841
    @evonite841 4 місяці тому +1

    Very good presentation

  • @gigunit100
    @gigunit100 6 років тому

    you are the best man

    • @HariWiguna
      @HariWiguna  6 років тому

      oh, you are too kind. Thank you for leaving a comment. :-)

  • @Enigma758
    @Enigma758 3 роки тому

    I saw this same technique used in an old VCR front panel. Did you know that it can even be done with a digital I/O pin and two additional passive components rather than using an analog input?

    • @HariWiguna
      @HariWiguna  3 роки тому +1

      Really? how do they do it with a digital pin? Charge a capacitor?

    • @Enigma758
      @Enigma758 3 роки тому

      @@HariWiguna Yes using an RC circuit with the resistor being the button voltage divider. One end of the RC is Vcc, the other end is connected to the digital pin. Discharge the cap by setting pin to output low. Now set pin to input and time how long it takes to turn on by reaching (Vcc/2). That time is proportional to the resistance value. Then repeat the process.

    • @HariWiguna
      @HariWiguna  3 роки тому +1

      @@Enigma758 Wow. That's crazy. Thx for explaining that to me.

  • @vandanagupta7831
    @vandanagupta7831 7 років тому

    You are great sir

    • @HariWiguna
      @HariWiguna  7 років тому

      Thank you. You are kind and generous sir!

  • @cameroncharlebois7331
    @cameroncharlebois7331 2 роки тому +2

    I just tried this out. Very neat. I am having a small issue that I was hoping you might have insight into. The wobble/slop on my key values is huge +/- 100. Any idea what would cause so much slop on a key press?

    • @HariWiguna
      @HariWiguna  2 роки тому +1

      Most likely your keypad uses switches that has high resistance (around 100 ohms as you noticed). The one I use has practically zero ohm resistance when the switch is pressed. All resistance comes from resistors, not the switch pads.

  • @salvatorebarbaro5862
    @salvatorebarbaro5862 7 років тому

    In theory it should work. In fact simulating the circuit with Spice works well.
    In practice, the voltage difference between the buttons down to the right is so small that a slight fluctuation in the supply voltage is enough to cause errors in the detection of the pressed keys. I did a lot of tests and in practice I was never able to run the detection well, pressing the D button gave me a #, and pressing the C key would tell me 9. :(

    • @HariWiguna
      @HariWiguna  7 років тому +1

      I guess I was just luckier?! I presume you calibrated your threshold arrays instead of just using my values. Also, by watching actual value fluctuations while gathering the values for the array, I was able to guess how much slop is necessary to give the maximum range for each button while not running into the "nearby" buttons. Thanks for sharing your findings Salvatore!

  • @francoisgagnon4467
    @francoisgagnon4467 Рік тому

    Neat!

  • @callsignvandal2615
    @callsignvandal2615 7 років тому

    Hari SUBSCRIBED! I have some programming experience and new to Arduino. I want to do this project and I understand the general concept but I don't have an electronics background so there's a few things I don't understand.
    In your drawing:
    1. Is R1-R12 just you counting the number of resistors needed in the project or does the number have other meaning?
    2. You are using just three different resistors 390 ohms, 1500 ohms, and 4700 ohms I think?
    3. As I am color blind I can't tell from the video, what resistor types (carbon film vs metal film etc.) and tolerances do you recommend?
    4. Similarly, C1 is a capacitor? What type and value do you recommend?
    Thanks a bunch for this great video!

    • @callsignvandal2615
      @callsignvandal2615 7 років тому

      Well, I never got a response so I just used metal film resistors and a 103 capacitor (I don't recall the type). Anyway, I just tried it on a 1 column by 7 rows of momentary mechanical push buttons mounted to a plastic plate and hand soldered together. I went with 220 ohm resistors since I had more rows. I will add two more columns as soon as I get more resistors in. Thanks Hari this is really cool and explained well. And should work great for my flight simulator button box which will have a couple dozen buttons, switches, and rotary encoders.

  • @TheTurnipKing
    @TheTurnipKing 7 років тому

    Seems like you could use Map on the analog value to simplify the input value range (say, 0-12) and make the code more readable?

    • @HariWiguna
      @HariWiguna  7 років тому

      That's a great idea! I'll have to try that. Thanks!!!

  • @infotechoverloaded721
    @infotechoverloaded721 Рік тому

    Genius

  • @davidc5323
    @davidc5323 7 років тому

    Pretty interesting . Do you have the program searching in a loop continuously Or does the program react when only you press the button?

    • @HariWiguna
      @HariWiguna  7 років тому +1

      Funny you should ask that :-) Take a look at my loop()
      github.com/hwiguna/HariFun_Mega_Sudoku/blob/master/Seven_Segment_Sudoku/z_Loop.h
      Unfortunately, I don't think we could trigger an interrupt off analog pin - correct me if i'm wrong.
      So, the main loop reads the analog once, figure out which button was pressed and call the appropriate routine, then repeat over and over again. The display is being refreshed by an interrupt routine.

  • @DrSynthDevices
    @DrSynthDevices 8 місяців тому +1

    Nice work.. I was wondering if I could use this to reverse engineer a keypad from a rack module.
    Basically my idea is to mimic the key preses in the rack via arduino.
    So in a first stage I would use the voltage divider to determine the values for each key press as input and then, based on the obtained values, use the analogwrite function to "send" the same key press via arduino. Do you think that is possible?
    Thanks

    • @HariWiguna
      @HariWiguna  8 місяців тому

      Thanks. Unfortunately, the analogwrite function does not actually outputs a variable voltage. Despite having the word "analog" in the command, it actually pulses 5V at varying speed. Also, as far as I know, most commercial keyboards do not use this analog method but instead uses a digital matrix (more pins, but more accurate).
      www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/

  • @arntor8353
    @arntor8353 Рік тому

    So pro.

  • @Sanchees3
    @Sanchees3 7 років тому

    Nice video ! Would it be possible to incorporate servos into the code to perform certain actions ? I.E. if button '5' is pressed, only 3 out the 5 servos will turn to a position. I'm still fairly new to Arduino and coding so my skills aren't great, thanks !

    • @HariWiguna
      @HariWiguna  7 років тому

      Thanks Sanchees3!
      Yes, you certainly can do that. While you cannot use this code directly (it is tied to the whole Sudoku code) you might learn from it while writing your version. Once you are able to detect a key, then what you trigger with that key could be anything. Let me know if you have specific questions, I'd be happy to help.
      github.com/hwiguna/HariFun_Mega_Sudoku/blob/master/Seven_Segment_Sudoku/e_Keypad.h

  • @javana9940
    @javana9940 3 роки тому

    Does anyone know how they would go about using comparators to determine which key is pressed, rather than an Arduino?

  • @falconhawker
    @falconhawker 2 роки тому

    That is why binary logic exists to "defeat" most the noise from 16 level logic.

  • @raimondsrozentals72
    @raimondsrozentals72 4 роки тому

    I Rekomend !

  • @fanaristotle
    @fanaristotle Рік тому

    I've built a couple of projects using similar types of matrix keypads. I think you have a great design that I'm going to experiment with, I do have one question having to do with electrostatic discharge. One of my designs had a 4 X 4 matrix keypad that was mounted on top of a metal enclosure that contained all of the electronics . I originally did not have any ESD current limit resistors or RC circuits to help isolate the inputs on the micro-controller from ESD. I ended up having the several micro-controllers fried by static discharge coming from people that came in contact with the keypad and discharged it into the electronics by depressing keys on the keypad. What do you think could be done to your design to prevent this from occurring?

    • @HariWiguna
      @HariWiguna  Рік тому

      Tom, sorry I do not have any experience suppressing ESD. Sounds like you know more about it that I do :-)

  • @akanghadibatam7285
    @akanghadibatam7285 7 років тому

    Great, very clear tutorial. By the way "HARI WIGUNA" is Indonesia names, is it?

    • @HariWiguna
      @HariWiguna  7 років тому

      Hello Akang,
      You are correct, Hari Wiguna is an Indonesian name. I was born in Jakarta, but I've lived in USA since I've I graduated high school.
      Glad you like this video. Thank you for your kind words.

  • @dummydummy3388
    @dummydummy3388 7 років тому +1

    sir can you share the schematic of your ckt?? thank you in advanced

  • @tamgaming9861
    @tamgaming9861 6 років тому

    Can you show us how to make a lcd menu with this?

  • @candrasniper3404
    @candrasniper3404 2 роки тому

    It's gonna be a problem when the resistor value has been reduced by time of use.

  • @alphabeets
    @alphabeets 7 років тому

    Curious... is it possible with this method to read multiple simultaneous buttons? Can I get a unique voltage for any combination of multiple button presses? Or it is only for reading one button at a time? Thanks.

    • @HariWiguna
      @HariWiguna  7 років тому

      No, this trick would NOT work if you press more than one button :-(
      The resistors have been chosen such that pressing ONE button would generate unique resistor ladder. Pressing multiple buttons would very likely end up generating non-unique resistor ladder, hence two different set of buttons ending up with very similar outputs.

  • @user-oz2is5tf2o
    @user-oz2is5tf2o 7 років тому

    thanks for the video Hari
    ??? do you know how I can make a PassWord change, using a keyPad and Arduino programme
    and thanks again

    • @codewithlenny
      @codewithlenny 5 років тому

      You can use the Arduino password library that handles passwords.

  • @denisfrancoeur5971
    @denisfrancoeur5971 7 років тому

    I finally hooked up the keypad as you described. But all my threshold values are totally opposite of yours. The ('1') has 562 instead of 2 and my (''D') has the value of 2 instead of your 556. But the reading of all the keys are accurate. Can you explain this funny result? By the way do you have an idea to interface 4 BCD thumbwheels switches (16 inputs) to Arduino without using less inputs.
    Thank you

    • @HariWiguna
      @HariWiguna  7 років тому

      Sounds like you have the columns wired in reverse. It does not matter, just as long as the values are unique. Just make sure the two arrays are in sync.
      As far as the BCD switches, if you're willing to use 4 pins for each digit, it's pretty straightforward. Something like this should work (untested code ):
      pinMode(d0b0,INPUT_PULLUP);
      pinMode(d0b1,INPUT_PULLUP);
      pinMode(d0b2,INPUT_PULLUP);
      pinMode(d0b3,INPUT_PULLUP);
      d0Value = 15 - digitalRead(d0b0) + digitalRead(d0b1)*2 + digitalRead(d0b2)*4 + digitalRead(d0b3)*8;
      Do the above three more times for the other digits.

  • @cerealtech4138
    @cerealtech4138 3 місяці тому

    I love this, but what if you press multiple buttons simultaneously ?

    • @HariWiguna
      @HariWiguna  3 місяці тому

      This circuit would not work properly when you press more than one button. Detecting simultaneous button press require multiplexing.

  • @carmelapulanco9534
    @carmelapulanco9534 5 років тому +1

    Sir how can I convert the values of keypad[i] to 'int' for me to save it to eeprom. By the way I'm making a lcd menu and I want to retain the values that I pressed even if I'm in another screen.

    • @danielgago-sk
      @danielgago-sk 5 років тому

      Int x= (keypad[i]); is OK?
      (When is by Start defined x (int x;), then is good only x= (keypad[i]); And in x is value of keypad[i].
      I think that value can by in EPROM written direcktly, try it:
      EEPROM.write(x, (keypad [i])); x is Number for byte in Eprom.

  • @denisfrancoeur5971
    @denisfrancoeur5971 7 років тому

    I make a mistake, because I'm french and not completly bilingual. I should have written less inputs instead of " without using less inputs.". So what I need it is 'digitalRead' individually 4 BCD thumbwheel switches without using 16 inputs. I tried to imagine a matrix like the 4X4 keypad but it does not works because but some rows or columns may have many binary values at the same time.

    • @HariWiguna
      @HariWiguna  7 років тому

      Ah... I see. That's a cool idea actually. I found this article:
      www.instructables.com/id/A-simple-4-channel-adjustable-current-source/?ALLSTEPS
      They're using it to control current, but I think by adding one resistor to positive, then you'll have a voltage divider and be able to read the combined resistors using one Arduino pin just like what I did with the keypad. Keep me updated. I think this is interesting. Thx for the comment.

  • @ianniculescu1625
    @ianniculescu1625 7 років тому

    very useful, thank you very much. But th'ere's one thing that i still don't understand. Why do you put a capacitor just befor the A0 pin (between the vcc, and the A0 pin) and why do you connect it to the ground.

    • @HariWiguna
      @HariWiguna  7 років тому +1

      Thanks for the comment Ian! The capacitor is actually not at vcc, it is on the output of the voltage regulator. Its purpose is to smooth out the noisy keypad switches.

    • @CurmudgeonExtraordinaire
      @CurmudgeonExtraordinaire 6 років тому

      The capacitor is being used as a hardware implementation of a debounce function. Write a piece of code that constantly displays whether the button is pressed or not. Press the button and watch what gets displayed. It won't just go from pressed to non-pressed, it will bounce around a bit when it changes state. The capacitor helps even this out. If you put too large of a capacitor in it though, it will take longer for the button presses to be recognized.

  • @jeetshah6554
    @jeetshah6554 7 років тому

    I have some questions in mind.
    1)Can we use nay resistor values?
    2)I am not able to see properly on how you connected the circuit on the breadboard.I am little bit weak on connecting circuit at breadboard.Please help me.

    • @HariWiguna
      @HariWiguna  7 років тому

      Hello Jeet,
      1. You can use other resistor values, but their ratios are critical for it to work. Remember what we're doing is building a voltage divider with variable resistance on the bottom resistor controlled by which button is pressed. The maximum total resistance of the bottom resistor should be approximately the same of the top resistor. As you press the different columns, the resistance value should change gradually, as you press different rows, the resistance value should change in larger increment so we would be able to tell the difference between rows and columns.
      2. In the video, when I discuss the schematic diagram, the rows and columns are clearly marked. If you're not yet familiar with how breadboard is wired internally, this video might help:
      ua-cam.com/video/6WReFkfrUIk/v-deo.html
      I hope that helps.

  • @juanitoco7018
    @juanitoco7018 2 роки тому +1

    Hi, hari. Could the capacitor no be a 0.01 uF (10 nF)? Can it be 0.1 uF or 6.8 nF?

    • @HariWiguna
      @HariWiguna  2 роки тому +1

      6.8nF should work.
      As I mentioned in the video, the 390 ohm resistor and 0.01uF cap debounces the often noisy switch.
      You could probably even eliminate the capacitor if your switch is not too noisy and/or you added code to do debouncing in code.

  • @sergiu2155
    @sergiu2155 4 роки тому

    i want a schematic with the resistors you've used please

    • @HariWiguna
      @HariWiguna  4 роки тому

      Sorry, I no longer have the file, but you could see the schematic in the video at 2:11

  • @denisfrancoeur5971
    @denisfrancoeur5971 7 років тому

    Amazing. But tell me how you obtain the threshods values, Explain me the '2' and '556'.....

    • @HariWiguna
      @HariWiguna  7 років тому

      While it is be possible to compute those values, I measured them one at a time using the Arduino.
      At about minute 3:16 I showed how I obtained a few of the analog values. I just repeat that procedure for all 16 values.

  • @lukider11
    @lukider11 7 років тому

    how would you make this ESP8266 compatible. What Resistor would you change to bring the Max Voltage down to 1V?

    • @HariWiguna
      @HariWiguna  7 років тому

      That's a fantastic idea! The ESP does not have many I/O pins, and one Analog pin.
      I used this calculator:
      www.raltron.com/cust/tools/voltage_divider.asp
      I put in 3.3V as the input supply, leave the top resistor blank, retained the 3x390 and 3x1.5K bottom resistors, 1V for the desired output, and it came up with 13041 for the top resistor. So 13K resistor instead of 4.7K for the top resistor. Let me know how it turns out in real life :-)

  • @yxhankun
    @yxhankun 5 років тому

    what will be the values if I used 3.3 V input under ESP32 mcu?
    int thresholds[16] = {2, 77, 144, 202, 244, 290, 331, 368, 394, 434, 454, 477, 496, 518, 538, 556};

    • @HariWiguna
      @HariWiguna  5 років тому

      At 3:15 in the video, I shared a short sketch that I used to find those values. Just do the same for your 3.3V circuit. Hmm, I just remembered that the old ESP8266 only measures up to 1V. I'm not sure if the ESP32 suffers from the same limitation. If it does, you would need to adjust the top resistor such that the maximum output of the ladder is 1V instead of 3.3V.

  • @stealth9842
    @stealth9842 7 років тому

    +Hari Wiguna, I'm trying to use this to get a 3 digit number. Any tips?

    • @HariWiguna
      @HariWiguna  7 років тому

      There are many ways. I would use two integer variables: temp and result. Upon detecting a digit keypress do this: temp = temp*10 + k where k is the value of that key. When the "enter" key is pressed then copy temp to result and clear temp. We probably also want to clear temp when it becomes larger than 999 such is the case when they tap four or more digits before hitting "enter".

  • @jonasgilje1645
    @jonasgilje1645 7 років тому

    So I guess it would not behave well with multiple keypresses in a keyboard application. By the way, what program did you use for creating those schematics? Thanks.

    • @HariWiguna
      @HariWiguna  7 років тому

      Hi Jonas,
      You are correct, pressing multiple key presses probably generate non-unique voltages or too small a change to be detected reliably. :-(
      I used EasyEDA.com to draw the schematic, use its export to SVG feature, then magnified the SVG at 150% to fill the page.

    • @jonasgilje1645
      @jonasgilje1645 7 років тому

      Hari Wiguna Good thing you have that while loop that makes prevents that from happening. Currently working on a 40 key bluetooth mechanical keyboard, where I'm using 14 I/O pins, and was at first a little blown away by how much you achieved with just one analog input.

  • @aryanbhosale9254
    @aryanbhosale9254 3 роки тому

    Hi hari wiguna help please,I am making my keyboard with spst buttons and If I make several keyboards like it ,will it have same analog values? Like you had 1/2 for number 1 ?

    • @HariWiguna
      @HariWiguna  3 роки тому

      HI Aryan, The analog values depend on the resistors you use. If you get the resistors from the same batch and you adjust the slop in the code to be as large as possible then it should work. But you will have to check your analog values yourself. The chance of my analog values be perfect with your resistors is small.

  • @aldenpinto389
    @aldenpinto389 6 років тому

    I'm getting the ASCII values of the characters on the serial monitor - is it coz I used 220 ohm instead of 390 & 1k instead of 1.5k? If so, why?

    • @gideonferrier4168
      @gideonferrier4168 6 років тому

      it is because of your code.

    • @aldenpinto389
      @aldenpinto389 6 років тому

      gideon ferrier... Yes small mistake, I declared my symbol array as int rather than char 😂

  • @misticace95
    @misticace95 Рік тому

    I tried duplicating this in tinkercad and it isnt outputting anything. I copied the code too and thought my wires are correct. only thought could be wrong orientation of the resistors?

    • @HariWiguna
      @HariWiguna  Рік тому

      I wasn't aware that TinkerCad has an Arduino simulator, so I wired up the circuit. Everything works as I expected except for the first column (1,4,7,*) all acts as if I'm pressing *. When no buttons are pressed it should return 1023 too.
      I wonder if the keypad component has a bug in it. I'll play more with this later and let you know if I discover anything else.
      Anyway, thanks for the question.
      www.tinkercad.com/things/5YWqan9lh8H-neat-esboo/editel?sharecode=o6MB5FGBJq0Q0EjU1emoxm19kzj5LjFq31JzCpDEB50

  • @filipporiva1864
    @filipporiva1864 6 років тому

    I get a lot of random values and after I finally get a stable value the second time I press it it't -10 than before

    • @HariWiguna
      @HariWiguna  6 років тому

      Filippo, I think your comment got cut off. I do not understand what you're saying/asking. Sorry...

    • @filipporiva1864
      @filipporiva1864 6 років тому

      for example I got 180 for “1” the first time, then after checking every value one time I checked it another to be sure and got 170, also some times if I hold a button it shows completely random values

    • @filipporiva1864
      @filipporiva1864 6 років тому

      Idk why this happens

    • @HariWiguna
      @HariWiguna  6 років тому

      Ah, yes, membrane switches are not perfect, so there will be some variation, on my switch it only varies by about 2 or 3, so I set my tolerance to 4, see line 87 on this listing:
      github.com/hwiguna/HariFun_Mega_Sudoku/blob/master/Seven_Segment_Sudoku/e_Keypad.h
      You probably need to set that to 15 to account for the difference between 170 and 180. For each key it would vary, but should NOT be random.
      Also make sure you do not set that tolerance too large. It should leave enough room between the values in threshold array.

  • @manassehabraham5589
    @manassehabraham5589 2 роки тому

    🤯

  • @monaemhossaintipu9257
    @monaemhossaintipu9257 5 років тому

    Why I need capacitor?what is his task?
    TIA

    • @HariWiguna
      @HariWiguna  5 років тому +1

      I suspect it was for switch debouncing. So the voltage would not fluctuate like crazy as the buttons are pressed. But I end up checking for button release in code anyway, so it is probably no longer necessary.

  • @harshitvarshney3375
    @harshitvarshney3375 7 років тому

    This is awesome..one pin onlyyyyy.....but the only problem i am getting is my reading are not stable as yours..mine r varying..even i m using a capacitor too as u..even if i dont press any key it fluctuate from 1010 to 10233.. can u help

    • @HariWiguna
      @HariWiguna  7 років тому

      With no buttons pressed, the bottom part of the voltage divider should be open, and the 4K7 resistor should bring the analog pin to 5V and report 1023. I wonder if one of the membrane switches is stuck?

    • @harshitvarshney3375
      @harshitvarshney3375 7 років тому

      No..i think its not..bcz when i using same resistor as you i am getting stable readings and if i multiply each resistor by 10 then it becomes unstable..so it looks like high resistance values r the problems...but why??
      i don't know..

    • @bullzebub
      @bullzebub 6 років тому

      higher resistances = lower voltages. so you are probably so low that the arduino barley can register the voltages.

  • @michaelrector1496
    @michaelrector1496 4 роки тому

    how would it interpret 2 keys hit at the same time

    • @HariWiguna
      @HariWiguna  4 роки тому

      This method would mess up if you press more than one button. To read multiple simultaneous keypress you will need to dedicate more Arduino pins. To read a 4x4 keypad you will need four outputs and four inputs.

    • @michaelrector1496
      @michaelrector1496 4 роки тому

      @@HariWiguna thank you

  • @abrahancolmann6693
    @abrahancolmann6693 3 роки тому

    I didn't understand what the for does, mostly because of the "i", it starts in 0 so wouldn't it be in 2 at the begining ?

    • @abrahancolmann6693
      @abrahancolmann6693 3 роки тому

      And every time it executes, just going from "1" to "D", thats what i understand when seeing it though i know thats not how it works, just confuses me

    • @HariWiguna
      @HariWiguna  3 роки тому +1

      The "for" loop changes the value of i from 0, to 1, 2, 3, etc till 15.
      The IF statement on line 19 uses "i" to access the threshold values. First it would check against thresholds[0], then threshold[1], etc.
      If the difference between the real analog value and the threshold is close enough (within 5), THEN it would do the code between lines 21 and 25.
      Otherwise, the "for" loop tries the next "i" which would test the next threshold[i].
      I hope that helps.

    • @abrahancolmann6693
      @abrahancolmann6693 3 роки тому +1

      @@HariWiguna Thank you for clearing my doubt, it was truly helpful

  • @raa9774
    @raa9774 6 років тому

    Hello sir. I'm trying to make a keypad but in a array form and only the first value is recognized, others don't show. Can you help me please?

    • @HariWiguna
      @HariWiguna  6 років тому

      Rigers Alvora , what do you mean it doesnt show? Even if there is an issue, analog read will always return something.

    • @raa9774
      @raa9774 6 років тому

      i am making a project that involves a tft display and an bunch of buttons which i want to use for a combination. if the combination is correct the tft display will show some photos, but the number of pins that i have free is only one, the analog pin A5. that pin i wanted to use for my project but i cannot find any code that make my buttons like switches

    • @HariWiguna
      @HariWiguna  6 років тому

      You have the right idea. Using the resistor ladder as shown in the video would be a way to read a grid of switches using one analog pin.
      You said it recognized the first button, so that meant you have the correct A5 pin wired and configured in the sketch.
      Next is to check the wiring and parts. Make sure the resistance values are as close as I mention in the video. Sum of the three smaller value resistors (390) must be less than the large value resistor (1.5K). You cannot use just any resistor.
      And finally, you need to read the value for each button and put it in the array as shown in the video. This is because any variation in the resistors would affect the analog value reading.
      Hey, I just thought of another possible issue. Have you measure the resistance of the grid switch itself? Maybe yours have a high resistance? This circuit would only work if the switches are basically zero ohm when pressed. Otherwise, it would interfere with the resistor ladder. :-(

    • @raa9774
      @raa9774 6 років тому

      Well sort off i connected every button with 390 ohm resistors. i used a count integer for the button press and a memory integer for the sum of the analog value like a condition for showing the photos. My only question is how i can make an else condition for showing random sentences like: "You are wrong", or "try it again" to show it in the tft display. Thank you for your time.

  • @dalviringh371
    @dalviringh371 3 роки тому

    circuit please

    • @HariWiguna
      @HariWiguna  3 роки тому

      Sorry, I no longer has electronic copy of the circuit, but you can see it clearly in the video:
      ua-cam.com/video/G14tREsVqz0/v-deo.html

  • @hitler69
    @hitler69 6 років тому

    what happens when i press multiple keys?

    • @HariWiguna
      @HariWiguna  6 років тому

      Pressing multiple keys would yield unreliable results. Depending on which keys and how many was pressed, the composite resistance would be misinterpreted as ONE of the keys -- most likely none of the keys that you actually pressed.

    • @bullzebub
      @bullzebub 6 років тому

      it might be possible to make so you can press multiple keys if you use different resistors on each row/col. but you must calculate so each combination isnt the same as any other.... might be hard!

    • @HariWiguna
      @HariWiguna  6 років тому

      Hi Peter! I think there would be way too many multiple key combinations that would generate the same resistance when you press two, three, or more buttons. Good thinking, but as you said, it would be hard. :-) Thx for leaving a comment!

  • @3000mi_away
    @3000mi_away 3 роки тому +1

    Im not getting a stable read.. help

    • @HariWiguna
      @HariWiguna  3 роки тому +1

      1. Since this is analog, it is inherently imprecise. That's why I suggested getting the values and then making the code tolerant of the slight variations.
      2. Make sure that the input voltage is stable. Are there high current outputs being involved? you may need to power those from a separate supply rather than the Arduino 5V so the input to the resistor ladder would remain stable.
      3. This is a hack. It should only be used when you cannot afford the I/O pins.
      The proper way to read a keypad is to use row column matrix to scan the keypad. Uses more Arduino pins, but 100% reliable.

    • @3000mi_away
      @3000mi_away 3 роки тому

      @@HariWiguna
      Thanks man.. the values are just too bad.. sometimes im getting same values on different keys.. and im running out of arduino pins(uno)...
      I'll try to power up the arduino with 9v.. im using a laptop so maybe the input voltage is not stable

    • @3000mi_away
      @3000mi_away 3 роки тому

      And also the values im getting are way too far from what you got

    • @HariWiguna
      @HariWiguna  3 роки тому +1

      @@3000mi_away, I've just thought of another possible cause. Please measure the switch resistances on the keypad. Just try a few of them to make sure they're very close to zero. Some keypad uses carbon pads instead of actual metal to metal connection so it has a relatively high resistance and probably also pressure sensitive. The harder you press the lower resistance. You could try using higher resistor ladder values to make these variations less significant.
      Good luck!

    • @3000mi_away
      @3000mi_away 3 роки тому

      Thanks man ..ill try that

  • @mrjepara1979
    @mrjepara1979 5 років тому

    Bos. How to find this number 2,77,144,202,244,290,331,368,394,424,452,477,496,518,538,556 ?
    Terima Kasih

    • @HariWiguna
      @HariWiguna  5 років тому

      At 3:44 you can see that pressing each button shows a different value. Press each and write down the value. Your values will be slightly different due to the variations on resistors. That is how I got those numbers.

    • @mrjepara1979
      @mrjepara1979 5 років тому

      Hari Wiguna If i press, example for number 1 this value 2043 or number 2 = 1463
      int thresholds[16]={2043,1463,7823,23,3713,3343,2943,2483,4813,4563,4293,3993,5603,5423,5223,5013};
      while (analogRead(A0)

    • @mrjepara1979
      @mrjepara1979 5 років тому

      Oooo sorry bos... im mistake for my note value
      Terima Kasih Banyak My Big Bos

    • @HariWiguna
      @HariWiguna  5 років тому

      The maximum value returned by analogRead is 1023. Where are you getting 2043 and 1463 ?!
      www.arduino.cc/reference/en/language/functions/analog-io/analogread/www.arduino.cc/reference/en/language/functions/analog-io/analogread/