HariFun

  Рет қаралды 48,726

Hari Wiguna

Hari Wiguna

Күн бұрын

Пікірлер: 192
@Triple8_by_RLC
@Triple8_by_RLC 9 ай бұрын
I was scratching my head just now. took me two days wrestling around this keypad problem until i saw your tutorial.
@raagamparmar179
@raagamparmar179 5 жыл бұрын
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!
@nosuchthing4789
@nosuchthing4789 6 жыл бұрын
Best approach is ALWAYS through practical example. Thx!
@shinevisionsv
@shinevisionsv 7 жыл бұрын
Thats the smartest thing i've seen today! Big thanks and Hats down to you sir.
@HariWiguna
@HariWiguna 7 жыл бұрын
Thank you for the kind words. Much appreciated. :-)
@ashleyhouse9690
@ashleyhouse9690 7 жыл бұрын
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!
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
I like the basic idea. Very creative!
@HariWiguna
@HariWiguna 8 жыл бұрын
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 7 жыл бұрын
Yeah but you implemented it and explained it fantastically! Thankx to you it saved me! Your awesome
@anthonyrossetti7509
@anthonyrossetti7509 7 жыл бұрын
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
@hstrinzel
@hstrinzel 3 жыл бұрын
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. :)
@tensor131
@tensor131 3 ай бұрын
The solution using an i2c is hand waving magic that I don't really understand. I like to understand what my circuits are doing and I do know Ohm and Kirchhoff so this is fully comprehensible - thank you for this ingenious solution.
@GenuineSoundware
@GenuineSoundware 7 жыл бұрын
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.
@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!
@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.
@TRFrench
@TRFrench 8 ай бұрын
That was brilliant. you've saved my life!
@ranieldenicen.marpuri6544
@ranieldenicen.marpuri6544 5 жыл бұрын
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!
@DrSynthDevices
@DrSynthDevices Жыл бұрын
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 Жыл бұрын
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/
@siddharth_pasupuleti
@siddharth_pasupuleti 2 жыл бұрын
i think my brain finna explode from how genius this is
@j3_
@j3_ 8 жыл бұрын
Every video you come to surpass the previous ... congratulations !!
@HariWiguna
@HariWiguna 8 жыл бұрын
I will work hard to continue that trend. Thank you very much!!!
@adaltonsantos9687
@adaltonsantos9687 2 жыл бұрын
Very good man. Really a smart idea!
@myksmith
@myksmith 4 жыл бұрын
Great example. I would totally buy this component addition to the keypad!
@SamBatti88
@SamBatti88 Жыл бұрын
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 ?
@gabrielcocenza
@gabrielcocenza 7 жыл бұрын
It works like a charm! Thank you for sharing.
@rajatsaxena1990
@rajatsaxena1990 8 жыл бұрын
Exceptional logic. Really great !!
@HariWiguna
@HariWiguna 8 жыл бұрын
Thanks Rajat!
@LunguCalin
@LunguCalin 8 жыл бұрын
Can't wait to see the finished product ! Nice video , clear explanations congratulations
@HariWiguna
@HariWiguna 8 жыл бұрын
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. :-)
@nobody2.076
@nobody2.076 7 жыл бұрын
OMG!!! This is so incedible smart! Its also so simple but so smart! I still can´t belive it... Thank you so much!
@StevenLawler
@StevenLawler 5 жыл бұрын
It's a good idea. It only allows one button to be pressed at a time though.
@SpencerSkelly
@SpencerSkelly 6 жыл бұрын
Great walk through the concept. Thanks for sharing your work.
@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
@Enigma758
@Enigma758 4 жыл бұрын
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 4 жыл бұрын
Really? how do they do it with a digital pin? Charge a capacitor?
@Enigma758
@Enigma758 4 жыл бұрын
@@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 4 жыл бұрын
@@Enigma758 Wow. That's crazy. Thx for explaining that to me.
@evonite841
@evonite841 9 ай бұрын
Very good presentation
@HariWiguna
@HariWiguna 9 ай бұрын
Thank you!
@robjohnson7024
@robjohnson7024 7 жыл бұрын
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 7 жыл бұрын
That's awesome Rob! Thanks for sharing your story!
@Coffee-hh6we
@Coffee-hh6we Ай бұрын
this one was really cool, thanks
@cameroncharlebois7331
@cameroncharlebois7331 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 жыл бұрын
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.
@MkmeOrg
@MkmeOrg 8 жыл бұрын
Well done Hari! Thumbs up as always. Great work
@HariWiguna
@HariWiguna 8 жыл бұрын
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 8 жыл бұрын
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 8 жыл бұрын
Oh, I remember seeing your Audacity video before. I'll have to re-watch and apply it. Thanks Eric!
@MkmeOrg
@MkmeOrg 8 жыл бұрын
Hari Wiguna No prob at all Bud. Cheers
@robinsonprofis7501
@robinsonprofis7501 5 жыл бұрын
Really nice and simple explanation! Keep the good work an nice videos coming!👍
@dummydummy3388
@dummydummy3388 7 жыл бұрын
sir can you share the schematic of your ckt?? thank you in advanced
@aswahd
@aswahd 6 жыл бұрын
really cool! I'm looking forward to another amazing video👍️👍️
@ChunkySteveo
@ChunkySteveo 8 жыл бұрын
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 8 жыл бұрын
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!
@juanitoco7018
@juanitoco7018 2 жыл бұрын
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 жыл бұрын
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.
@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 :-)
@javana9940
@javana9940 3 жыл бұрын
Does anyone know how they would go about using comparators to determine which key is pressed, rather than an Arduino?
@zeffofx
@zeffofx 8 жыл бұрын
Thanks to this!, I could save a lot of pins because of this trick.
@HariWiguna
@HariWiguna 8 жыл бұрын
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 :-)
@sahrulramadhan1967
@sahrulramadhan1967 2 жыл бұрын
This is Genius !!
@carmelapulanco9534
@carmelapulanco9534 6 жыл бұрын
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 6 жыл бұрын
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.
@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 жыл бұрын
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!
@denisfrancoeur5971
@denisfrancoeur5971 8 жыл бұрын
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 8 жыл бұрын
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.
@XerotoLabs
@XerotoLabs 8 жыл бұрын
way cool . love the way you explained that .
@HariWiguna
@HariWiguna 8 жыл бұрын
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 8 жыл бұрын
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
@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.
@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.
@TheTurnipKing
@TheTurnipKing 8 жыл бұрын
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 8 жыл бұрын
That's a great idea! I'll have to try that. Thanks!!!
@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.
@mankee2211
@mankee2211 8 жыл бұрын
beautiful breadboardOnAbreadboard / test setup :)
@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
@tamgaming9861
@tamgaming9861 6 жыл бұрын
Can you show us how to make a lcd menu with this?
@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: kzbin.info/www/bejne/bIi1lnmhm9eIf80 I hope that helps.
@Wookie.De.v
@Wookie.De.v 8 жыл бұрын
how would you make this ESP8266 compatible. What Resistor would you change to bring the Max Voltage down to 1V?
@HariWiguna
@HariWiguna 8 жыл бұрын
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 :-)
@cerealtech4138
@cerealtech4138 8 ай бұрын
I love this, but what if you press multiple buttons simultaneously ?
@HariWiguna
@HariWiguna 8 ай бұрын
This circuit would not work properly when you press more than one button. Detecting simultaneous button press require multiplexing.
@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".
@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 жыл бұрын
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 7 жыл бұрын
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.
@عبدالعاليجوا
@عبدالعاليجوا 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.
@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.
@misticace95
@misticace95 2 жыл бұрын
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 2 жыл бұрын
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
@denisfrancoeur5971
@denisfrancoeur5971 8 жыл бұрын
Amazing. But tell me how you obtain the threshods values, Explain me the '2' and '556'.....
@HariWiguna
@HariWiguna 8 жыл бұрын
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.
@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
@RyanJosephLong
@RyanJosephLong 8 жыл бұрын
Amazing! I would hire you!
@candrasniper3404
@candrasniper3404 2 жыл бұрын
It's gonna be a problem when the resistor value has been reduced by time of use.
@abrahancolmann6693
@abrahancolmann6693 4 жыл бұрын
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 4 жыл бұрын
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 4 жыл бұрын
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 4 жыл бұрын
@@HariWiguna Thank you for clearing my doubt, it was truly helpful
@denisfrancoeur5971
@denisfrancoeur5971 8 жыл бұрын
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 8 жыл бұрын
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.
@aldenpinto389
@aldenpinto389 7 жыл бұрын
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 7 жыл бұрын
it is because of your code.
@aldenpinto389
@aldenpinto389 7 жыл бұрын
gideon ferrier... Yes small mistake, I declared my symbol array as int rather than char 😂
@raa9774
@raa9774 7 жыл бұрын
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 7 жыл бұрын
Rigers Alvora , what do you mean it doesnt show? Even if there is an issue, analog read will always return something.
@raa9774
@raa9774 7 жыл бұрын
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 7 жыл бұрын
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 7 жыл бұрын
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.
@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 жыл бұрын
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.
@jonasgilje1645
@jonasgilje1645 8 жыл бұрын
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 8 жыл бұрын
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 8 жыл бұрын
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.
@3000mi_away
@3000mi_away 4 жыл бұрын
Im not getting a stable read.. help
@HariWiguna
@HariWiguna 4 жыл бұрын
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 4 жыл бұрын
@@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 4 жыл бұрын
And also the values im getting are way too far from what you got
@HariWiguna
@HariWiguna 4 жыл бұрын
@@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 4 жыл бұрын
Thanks man ..ill try that
@falconhawker
@falconhawker 2 жыл бұрын
That is why binary logic exists to "defeat" most the noise from 16 level logic.
@Skeletal_Interface
@Skeletal_Interface 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.
@Skeletal_Interface
@Skeletal_Interface 4 жыл бұрын
@@HariWiguna thank you
@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 7 жыл бұрын
higher resistances = lower voltages. so you are probably so low that the arduino barley can register the voltages.
@monaemhossaintipu9257
@monaemhossaintipu9257 6 жыл бұрын
Why I need capacitor?what is his task? TIA
@HariWiguna
@HariWiguna 6 жыл бұрын
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.
@MiggyManMike
@MiggyManMike 8 жыл бұрын
That's ingenious :)
@HariWiguna
@HariWiguna 8 жыл бұрын
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
@robimaulidana4683
@robimaulidana4683 Жыл бұрын
Wow thats amazing
@akanghadibatam7285
@akanghadibatam7285 8 жыл бұрын
Great, very clear tutorial. By the way "HARI WIGUNA" is Indonesia names, is it?
@HariWiguna
@HariWiguna 8 жыл бұрын
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.
@djluchocrescente
@djluchocrescente 8 жыл бұрын
Excellent, Thank you!!!
@AntonioSouza
@AntonioSouza 8 жыл бұрын
Very cool!
@filipporiva1864
@filipporiva1864 7 жыл бұрын
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.
@dalviringh371
@dalviringh371 4 жыл бұрын
circuit please
@HariWiguna
@HariWiguna 4 жыл бұрын
Sorry, I no longer has electronic copy of the circuit, but you can see it clearly in the video: kzbin.info/www/bejne/fWKXpYV7qLuksJI
@gigunit100
@gigunit100 6 жыл бұрын
you are the best man
@HariWiguna
@HariWiguna 6 жыл бұрын
oh, you are too kind. Thank you for leaving a comment. :-)
@vandanagupta7831
@vandanagupta7831 7 жыл бұрын
You are great sir
@HariWiguna
@HariWiguna 7 жыл бұрын
Thank you. You are kind and generous sir!
@RazoQuinnvanBerkel
@RazoQuinnvanBerkel 7 жыл бұрын
Thanks, it helped alot!
@HariWiguna
@HariWiguna 7 жыл бұрын
Awesome! Thanks for leaving a comment!
@bibel2k
@bibel2k 5 жыл бұрын
Amazing !
@mrjepara1979
@mrjepara1979 6 жыл бұрын
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 6 жыл бұрын
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 6 жыл бұрын
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 6 жыл бұрын
Oooo sorry bos... im mistake for my note value Terima Kasih Banyak My Big Bos
@HariWiguna
@HariWiguna 6 жыл бұрын
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/
@avejst
@avejst 6 жыл бұрын
Thanks for sharing :-)
@raimondsrozentals72
@raimondsrozentals72 4 жыл бұрын
I Rekomend !
@infotechoverloaded721
@infotechoverloaded721 2 жыл бұрын
Genius
@francoisgagnon4467
@francoisgagnon4467 Жыл бұрын
Neat!
@arntor8353
@arntor8353 2 жыл бұрын
So pro.
@manassehabraham5589
@manassehabraham5589 3 жыл бұрын
🤯
Pin Change Interruptions ISR | PCINT | Arduino101
14:19
Electronoobs
Рет қаралды 59 М.
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 20 МЛН
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 40 МЛН
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 7 МЛН
3 engineers race to design a PCB in 2 hours | Design Battle
11:50
Predictable Designs
Рет қаралды 450 М.
Instructions - Button Matrix
12:47
Real Robots
Рет қаралды 60 М.
Building a MIDI Controller Using Arduino
15:41
Switch & Lever
Рет қаралды 643 М.
Making Custom Macro Keypad
6:21
Pithy Builds
Рет қаралды 250 М.
How connect multiple switches to one pin, Arduino?
17:26
MEC DER
Рет қаралды 18 М.
Practical Guide to PCF8574: Adding Extra Pins for Arduino
16:46
Mario's Ideas
Рет қаралды 8 М.
Radio-Frequency (RF) Communication Modules
28:38
Playful Technology
Рет қаралды 97 М.
4x4 Keypad am Arduino - Servo mit Pincode steuern - Tutorial
13:36
Makerblog.at - Arduino & Co
Рет қаралды 40 М.
How to Use Arduino Interrupts The Easy Way
33:28
Rachel De Barros
Рет қаралды 92 М.