 windows. That's weird. That's going to trip me up. I'm going to hide that out of the way. So moving forward, hello. Hey, Connor McCarter and Bill Ferguson over in the YouTube chat. That's the other chat that I keep an eye on. So if you're not able to do Discord, which I think some people can't for various reasons, then maybe head on over to the YouTube chat. All right. I'm going to move forward with this, which is our jobs board at jobs.atafruit.com. If you're looking for work, you can head over here. That's what it looks like right there. That's jobs.atafruit.com. Doesn't cost anything. Doesn't cost anything to go and look for work. It doesn't cost anything to post a listing if you're trying to fill a position. You'll notice here in the jobs listing, there's some interesting stuff, including director of the Schupf family idea lab in Saratoga Springs, New York at Skidmore College. They're looking for someone to helm a lab, an idea lab, which sounds really interesting. There's also some sort of contract work, remote contract work like this Arduino Uno R3 code gig someone is looking to bring someone on to do some water control applications inside of an Arduino setup. So pretty neat. All right, let's see. Mike P. Oh, no bleeps and bloops, people say. I thought there were some. Did you not hear those? Those were playing, I thought. Did you hear them that time? Maybe no. So let's see. What else have we got? I have a show on Tuesdays you may have heard of. It's this right here. It's called JP's product pick of the week. And on that show, we take a look at a product. Sometimes it's a new one. Sometimes it's an oldie but goodie from our archives. Sometimes it's halfway in between those two descriptions. The show is usually about 15 minutes long. I take a look at the product to give you some info, some demos, how to use it, maybe some code examples if that's relevant. And you get a big huge discount during the show. So if you watch on Tuesdays at 4 p.m. Eastern time for that period of roughly 20 minutes to a half hour of the show with a little buffer on the end there. Any of the product of the week that you put in your cart is going to have a big discount on it. There's no coupon code to use. It's just going to be priced to sell, as we say, right there on our website. And this week was 50% off on the Feather RP2040, which is just a tremendous bargain for a whole bunch of microcontroller. I like to do a little recap. Here's a one minute recap of the show. Feather RP2040. So this is the Feather that you want. It's, first of all, the chip that's most available in the world right now, we think. It has USB-C on it. It has dual cores. It's Cortex M0 Plus, but running at sort of our M4 speeds. We've got 8 megs of RAM on there. We have the Stemicut Quick port, so you can connect things up easily to it. There are 21 GPIO. It has two I2C buses, two SPI buses. There are, let me check my notes, 16 PWM pins on there. It has the built-in battery charging. So this is really a terrific board. It's kind of a go-to board for projects for me right now. It's really nice how this brings this compatible into the Feather ecosystem. There's a Neopixel built right on for status. So really terrific board, one of my favorites. This is the Feather RP2040. Yes it is. So let's see, what's next? Let me know, by the way, in the chat, things you're using them for. I know that people really like that board, and especially curious about people diving into the PIO world to do concurrent things with two cores, to do individual sort of instructions just on a PIO. There's some advanced stuff that can happen with the RP2040-based microcontrollers, and I'd love to hear about them. Hello, MaxCraft7050 over in the YouTube chat, and WagonLoads best network ink kind of trooper, Dale Echols. Hello, thanks for saying hi. Thanks for stopping by. And thank you, by the way, someone had said happy birthday to me for yesterday. So thank you. Yeah, yesterday was my birthday, and I saw my shadow, so you get more winter, sorry. All right, next up, how about this Circuit Python Parsec? It's going to be a good one. Okay, so let me get set up here, and then we'll get moving with this. Here we go. For the Circuit Python Parsec today, I wanted to talk about using dictionaries inside of Circuit Python. So dictionary is a type of a data structure, sort of like a list, but the really neat thing about it is that we can ask for values associated with certain keys. So what you'll see in my code here, here I've actually named things for what they are. Dictionary is inside of these curly brackets, these different pairs of things, like the text string blue, and then it has a related value, which is a color value here, these numbers and parentheses. What I'm doing in code here is you can see down at the bottom, I'm using user input, and it says right here, please type the name of a key from your dictionary, and then it tells me the names of the different keys in my dictionary. So I'll type in green. It says your entry matches a key in the dictionary. Then it tells me what the value of that key is, in this case, the value of the green key is 0, 255, 0. Then I have it lighting up these neopixels here for a fun little effect. And then it moves forward and says, okay, try another one. If I type something that doesn't exist in here, let's do red. That's not in that list. It says, oh, red, that entry is not in the dictionary, sorry. So how this works, the key thing here, and pardon the pun about key thing, but I'm calling the key whatever the user input is. So key equals input parentheses. So when I type something, the next thing that happens is I check if the key is in the dictionary. So that's a way to just look and see, does it match any of those entries for those first halves of those pairs? If it does, we print out a little statement, we take a pause, then we set the value variable to be equal to the dictionary at that key. So that's actually grabbing that value. I'm also calling it value just so it's really clear what it is right here. Then I print off a statement to let you know you've done the thing, filled the LEDs with that value. So in that case, when I typed in, let's do blue, it goes, it looks through the dictionary, or any of the keys named blue, it finds one, and then it sets that thing called value to be the value of the blue, or yeah, the blue key inside of the dictionary in this case is 00255, and then it lights up our LEDs. So it's a really nice way to work with a data structure calling things by name and then getting their values returned to you. And so that's one way that you can work with dictionaries inside of CircuitPython, and that is your CircuitPython parsec. CircuitPython. And by the way, so I was not fishing for happy birthdays, so no oops is necessary, thanks Conor McCarter for saying oops belated happy birthday. No problem, I wasn't going and advertising that, but I saw that's the one I mentioned it. More coffee, hold on. Yeah, so we're actually going to use this type of a little dictionary search in part of the project, the next project that I'm starting, it's one of the reasons that it was on my mind is that I wanted to be able to have a set of phone numbers inside of essentially a directory on the microcontroller, we'll call it a dictionary, that will be correlated when someone types in the right phone number to a song. So I'm going to be working on this dial a song. And so this dictionary structure is a really good way to be able to store little pairs of items that go together. Tabat says I just want free cake. No, I just want more coffee. I've already polished off this cup. Mike P says dictionaries are cool to use as function maps too. Please discuss that in the chat, sounds interesting. This is a local Burbank coffee roaster called Fat Rabbit. It's the beans that I'm having here today. In case you were wondering, not sponsored. All right, let's see. What else have we got? So I want to do a little bit of a wrap up of the rotary phone USB project that we started on last week. Show kind of where things have gotten with that. And then we're going to sort of launch into this next project. So one thing actually I'm curious in the chat because I can't remember how far did we get with that last week. I know I took apart the phone, showed how it worked. I think I may have had it hooked up to a microcontroller that was doing some of the dialing. But I can't remember and I didn't have time to go back and check. So the main stuff I was working on after the show, beyond code, I think I did make some changes to code that I'll demo and talk about. But the main things were just the physical layout of the microcontroller inside of the phone, the wiring. And I also wanted to show how I've made this essentially a reversible, non-destructive modification to the phone. Because if you have an old rotary phone like that one right there, you may not want to go destroying it. And so I took extra care to make sure that this is a reversible type of hack. The very first part of that actually was building this cable. I showed it on Show and Tell last night. This is a RJ11, your sort of standard phone jack, into USB-A. And that's because I'm using a computer on one end, microcontroller that's inside of the phone on the other. And rather than just running a micro, sorry, running a USB cable into there, it's USB-C in this case, and needing to either drill a hole or bypass some stuff, I wanted to use the existing jack. So part of this was actually building this cable by paying attention to which wires were colored what in the different standards and then running that into the phone. So let's go ahead and actually jump over there. And we will pull this apart to take a look at how I've hooked things up. Turn the light over here. And then that'll be perfect because I need to start documenting some of that build process for the guide. So I actually am going to work on that after the show, and so I'm in need of taking it apart right now. Sometimes, as you know, I've told you I document things by taking them apart and then just reverse the order of the photos. But instead, this time, I'll be taking this apart here on the show and then I'll put it back together and document it later. Some of the build included shaving a little bit off of the PVC insulation on this cable to fit the USB DIY jack that we have there. Okay, so one second what I'm going to do is bring up my discord if it'll allow me to. Just want to keep an eye on the chat. There we go. Okay, so handset, I'm not doing anything with it in this project as far as the electronics of it. However, it does matter that it weighs a whole bunch enough to keep that spring loaded switch in place. Alright, so this is sometimes called the switch hook, receiver switch. So that switch being down in that state, I'm using this as a switch to turn on and off the USB HID protocol of the microcontroller. So what I'll do is, yeah, you know, I'll demo this here. So let me go to Notepad and I think you've seen me demo this a bit before, but there we go one last time. You can see I've got various phone outlet parts sitting here. So I've got this iPad and this cable here. This terminates in USB A, but I'll go ahead and plug that into one of these on the go camera connectors for iPad in there. And then the other end of my RJ11 jack goes into the phone. Okay, so what should just have happened? And I don't know if you can see it. There's a green light you can just see right here. So that tells me that the microcontroller is on. It's got power. And if it's in its non USB state, the NeoPixel is green. When it goes into its USB HID state, the LED will turn red. So I can see that from under there is sort of a diagnostic, but I probably don't need to because what should happen is, when I lift this off the receiver, it will set a variable in the boot.py file and then it'll set a microcontroller reset so that when it restarts it looks at the boot.py file and it says either I'm in the mode where I'm going to turn on USB HID or I'm in the mode where I'm not. So the practical effect of that should be when this turns on and goes into HID mode, the virtual keyboard goes away. Let's see. Let's see if it started. Maybe it didn't. Let me restart this. Hello. Wake it up. Uh-oh, did I break something? Nope, not. I see green LEDs in there. It is not switching to red. Uh-oh. It's worked so well. Let's pull its power entirely from here. There it goes. Okay. I don't know what was going on there. So this is it starting up in this state, checking, finding out it's going to be a USB HID device. Now it'll work just as a keypad. So we're counting pulses. Counted 10 pulses, gave us a zero. Counts eight pulses, gives us an eight. Now if I hang it up either with this or just switch, it will reset itself and check and see, oh, I'm in non-HID state. Not only does it, as you can see, bring up this keyboard, but this has no impact because it's not writing out HID. Internally, the microcontroller is actually still counting those pulses and it'll print that out to a serial port if you have it connected. But for the sort of usefulness on an iOS device, I don't really want that virtual keyboard there when I'm doing rotary dial and I want to bring back the rotary or the virtual keyboard when I hang this up. So that's how that's working. So let me switch back over to Discord, set this here. So let's get that out of the way and I don't need this. And to take this apart, it's actually just two screws that you loosen. So I'll pull these here. By the way, I mentioned this last night on show and tell. I am going to implement one different mode which is instead of using the switch hook there as the mode selector, I'm going to leave it available as an alternate form of dialing because everyone likes to practice their switch hook dialing. So if you needed to dial a three, you could do three like that as long as your timing is pretty tight and it's definitely possible, you can use the switch hook for that. Okay, so the shell, here comes off, nothing's connected to it. And so here are the key things before I pull the dial off for you to look at is here is the existing RJ11 jack that was on this phone and it actually was only three wire. I added the conductor, the fourth wire conductor here with just a piece of black wire with a little bit of springy metal on the end that I pulled from a different phone. So those three that were existing in there were using these little terminal spade connectors to connect up to some of these screws. I took a picture of it, I can put them back to where they were. But that means I'm essentially bypassing the entire sort of transmitting block here that has some of the phone's electronics that are usually powered by like 40 volts AC. So we're ignoring that and this is running essentially straight to the microcontroller, almost straight to the microcontroller as a HID rather as a USB cable. So it's four conductors, it does the data plus, data minus, ground and VCC. And then everything else is the wiring that comes from the dial itself is going to the microcontroller so that we can read the pulse pin. There's one switch on here that's closing and opening and the switch hook. So those are a couple of sets of wires that I've connected to the microcontroller indirectly. And so the reason I did it indirectly is I didn't want to cut anything, I didn't want to solder anything directly to the board. So I used a barrier block, which is a very similar type of screw terminal as what you see already in the phone here. And let me just loosen this and this is clipped in with a little mount like so. Loosen this one just a little bit more so that it can get out of there. Okay, so the dial always had these four wires coming off of it and those, you can see actually two of them are still going to the phone's original. These two white wires, those are essentially the switch that is normally open and it closes as soon as you start dialing. That's the disconnect that cuts the speaker that you're listening to in the handset so you're not hearing all that loud dialing noise. So that switch I've left alone, that could be another interesting one to use for something, but I'm not. And then the blue wire is headed to my microcontroller. There's the little KB2040. And like I said, everything, all the wiring I've done here is this little barrier block. So you can see my RJ11, the three original cables on there, the green, red, and yellow that normally go somewhere over here. They come up to this block and then I have some wires running to my KB2040 that I've soldered in place. And then here I match the colors of these. So these are the two blue wires coming off of the pulse dial. Those just run to two blue wires that are going to ground and I believe I'm reading that on the RX pin. And then finally the switch hook here. I've screwed in a couple wires to where that connects inside of the phone. Going to these white and black wires on the terminal block or barrier block. And then those are going to another ground and pinned to. And I could have ganged up some of these grounds, but I just wanted to keep it sort of one-to-one and clear. So that, thankfully, I could cut this down if I had to, but that block actually fits perfectly right in this little space right here. Everything still functions mechanically as normal. There's space there. I haven't mounted this. There's actually not no mounting holes on the KB2040 since it was designed to just be soldered down onto keyboard PCBs. So I've just put down a piece of black felt here, a sticky back black felt to keep this from having to short on anything. I could improve this a lot. Maybe put some capton tape back there and mount this with a zip tie or something else to some of these holes in the bottom of the phone that aren't used for anything. Excuse me. The RJ, sometimes I think these are given like the name RJ8, is the usually two wire. Is that right? No, usually four wire. But I think it's a smaller plug, a narrower plug for the mic and the earpiece. Those could be used for something as well. So we're going to look at that on the upcoming project using the microphone or the speaker, probably the speaker, by wiring in through there. But that's another interesting part there. And then lastly, people ask about the ringer on these. And that's actually a really, it's a tricky thing. So this is a, I think the ringer voltage goes from 60 volts to 80 volts. And it's a sinusoidal, it's like a pair of sinusoidal signals that the phone company would send down the line that would trigger, I think this is a dual coil. And so it would magnetically pull and push this little clapper here. So it's nothing that you can just send three volts to or five volts to fake it. So I might look into building, there's some good square wave circuits out there and boost converters that people use to ring these, especially in theatrical settings. If you look, there's like a sort of homemade looking $100 gizmo you can buy that is a phone ringer for theatrical stuff. And those will usually just ring while you hold them and stop ringing when you release. So then they also sell like a second box that has the timing that's the two seconds on one second off or maybe vice versa of an American ring and it's different in different countries. So anyway, that's like a different thing that I'm not handling. But just in case you were curious, one of the reason is that, yeah, there was a lot of voltage going down the line is still with the pots, plain old telephone system. So runs normally, I think 48 volts, the ringing is, yeah, someone says 90 to 120, normally 96. Yeah, so if you look around, you'll see different different phone systems implemented with some pretty high voltages. So this one, I will be documenting so you can go out there and find an old phone in your closet and build one of these if you want. I'm just going to set a couple pieces back there so it's not too big of a mess and get this out of the way. And then I'd like to start talking about our next project. So I'm going to move that one right there and we'll head over. Yes, C Grover says ringing spikes could easily light a small neon indicator bulb. You'll find phones, is this thing still plugged in? Probably not. You will find phones in the, I think in the 500 series era, and definitely in the 2500 series era, that had a big neon indicator bulb, like a stove indicator type of bulb, maybe I don't know if they were 12 volts or what, 30 volts. But you'd find them in these beautiful domed refractors, usually red so that it could be seen. So someone who had the ringer turned off could see the phone flashing. So that was high voltage stuff to make all that work. It's pretty cool. All right, let me put a, oh good, I'm glad to see there's a nice discussion going on about dictionaries and functions that I'll check out later. Hey, foamy guy, thanks for stopping by. So the next project is highly related because it's sort of unavoidable once you start looking at the 500 series phones to then think about the evolution into dual tone multifunction or touch tone dialing, which is usually some kind of a keypad like this. And the idea with this project is to use the keypad as an input device to enter in a phone number, a sort of fake seven digit phone number, and then have a self contained dial a song in the phone so that when you pick up the receiver, punch in a number. So if it is a phone number on the list in the dictionary that has an associated song with it, it'll play back a song to you over the headset. So that'll be a probably a wave file that I'll put on there and heavy heavy nod to they might be giants who pioneered way back in, I guess the mid 80s, a dial a song service where you could call up a phone number and get get a song played to you. So the first step in this, however, is just the sort of keypad side of things. So let me bring back this view of the world. So what I've got here for this kind of my first phase of this process is, okay, I know with the phone, I have a really good chance of encountering a matrix layout, probably a three by four matrix layout. A lot of phones are actually a four by four and they hide the right row of them, which were ABCD, I think. And actually Adafruit sells a keypad that has that layout on it. Those were sort of a hidden set of tones that were used for government use and military use. And I don't know if that's, I kind of don't know if that's still in use at all. Some of these systems have to stick around for legacy reasons, but good chance you'll find a matrix. And so this is a little non-diode, so just a straight up matrix keypad that we have at Adafruit. And in fact, I'll pull those up real quick. Where's my browser? So if you look on Adafruit and go to keypad, you'll find, here's a four by four. So that's like this sort of bonus government, U.S. government version of the dual tone multifunction. And then we have the three by four keypad. The one that I'm using is actually the three by four phone style keypad, which is, I think it's a little bit different where the connectors are, but functionally it's the same. It's just that this one has the numbers printed on it that relate to some of, or the letters that relate to some of the numbers which were used for dialing, you know, 1-800-THINGY or whatever, please don't call that. I don't know if that was enough letters. Yeah, Wagonloads over in YouTube says, phones also used for escape room challenges. There's just such great input devices for escape room challenges, definitely. So to use this, I'm going to jump back over here and let me plug this in and show you what my kind of first order of business with this is, knowing that I wanted to use CircuitPython because it's going to make it really easy to play back wave files directly from a microcontroller such as the feather. And you know what, I can turn up the exposure on here real quick. It's a little better. So this was kind of a neat happenstance that I was able to use one of these feather triplers. So I have a feather RP2040 here. I have an OLED feather wing here. And then there are, I think, what does this one have? Eight pins coming out of this even though it's really only seven that are used. And these pins I was able to plug into the bottom, essentially going into the A0, A1, A2, A3, pin 24, pin 25, and serial clock pins. Use them all as digital IO pins for columns and rows. And so that plugged in there, I also used some little standoffs to, little M2.5 standoffs to make it a little bit sturdier. So let me give you a little demo of this. I'll go to a full screen for a moment. So right now it boots up and it says dial a tune, and then it gives you a bit of a clue as to you're supposed to type in a seven digit phone number just by doing underscores and a dash. So if I type something in 5551212, right now what I've got it doing is recognizing that you're typing in numbers, adding those into, or appending those to a list. And then when it reaches seven, it checks that number to see if it's part of an existing dictionary. So you'll see if I type the next number, it recognizes seven digits, and then it doesn't matter what those seven digits are right now. It kind of rolls it over, refreshes everything and waits for you to do the next one. So let me show this in the code view, and I've got some somewhat helpful print statements in here. So let's see that. I can close, open up the one here. Where are you? Why aren't you showing up? Second, unplug it and re-plug it because that board didn't show up. All right, I wonder if I have a different USB cable. Yeah, all right. Other cables are a little suspicious. There we go. Sorry about that. So first of all, let's take a look just in my serial output here. So I will use screen to connect to this feather here. And now let's start typing numbers. So I've typed in a one, two, three, four, five, six, seven. And so you see I'm printing out the string that is being appended or the list, the string version of this list that's being appended until it gets to that seventh digit. Then I kind of repeat it. I say, okay, the dialed string is one, two, three, four, five, six, seven in this case. And then I'm printing to myself the number you have dialed is not in service. So that's going to be what I'll do if a number is typed in that does not exist in the list or in the dictionary or the phone directory for the dial song is that I'll play back a wave file of the sort of typical the number you have called is not in service, which I haven't heard in a while. So I don't know if I've got that exactly right. Let me show you how, what happens when we dial one that is in the list. So I've got a number that is and now you'll see I'm just printing the name of a wave file, a fake wave file that doesn't exist yet. So I don't actually have this, I don't have any waves on here. I don't have an amp and a speaker or anything like that connected. So for now I'm just kind of printing things out to know that it's working. So let's take a look at the code and how this works. The display stuff is pretty typical for using this OLED display so I won't go over that in great detail. I squared C is how we're connecting to that display. I am using our text label display label to create the little dial of tune up at the top there. And then a second little text area that's initially these dashes, underscores and dashes. And then I'm using the keypad library. So you'll see up here one of the things I'm importing is import keypad. So the keypad library is being created, the object KM for key matrix equals keypad dot key matrix. And then you specify the rows in the columns. It doesn't actually matter which you put first as long as you name them that way. So row pins equals board pins A3, D24, D25 and serial clock. And then the column pins are pins A0, A1 and A2. So that is reading this matrix or setting it up to read that matrix. Then I'm setting up my dictionary here. So remember I talked about dictionaries earlier so I have a dictionary called numbers. And I could probably be more descriptive with that like phone book or something like that. And then when a number exists we have an associated value to its key. So the phone number you dial in will be the key and the way file we play back will be the value. I also gave the buttons some nice names since these are technically event 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12. In fact if I just print event and you can see here event is the key matrix dot events dot get. So we do a check of all of the keys in this in the library. So when I press a key I get an event key number so that's essentially this 0 through 13 event numbers that exist in the matrix. And when I release I get a released value of that same key. So you can see this is neat because we can type for other uses not for the one we're doing here. So we can press a 4, press the 3, release the 3, release the 2 or rather. So it knows this sort of edge detection of if you've pressed something or released it which is useful. Not in this project but I don't really need it for much. So to be able to press what is essentially 0 key event 0 but see a 1 show up or to press key event what is this 1, 12 and get a 0 to show up I have a little list here that I can remap things to. So I'm not printing them on the screen but you can see when I type in the star or the pound sign right now the numbers are showing up in my serial output. So I have a nice name essentially with this button names list. Then I have this variable called digits entered and that's what keeping track of have we gotten all the way through the 7 digits of a phone number yet and then we do stuff when we've reached that limit. Dialed is the list of the digits that are being entered. So this dialed equals brackets thing means it's essentially a list that has nothing in it to start with. And then as we press things we're going to append to that list and build that list up to be 7 digits long. Right now you can see I'm not doing much of anything with these star and pound keys but I may end up using those for stuff if we have an operator saying something to you would you like to play the song again press star to continue that kind of thing then I'll have those available as sort of little additional functions. You could get ambitious with this I'm going to make it fairly simple but you could say you know what I want to do stuff like if I'm holding down star I can cycle between A, B and C and the number 2 A, B, C, 2 and that sort of thing. You may remember that from your flip phone days of being able to toggle through those letter options and then maybe search for a song by name or something like that. I won't touch that but that'll certainly be possible for someone who wants to. And then here's what's going on inside of the main loop. First coffee. Hello, Abudiyawad and Jared Manoring, nice to see you all. Thanks for stopping into the chat there over on YouTube. See Grover's amused to see Jenny at the top of the list there. And yeah, Todd says the keypad libraries make this stuff so much easier. Thank you Dan Halbert, Dan H, who wrote this excellent keypad library inside of Circuit Python. Oh yeah, press start, it'll list all songs. I love that, that's great. So here's what's going on in the main events or the main loop. So event equals key matrix events get. And if you look at the key matrix documentation for that library, in fact let's take a journey over there real quick. All you got to do is head to learn.adafruit.com And if you type in keypad, you'll see, just look for a SNES controller. Dan has this photo with a SNES controller, a keypad and a macro pad. So the guide will tell you all about how it works. We can read keys, key matrices and shift registers, which is what you find in that SNES controller. It talks about a simple setup for just checking for key presses like a GPIO pin. It talks about the key matrix, both with and without a diode matrix in it. The setup for those, being able to switch their orientation, pick the orientation of the diode matrix if it is one and so forth. And then there are some examples you can look through that'll give you some ideas. And then there's the advanced features, which will talk about some intervals of scanning. Different keyboards might have a different scan interval that you have to account for, filling up a queue with a bunch of keys and so on. So check this out. You can also check out the read the docs documentation for other functions there. And I think we can also just import the library onto the board and type directory for the keypad and see what it can do. So back to this. You saw me add this print event. This is really helpful to have at first because I didn't get the pin assignments right at first. And so I was pressing a one and seeing it say key event eight and you know it was sideways and backwards. So the first thing you have to do is just figure out by reading key events, which pins are proper. Or this is, you know, you might be able to figure it out looking at the clear backing on here or pull this off and check the traces. But I just found it easier through trial and error to swap these around and use that print event to see what was being pressed. And then when an event happens. So there's if the event, when the event happens, if it's pressed, I'm actually not doing anything with released. And maybe I should but this is how I'm doing it right now with the press of an event. Then I do kind of a first level check which is, is it the star or the pound key or hash key that's been pressed. So either of those, it's only going to do what's inside of this loop first. So if the event is pressed, if the event is either key number nine or key number 11. So I was saying that wrong before this is zero through 11. If we are pressing either of those, then all I do is, if it's key nine, the star key, I run this pad clear function, which right now doesn't do much, it just prints out a little print statement for me here. So that doesn't count to our total as we're adding up towards seven. It doesn't put anything on the screen because after this runs, the next thing at that level is repeat the whole loop. And same with this. So these kind of don't contribute to the rest of the stuff. So what the rest of the stuff is any other key. So one through nine and zero. If the digit that is entered is, or rather, yeah, if the digits entered variable or list is, yeah, it's a variable. Sorry. If that is less than seven, then that means we're going to add a number to this potential phone number. If it's up to seven, then we know we've entered a phone number. We do other stuff. So this section right here, this is all just about building up the list of the full phone number. So if the event is a key number less than nine, so event key number less than nine, then it is these right here. And in those cases, I just append that event key number plus one since this starts at zero. So if I press this event zero, it's actually a one that gets added to my dialed number list. So the dial number list is what you see growing there. So one, one, one, one, one, one, one, one. In fact, I'm going to hide the event print here real quick. So I press a one and another one and another one or something else. So that's building up that list. So I add to that. If it's a 10, then I just type in a zero. So you can see there I'm correlating to a zero. I create a string, which makes it easier to do things like print to the screen here. So this dialed string equals a empty string plus join string n for n in dialed. So each item in that dialed list becomes essentially a character in this string. Then the number text area OLED display grabs and prints this dialed string that's being built up, appended to, and then I'm also printing it down here in my serial output just for me to see. I don't need that, that print statement. In fact, none of those print statements go to the screen. Those are just for debugging right now. And then the digits entered equals whatever the digits entered is plus one, and so that's how we go from zero up to six, which is the seven digits. So if the number of digits entered is seven, then I'm sure there's a neater way to do this, but I wanted to add the hyphen in there. So I'm just doing this messy iterating through each item or each index in the list until I get to the third number then I put in a hyphen and then I put in the remaining four. So I'm sure there's a cleaner way to do that that I'll have to look at later. Same thing here, the dialed string gets printed. And then here's the check. So remember earlier in the circuit pipeline parsec segment, I was looking at checking for a key inside of a dictionary and then returning the value. So my dictionary in this case is numbers. And the key that I'm looking to see does it exist is this dialed string. So my dialed string in this case is one, one, one, two, zero, one, one. So it goes up here, it checks this dictionary. Are either of these entries, do either of these entries have a key that is one, one, one, two, zero, one, one? They do not. So in this case, if the string is not inside of that dictionary, then we print the numbers you have dialed, it's not in service since that's what we see right now. If I do my childhood phone number, which I don't use for passwords anywhere, so don't worry, that's not bad info-sec, I hope. If I type that in, then that one does exist. And so it says, okay, we'll give you back the value, which is that pair with the key. We'll give you back that value by grabbing the dictionary of numbers and the key of dialed string. So it grabs the value. In this case, the value is file two dot wave. So you can see it up here. File two dot wave is the wave file correlated to that phone number. If instead I do Jenny's number, eight, six, seven, five, three, oh, nine, then we get file one dot wave. So next step will be to actually use some wave playback code in here or MP3 playback code in here and have it do something with it. And there's a lot of UI stuff that I can do, like do we want to clear that out after each one, put a different message, have something like the song name show up. That's some stuff that it remains to be done. Then, since this was all inside of the loop of if digits entered is seven, that means when we've hit that last number in the seven-digit sequence, we do whatever we do, print stuff, find out that that number exists, play a song, find out that that number didn't exist, play the, that doesn't exist message. And then I just reset everything. So the digits entered gets dropped back to zero. The dialed list becomes empty and the dialed string becomes empty. So that's, that's what just sort of sets us up to be able to start again. Oh yeah, thank you. This is a great point. Don't let me forget this. The C Grovis says add touch tone wave files for the key presses. Yeah, I think I'm going to do that. So as each number gets pressed, we'll hear the boop, boop, boop, boop, boop, boop, boop. Happening when we press those. I don't see any reason not to make them wave files. I think I mentioned this before. It's possible potentially on this microcontroller. I'm using a Feather RP2040. It's possible that I could play two waveforms simultaneously to actually make dual tone multifunction. And I've talked about this before in the show, so I won't go into it, but essentially each column played one of three different waveforms and each row and each column played one of four. And so it's a mix of those. It was dual tone. It was two tones happening at once. Yeah, and also dial tone.wave. We want to have boop when we pick that up. We'll hear the line is open kind of thing. Lots of fun phone stuff we can do there. That's right. Abaduce, that is the culturally required way to say the phone number. Okay. Movie phone we could implement. That's a good idea. So let's see. At this point what I wanted to do is just jump over and we have some excellent just-in-time delivery because I didn't have a good Model 2500 phone. I have some touch-tone phones, but I'll show you the issue. This is one that I got at a thrift store for $8. You can see I've started to take it apart. So this is probably, I don't know, modern-ish. Maybe in the last 10, 15 years phone, AT&T, two-line phone. It was probably worth a good bit of money when it originally came out. But if you look at this, here's what we've got to deal with. Probably microcontroller in here, talking to microcontroller in here. Maybe not a lot of fun trying to hook into this matrix. You probably could, but I don't love this phone and it's got no style. It has no soul. So another, actually a nicer touch-tone that I have. I think I've shown some projects with this one before. This little one here, it's kind of nice. But not a lot of room in here. And so what I really wanted was the successor to the Model 500, which was the Model 2500. And just before the show, this came in the mail. I know I could have probably gotten one locally, but I didn't have a lot of time. So I got one off at eBay. I paid $16 for it plus shipping, so not too bad. And this is a beautiful beige, genuine Western Electric Model 2500. Right there, Model 2500 DM. Property of Pacific Telephone Company, not for sale. A question before these phones were usually rented to you from your phone company for about $30 a month. You didn't own them. And you still run across news stories sometimes about people who have still been renting their phones 30, 40 years later, they're still a grandparent or something who's paying the phone company for a phone rental, which they've probably paid for the phone by now, I would guess. So this one we will end up using speaker in here, which will be two of the wires coming off of here. Usually if you take the mouthpiece out, you can see the wiring. Let's see. So there you can see is the jack running into it. And then you can even tell, thanks to the color coding, there's a red and a black looks like running to this mic, and there's a white and a green running up to the speaker in here. So hopefully I'll be able to drive that using just one of our little class D mono amplifiers. We'll see. I don't know what the specifications are for these speakers up here. Oh, it looks like, yeah, OK, so you can see they usually stuffed some batting in here, synthetic batting or cotton batting. There's some batting in there. I think that mostly just keeps these wires from rattling around and gives it a little bit of a deadening of sound. So there's our speaker. If anyone wants to do some research on that based on those numbers on there or if someone just knows off the top of their head what would be a good amp to drive that with. That would be part of that. Yeah, and the contrasting brown faceplate. Isn't that gorgeous? I love that. It's pretty clean too. It's a pretty good shape. I can take off the faceplate there just by lifting up this clip. There's like a little metal clip that's spring loaded. And once you push that upward into the phone, you can pull this off. I don't know why they made that that easy to pop off. It seems like it was for the purposes of changing this out rapidly before you brought it to a customer or something like that. But nice molded colored, it's not paint or anything, nice color molded plastic. And it has a little face, a little clear protector there for dropping in a piece of paper with the phone number. It's usually what you put in there. And these often got little stickers stuck on them with like 9-1-1 when that was first introduced or choking hotline or something like that. You'll see that a lot on phones. The number pad there, you can see, by the way, I think this is a double shot plastic, which is great. You're never going to wear this off. It's not like it's printed on there or dye sublimated or anything like that. I think that's a double shot plastic. So there's two molds and two squirts of plastic that go in. So nice quality stuff. These are built to last. So let's open it up and have a look at the wiring for the matrix there. I have not opened this phone yet. So anyone's guess what we're going to find inside? I need some torque on this screw. So you can see how closely this resembles the 500. They didn't want to change that design much. Really, they were taking a device you were comfortable with and introducing this touch tone dial pad technology, leaving the rest of it the same, including the ringer here. Actually, that's something I haven't played around with. I need to build a ringing circuit. Like I said, I don't actually know what that changes. What that volume, if it's a dampener or what, it's a big mechanical knob for the volume. I don't know if they're just dampening a bell or what. I don't think it changed the frequency. All right. Here we go. Moment of truth. I don't see any little animals or anything in there. That's a good sign. Hey, this is pretty clean. Not bad. Let's put that right there. So familiar positioning of dial, ringer rather, the little communication block here is shorter, but again, kind of placed in the same position there. See, Grover says it's a mechanical dampener usually. Let's see. It looks like it rotates that bell there, which is funny. How that quiets that I don't know. I believe you that it's a mechanical dampener, but I don't know how that would dampen it. Is it just further from the clapper? I think it is. This thing is funny. This is actually offset a little bit, and so the dampener, this one bell is getting further or closer. Weird. So what we want to do, boy, it's really cool how similar this is to the 500. So what I want to do is loosen these two screws on the side of the dial pad. And see if it'll clip out on each side. I think one question is, did any of these have different color keypads? I think they did, because I think I've seen all black. We had all black. I think there are red ones where the numbers are red on it, but then I think maybe this gray went on a bunch of different... I don't know if the color matched the tan or the white. I might have all had gray in there. Okay. So next phase of the operation. You can see there is quite a bit more wiring headed from here to the rest of the phone than on the Model 500. There are... Pull this. Ooh, that's taped down. Okay, so that'll have to be a little more careful with... And I'm not going to try to hook up to this today. If I want to probe around, that'll be a little bit tedious to figure out what the row column matrix is. I also haven't looked this up online, because I'm sure there are people who've gone before me to figure out what... If it's any of these wires for the row column matrix, or how we tap into that, or if I have to dig deeper in. It's interesting that we've got what look like some little switches here. And... Oh, wow. Yeah, look at this. This is a mechanical switching system, so I'm pressing different keys. And I suspect those are doing this... Maybe they're doing the same disconnect of the earpiece, because you can see that there are contacts being made and broken here as we press. This is really cool. I've never dug into this keypad before, so this will be fun. See Grover says, old phones are a great example of rugged consumer design, built to be abused, but used as a weapon in a few episodes of Perry Mason. Yeah, these are incredibly robust, made to last, made to be repaired. Very cool. Yeah, that surprised me. I didn't think we would see mechanical switching in there. I gotta assume there is dual tone multi-function row and column stuff happening as well as whatever this disconnect and reconnect. This is not a different sequence based on different numbers here. Those are all kind of doing that same set of connections back to the phone. Alright, I think I'll leave it there, but I will keep you appraised of the discoveries as they go. Sorry, I didn't give you a big view of that. That would have been nice. So here you can see. Look at that right there. Pretty cool. Yeah, so there's just two pieces of tape that are holding this little insulator plastic, which I don't know why I made it clear. To be honest, it's great that they did, but why is that clear plastic? I don't know. Maybe it was just the best plastic to vacuum form into this shape. It was clear. Maybe it was for maintenance assembly. Who knows? Alright, if you've got experience with these, let me know in the chat, or if you found good guides to that. That's one of the things I'll be searching. Next is how we can hook into that system and read those key presses. Yes, wagon loads, you're right. Change the distance between the ringer and the bell. That's exactly what it does. That's very cool. Love it. Alright, I think that's going to do it for today. Thanks everyone for stopping by to the workshop. I'll look in the next few days for the rotary phone USB numpad guide that I'll be working on, and then I'll be sure to post to you on the progress with this as I find out more and get a microcontroller to read that. Thanks everyone for stopping by for Adafruit Industries. I'm John Park, and this has been John Park's Workshop. Bye-bye.