 Welcome to the show. It's me, John Park, and it's time for another JP's product pick of the week. You have arrived just in the nick of time to check out a really cool product, a new old product, a revision of a standard classic, I think. And not only that, but you have the opportunity to get it for 50% off today. If you head over here to this QR code or this URL, you will be on the product page. This video plays inside of there, so that's a bonus. You can watch it from right inside, and it's going to be 50% off. Now that discount applies throughout the show. You don't need any coupon code or anything like that. You just put it in your cart. It'll be that 50% off price, but it only lasts during the show, so you usually have to check out fairly quickly. So I also want to say thank you to everyone for stopping by over in our Discord and on the YouTube chat. If you're somewhere else, I'm wondering where the chat is going on, you could do worse than to head over to AFRU.IT slash Discord, and you'll get an instant invite. Head over to the live broadcast chat channel. That's where this discussion is going on. So let's have a look at Lady Aida announcing this product when it came out, and then we'll come on back here to the workshop. So let's step back very slightly in time. Take it away, Lady Aida. By request, a lot of people asked us to make a MCP 23017 breakout. Now, we carry the chip for the MCP 23017, and honestly, I've just been using the chip all this time, but I do see the benefit of having a breakout where, you know, the pull-ups are set up for you, and there's the capacitors, and, you know, everything's kind of aligned quite nicely. So this little breakout has an MCP 23017. It's a 16-channel GPIO expander that you can control over I squared C. So it has 16 GPIO labeled A0 through A7, B0 through B7, and each one can be an output, and it can drive or sync 25 milliamps of current, so it's good for LEDs and stuff like that. It can also be inputs, and the inputs can have pull-ups enabled. So good for buttons as well. So it's kind of like a nice general purpose GPIO expander. The nice thing about the MCP 23017 is it's like kind of old, like it's a well-established known chip. There's drivers for it all over the place. It's used so often, and this breakout is semi-QT compatible, so you can plug it into I squared C very easily. On the bottom are three I squared C address jumpers, and so you can have up to eight of these on one bus. They use, I think, address 20, 0x20 through 0x27. It's got lots of GPIO, but it's a nice, just reliable, non-weird GPIO expander. A lot of GPIO expander have some weird thing going on. This one does not. It's really normal. So it's a nice, easy, 16 GPIO plug-and-play with I squared C. That's right. Take it from Lady Aida. It's really normal. So why don't we go ahead and jump to my down-shooter here, and we will look in my mysterious mystery box of something that isn't what it appears to be. This is definitely not a Shraid knife, the old-timer, but instead, oh yes, there it is, my very own MCP 23017 breakout board. Let me do that again with a full screen, because I'm going to cut this in later. That's the product pick of the week. It is the MCP 23017 breakout board. This is a 16 IO expander, so you can do inputs and outputs. You can add up to 16 switches or buttons to your project. You can add up to 16 outputs, such as LEDs or a control signal for other things like a transistor to drive a relay or a solenoid. Anything that you can imagine if you need an extra 16, that's how you do it, and it runs right over I squared C. This has a STEMAQT port on it so that you can plug it into your microcontroller project over I squared C really easily. In fact, let's jump to the down-shooter for a second, and I'll show you. Here's a typical setup that you would have. I've got a little QT pie, got a little piece of fuzz on my finger too. There we go. I've got a little QT pie. This is the ESP 32 one here, and it has the STEMAQT port. You simply plug that in, and all of a sudden, this little board that doesn't have that much IO built onto it grabs an extra 16 ports. You can go up to 128 ports by adding up to eight of these on top of each other on one I squared C bus by adjusting their address jumpers, which is a tremendous amount of buttons. Now, what I wanted to do is show you a little demo here. Let's get set up for this, and I will move a little project I built, and I may actually develop this into a bit of a bigger project. Things got out of hand. I was just meaning to do a demo for this show here today, and instead I built a whole full-blown thing. I'm going to show you, you know what, let's go to this view. This is a good view here with Atom. What I'm doing here with the MCP 23017, you can see it underneath this board here, and all these wires are running. I have eight switches running, and then I have eight LEDs running through resistors to ground, and I can control all of those with simple commands over I squared C in circuit Python from my QDPI, that's QDPI RP2040 there, and that tells all of these lights to blink at a certain cadence. You can see my serial output there. I show which ones are off. If I turn one on, you'll see not only is it now on, but it's also triggering a drum sound. So I feel a little like hi-hat sort of sound, and so that's simply sending MIDI commands over USB to a little synthesizer that's running on this computer right here, and that is a project you can't really do on its own on something like this little QDPI, or not that many microcontrollers honestly have 16 available digital IOs for you to use, but this makes it really easy. We could add other rows of this, or you could make this all 16. It could be a 16 step sequencer and get rid of the lights. So here's the code that I have for running that. If you take a look here, let's find my code window. Where'd you go? Oh, we jumped all the way over there. How'd that happen? OK, so what you can see I'm doing here is I'm importing a bunch of libraries, including time, board, bus IO that allows me to use pins by name on the board and I squared C. I have USB MIDI and Adafruit MIDI and some other MIDI stuff I'm setting up. I'm importing digital IO direction and pull so that I can say it's an input or an output and use the pull up resistor. And then I'm importing the MCP230XX driver and library and I'm grabbing the 23017 code from that. I have a little sleep here to settle things down when USB starts up. I initialize my I squared C bus. Then I create my MCP23017 object on I squared C. I'm just naming it MCP for convenience here. And here I've laid these out. I haven't sort of tightened up this code so it's maybe a little easier to see what's going on. This is how using this command, you can tell those pins in sort of a setup that we're going to be using the pins 0 through 7 as the first bank, the A bank on that chip. And those are going to be switches, so I give them a little array with switch names. And then I'm doing the same for LEDs. I put these out of order because I had some soldering errors I made. So these are essentially pins 8 through 15, which is the second bank. And if you look at the chip there, there's a bank of 8 on the top, A and bank on the bottom there, B. Do I have that right? I think so. I think those are A and B. No, B is on top, A is on the bottom. And then I'm creating another list of those. Then during setup here, I'm just saying the LEDs are outputs and I'm turning them on at first. And then the switches are inputs with the pull-up resistor. So that just iterates through all of those and sets them. And I'm setting up some MIDI stuff and I have a little tempo here at this point too. Then for the main loop of the program here, you can see I run through the whole range of switches, all 8 of them. And for each of them, I set the value to true, or I rather check the value. So if not switches I dot value, if that value is false, which means the switch is flipped up because of pull-up logic, then I'm sending a note on and off very quickly. So that's sort of that gate that sends that little tick that you can hear going to the synthesizer. And then I'm also doing a little bit of fancy stuff with printing. If it's in the off position, I'm sending a MIDI note off just so that I don't accidentally leave one on because MIDI can get funny sometimes. It's probably not necessary, but it's a bit of a safety precaution there. And then I turn off the LED and then step to the next iteration of this. So I go through eight steps and then rerun through the sequence there. So let's see. The process I'm using here is basically the same as using digital IO. I'm just checking these switch values. You can also use some methods in the library for this chip that work kind of like a bit mask and grab in one message the state of all of the pins. So you can check or write all pins at once, which really could help speed things up if you had code that required it. For the code I'm doing here, it's actually working just fine. It doesn't need anything fancy, but the library has some nice provisions for sending one message back and forth from your microcontroller to the chip and setting all of the states or reading all of the states very quickly. So that's a nice bonus feature. If you look at the webpage here, let me grab that again. You'll see we have a link to some projects that have been done with it. Let's see, actually under the chip itself. So this is the sort of smaller version of this chip. So we sell that breakout. You just wanna put it on a breadboard or wire it up yourself. That's the chip here. We just have all the passives built right onto this. So it makes it easy and easier to plug into. The page here, and we'll probably add these to the other one page here. If you scroll down, you'll see some, there's the data sheet and there's some projects that use it. Here's a really cool one. Let's see right here that Liz Clark did, which is her MIDI xylophone. And to add enough IO to control, I don't know how many she's got, 40 something of these solenoids, she's using transistors to drive the solenoids, but the actual signal is coming from this very chip. So this very chip is able to multiply very quickly the amount of IO that you have. If you take a look at the learn guide for the chip itself, so here's a learn guide both for the 2308 and the 23017, which doubles it. This one has the 16 IO pins. This will go over how to run this in circuit. Python, we also have Arduino libraries for it as well. So this is a good starting point if you wanna know how to control it. And there are a couple of different ways that you can control this using either the digital IO type of code or some of these fancier methods that I mentioned before. So let's see, let me check if there's any questions people have, we can goof around with this drum a little more while we do that. So let's set some, I'm gonna change the drums out here. There we go, laser zap. Probably enough of that, but lots of fun for me. And let's see, over in our chat, let's walk my windows out here. There are some questions there about different driver boards. Depending on the project you're doing, you might use a servo driver which has the PWM. This, in fact, I think, I don't know if that's the one that you're asking about. I have a board, where did I put you down? Aha, this was this expander, the AW9523. It's a 16 pin expander that does, we call it a constant current LED driver. So this one's great for driving a bunch of LEDs. You'll notice here, I added, it has a similar arrangement where there's a ground and output pin or input pin stacked on top of each other. So if you use these type of headers, these double row headers, you can use those on this as well for quick prototyping and just plug LEDs. You probably want to resist her, but you could plug them in and get away with it usually. Or little Dupont connectors for switches right into the board. That's another way to do that. On this project, I've done it with a breadboard there. In fact, before we go, let me open this up so you can see what that looks like there. And I think these are not in very strong. I'll just use my thumbnail to unscrew those, sorry. So that's what's running it right there. You can see there's the MCP 23017 with eight wires running to LEDs and resistors on the top row there. And eight wires running to these switches here. So the only connection I need to the microcontroller is the STEMICUT cable. And I can use that over I squared C to control and read all those switches. So that is gonna do it. Don't forget you can head over to the product page and get the big discount during the show. That discount goes away after the show. So if you want to pile some of those into your cart, do it now. And that's about gonna wrap it up. That's my product pick of the week. It's the MCP 2301716 IO Expander. Thank you all again so much for stopping by for JP's product pick of the week. I will see you next time. Bye-bye.