 Hey, hello, and welcome to the show. It's me John Park. It's time for another episode of John Park's Workshop. No It's time for another episode of JP's product pick of the week. It's Tuesday Sorry, as you can probably hear from my voice. I had a little cold. I'm a little loopy from that still apparently I'm gonna have a nice sip of water here. Hold on one second off to a roaring start Tackle the world. I would love to reenact the matrix playing all of the parts. That would be a lot of fun so Here we go before I go any further today with the product pick first of all I want to let you know that you can head to The product page by using that QR code or that URL right there and that will get you a huge huge Wapping discount on this week's product pick. I believe it's 50% off this week. I'm gonna go verify that myself It sure is and thanks to jelly For catching that we almost had The wrong product in their fault of my own. We have two very similar products But this is the newer one of the two. So thanks jelly So head on over there. You can throw it in your cart. There's no need for coupon code maximum of 10 per customer and But before I talk about it, I'm gonna have lady Ada Introduce this product. So take it away lady Ada The TCA 84 1 8 Breakout board which I'm really excited about because we started this design in 2020 And the chip was completely unavailable and then it became available So we are able to Finally stock of this really interesting G pair expander and keypad matrix driver so It is an 18 GPIO Expander if you want to just have like 18 inputs outputs with pull-ups, you know and interrupt output Then you can do that but what's interesting about this chip is it also does keypad scanning. So it has 10 columns 8 rows so it can do up to 180 keys and here. I'm just demoing it with a simple 3 by 4 matrix keypad and It has a 10 Element event queue so it can actually that you don't have to pull it constantly if there's key presses It'll record the key matrix presses and releases for you And then you know whenever you get around to ask you know where I scored C. Hey, what key presses did you get? It'll it'll admit those key key codes and whether they were pressed or released and then you can Use it with Arduino or circuit Python. We have drivers for both so you can use it with any microcontroller And then another interesting thing about this chip is it also has a Linux kernel support And so if you happen to be interested in like making a up to 80 key keyboard for a single board computer This driver chip you can load it with into the kernel using a device to overlay you can set up the key map and Then you can use it as a native keyboard built into the kernel, which I think is kind of cool I'm gonna try that out So, yeah, so here are the columns. So there's columns zero through Nine and then the rows are down here There's two up here rows zero one and then through our seven Note that you cannot change the row and column assignment like you can't make a column into a row like There's ten columns eight rows. That's it. And then, you know, I just happened to have a keypad I thought it'd be easy to wire this up. I just wrote a little example that maps the key numbers to digits and displays them and There's also a debouncer built in and of course you can mix and match you can have some GPIO and Some keypad matrices Just again, you know rows and columns are fixed You can't change whether a pin is a row or column whatever it's labeled as is what it is But it's a really nice little chip and does something that I haven't seen a lot of other You know GPIO expander that I know of other than like the HT16 K33 does keypads and even that doesn't Have a nice event queue like this one does Yes, indeed. So here it is inside of my little mysterious box here. We find That's the product pick of the week this week. It is the tca 84 18 Keypad matrix driver and GPIO expander This runs over i2c. So we have two super convenient Stem aqt ports on it also has a couple little mounting holes on there And then it has pins for the columns rows and a couple of extras there for using header pins for your i2c instead So you saw in the example there lady aida had that plugged into a membrane keyboard This will work for pretty much anything you could make 18 GPIO pins to be leds or buttons or switches You could make a huge arcade Button array if you want to using the matrix Scanning that's what gives you that 10 by 8 which means you could have up to 80 keys And it also works really well for of course mechanical keyboard key switches Let me go ahead and jump to the overhead and i'll show you Here's an example of using it with One of our little telephone style. This is the four by four telephone style keypad So it doesn't have to be a matrix a rather it doesn't have to be a membrane can be Actual buttons actual little clicky buttons on here This Normally just has header pins coming out the bottom. I decided to solder the board since the size works out Uh pretty well not perfect, but pretty well To solder if I flip this upside down here Solder the Four columns and two of the row pins and then the extra two I have running since they're on the other side of the board using wires there, but that gives you this sort of neat little Modular keyboard that you can use a little keypad that you can use for different projects I have it plugged in over i squared c Into a perfect recipient for this I think And this was Todd botts suggestions. So thank you. This is a perfect recipient for it This is our trinky if you have a need for a trinky something incredibly small little microcontroller That can be plugged right into your usb port on your computer This will work really well for it. So have the stem of qt i squared c This is acting as these 16 buttons could be up to 80 Using the columns and rows and what i'll do is put one of our little handy dandy adapters on there And plug that into a usb hub so we can Imagine that's the side of your laptop or some other computer that you want to plug into now I have immediate access to this cute little keypad I'm going to give you a little demo of that by jumping over to Let's see Well this one Yeah, that'll pretty much work. Let me pull the Thing off of my face there Whoops Okay, I think I have extra I have an extra keypad on my face today. Let me move this one down here There we go So here you can see i'm in adam where i've coded it and we'll take a look at the code in a second What i'll do is connect to it. I'm going to use disco tool To the trinky And now you can see if I Go ahead and type on the keyboard here. I'm seeing key events show up Depending on which keys I press and release I get different key events. That's what the chip is Recording and then we can use our code to turn that into actual usb key presses So here i'm just going to put in a comment there and then you can see I can get one two three a four five six b seven eight nine c star zero pound d sorry i Typed very messily there. So it looks like the thing doesn't work, right? We do that again four five six b seven eight nine c star zero pound d So that works really well as a usb Input device you could of course always use that for things like midi You could use that not as usb, but just input to the microcontroller itself Forget about usb. You could use it to type in codes to do different things on small displays on lcds Change the color of a neopixel pattern use it to open up a lock using A servo motor or something like that for an escape room or a solenoid. So these are really really handy Another thing you'll notice is that Go ahead and unplug this one. Oh, actually before I do that. Let's let's take a look at the code for this I'll leave that leave that sitting right there So all I need to do the key thing here is import this library We have a really nice neat library both for circuit python and for arduino. It's the tca 8418 library I'm importing that then I set this up over i squared c So you can see here. I have an i squared c bus that's running on the i squared c Stemma port you can also use the second port if it's a rp2040 and then I set up the tca object there over i squared c Here's where we set up which are being used the columns and rows So I have four of the columns in this case four of the rows and this will vary depending On your project up to eight. Sorry up to ten columns and eight rows And then I'm setting all of those pins As keypad mode. So remember we can use this to fire off leds and Read non matrix key switches. That's also possible. But in this case, I'm setting them all up in keypad mode Enabling interrupt and enabling this little q where it Remembers up to ten key presses on the chip itself and then sends them over i squared c the moment i squared c looks for them Now in reality all this happens in about a millisecond So we don't notice any delay with it But it can handle up to ten really really really fast key presses and not lose track Those are going to get sent to over i squared c Then in my main code. I'm just using this tca key int so we check for a key interrupt And then we grab all of the Key presses that are in the q using this events count So we get a count of them however many there are and then we ask okay What's the first second third fourth fifth event in that count? We parse that out to be our presses or releases and which key it is of the in this case 16 that we could be pressing and then in the end in this case i'm sending out a usb But you could do other things with it so i'll show you not only And some of you have seen this before but let me let me switch to another view And you'll see not only can we do little keypads membrane key switches, but here's one where i have six by five Zoom out here Just to give you this still this isn't the full blown eight by ten eighty keys is a lot of keys I'm using two of these in this project so that I can do split Macro keyboard that aren't touching each other with a minimum of wires in there and that's using two i-squared c-buses But here's a case where you can see really clearly Column pins and row pins all heading to my tca 8418 column in a row headers that i've soldered on to there And let's see before i go any further let's hop back over to the site Take that one over there so you can see today This is an incredible price if you head over there You're going to get this for half price two dollars and 98 cents per Up to 10 of them. So if you ever want to do GPio expansion type of projects get a lot of leds or A lot of buttons a lot of switches or any kind of keypad projects. It's a really good one for that So throw those in your cart. There's no coupon code needed If we take a look at the associated learn guide here Oh my gosh, what happened? I think I just I tried to explode my What did I do? Where did I move it to? I tried to explode my broadcast software. It doesn't want to show you the learn guide now Let's see if I can Make it go there from the product page. Yeah, that'll work I dragged something and it totally disappeared. Uh, so thankfully in our product page. We always do have a link Uh to the learn guide Here it is primary guide So there you can see same little demo there from the video It talks about the specs on here gives you the pinouts And I've mentioned this I think before but this has only one i-squared c address So unfortunately the chip was not set up to be used in multiples So the only way to use multiples of them is if you have multiple i-squared c ports on your microcontroller Which you definitely can do on rp 2040 based feather pico Qt pi that little trinky and on and on at least I think that trinky is one Then let's see We have The download section here in the guide Has the datasheet. So if you want to go check that out, you can see this is a texas instrument tc 84 18 and it tells you tc 8 14 is a keypans keypad scan device With integrated usd production operate up 1.65 to 3.6 volts and has 18 general purpose i-o That can be used to support 80 keys via i-squared c So you can get some extra details from that there If you're interested If we head over to the chat I saw we had some questions about Probably about the rollover Tythe says you can test holding down eight keys at once and then repress one while holding the rest So let's see what happens. Let me plug this back in I haven't tested this Uh, I do have a funny flaw in my code where i'm using shift modifier to create the Star or at least the pound pound sign And if I keep that held it acts like a shift on all of them. So I won't use that one, but if we uh jump back over to My atom session here So you can see both actually in the output and Uh in my Made main cone code view here. Uh, I'm gonna press one two three four Five six seven eight I'm not sure if that's demonstrating Oh interesting. Yeah, I don't know what's doing there. My code probably isn't uh, isn't helping us any I'm getting resends there Uh, does that happen with just like one two three? No Two three four Yeah, I think we might be getting ghosting. So it's possible Depending on how you have your matrix set up with a diode matrix to get ghost Ghost presses and there are recommendations in the Data sheet on how to avoid that essentially if you have to press three keys at once They say put them in different columns. I think it is Or different columns and row so a diagonal They call it the control alt delete mode so you can set set up for a priority on three presses as well that won't ghost See river says or you can use the i-squared c-mux to cascade a few of these that's right It's another way to do it is uh multiplex the multiplexers, which is definite matrix territory there Uh, all right, let's see if there are No other questions. I'll remind you to head over to that url right there that qr code It'll take you to the product page. You can pick these up for this great great price today Uh, and I'll wrap things up here. So So That right there is my product pick of the week. It is the tca 84 18 keypad matrix and gpio break out That is going to do it for today's episode of jp's product pick of the week Thanks so much for stopping by and I will see you next time Bye-bye