1 00:00:00,720 --> 00:00:01,440 (soft music) 2 00:00:05,220 --> 00:00:06,920 - Welcome to the CircuitPython Show. 3 00:00:07,300 --> 00:00:08,340 I'm your host, Paul Cutler. 4 00:00:09,000 --> 00:00:10,800 This episode, I welcome Dan Cogliano. 5 00:00:11,580 --> 00:00:13,360 Dan is a developer whose interests include 6 00:00:13,580 --> 00:00:15,500 internet calendar standards, programming, 7 00:00:16,280 --> 00:00:18,440 retro tech and games, the internet of things, 8 00:00:18,720 --> 00:00:20,220 ventriloquism, and magic. 9 00:00:22,160 --> 00:00:23,240 Dan, welcome to the show. 10 00:00:24,400 --> 00:00:25,360 - Thank you for having me. 11 00:00:25,680 --> 00:00:29,160 This is my first podcast, so it's a special time for me. 12 00:00:29,360 --> 00:00:30,080 (laughs) 13 00:00:30,920 --> 00:00:31,860 - How did you first get started 14 00:00:31,980 --> 00:00:33,200 with computers and electronics? 15 00:00:34,180 --> 00:00:36,560 - Well, my first experience with a computer 16 00:00:36,720 --> 00:00:37,680 was in high school. 17 00:00:38,480 --> 00:00:42,100 I'm a little bit old, so the programming class 18 00:00:42,180 --> 00:00:43,920 they had in high school was Fortran. 19 00:00:44,600 --> 00:00:48,860 This was back in the '70s, and we had one computer 20 00:00:49,120 --> 00:00:50,160 throughout the whole county 21 00:00:50,300 --> 00:00:52,540 that would run Fortran programs, 22 00:00:52,900 --> 00:00:53,860 and it wasn't my school. 23 00:00:54,700 --> 00:00:58,279 What we'd have to do is we'd have to code our programs 24 00:00:58,280 --> 00:01:00,040 and send it to the school. 25 00:01:00,660 --> 00:01:02,960 They'd run the program and then they'd send it back. 26 00:01:03,020 --> 00:01:04,280 So it was like a three day turnaround. 27 00:01:05,420 --> 00:01:07,100 In fact, we didn't even have punch cards. 28 00:01:07,100 --> 00:01:10,160 We didn't even have money for punch card machines. 29 00:01:10,320 --> 00:01:14,540 So we had holo with cards with bubbles on them. 30 00:01:14,660 --> 00:01:18,820 So you would code using a Sharpie for Fortran statements 31 00:01:18,920 --> 00:01:19,840 and that sort of thing. 32 00:01:19,980 --> 00:01:24,080 So yeah, so it would take literally three days 33 00:01:24,520 --> 00:01:27,200 to put in a program and get your output back. 34 00:01:27,280 --> 00:01:31,140 So we had to double, triple check our code 35 00:01:31,340 --> 00:01:32,380 before we'd send it out, 36 00:01:32,840 --> 00:01:34,820 'cause we won't see it for three days. 37 00:01:34,960 --> 00:01:39,100 So that was kind of my first step into programming. 38 00:01:39,400 --> 00:01:42,380 And then in college, I took some classes. 39 00:01:42,450 --> 00:01:44,000 I took a Pascal class. 40 00:01:44,860 --> 00:01:46,620 I took an assembly class, 41 00:01:46,670 --> 00:01:49,500 which was on the Motorola 6502, 42 00:01:49,700 --> 00:01:53,540 which is the chip that was used on the early Macintoshes 43 00:01:53,600 --> 00:01:55,980 and Apple IIs, I believe. 44 00:01:56,100 --> 00:01:59,860 And so I learned machine assembly language 45 00:01:59,980 --> 00:02:01,860 with that class, which I thought was really good. 46 00:02:03,040 --> 00:02:04,680 I had a programmable calculator. 47 00:02:04,820 --> 00:02:07,000 Those were getting very popular at the time. 48 00:02:07,200 --> 00:02:10,820 So I had an HP 41 calculator. 49 00:02:10,880 --> 00:02:13,720 So that was a good learning experience. 50 00:02:13,920 --> 00:02:17,800 And then after college, I got an Amiga computer 51 00:02:17,940 --> 00:02:21,520 and I started writing shareware programs on the Amiga. 52 00:02:22,220 --> 00:02:24,900 So then I got into C and C++. 53 00:02:25,860 --> 00:02:29,880 And then later I started getting into Arduino. 54 00:02:30,820 --> 00:02:32,940 And funny story, I didn't get into Arduino 55 00:02:33,080 --> 00:02:35,800 'cause I didn't know if I wanted to learn another language 56 00:02:35,960 --> 00:02:37,140 and I realized, oh, that's C. 57 00:02:37,480 --> 00:02:37,840 (laughs) 58 00:02:37,840 --> 00:02:40,200 I didn't, it took me like a year, I think, 59 00:02:40,280 --> 00:02:43,380 before I realized, oh, that Arduino is C and C++. 60 00:02:43,660 --> 00:02:46,340 So that's kind of like how I got started. 61 00:02:47,600 --> 00:02:49,060 - How did you discover CircuitPython? 62 00:02:51,540 --> 00:02:55,219 - Well, CircuitPython, I got into Arduino 63 00:02:55,220 --> 00:02:59,720 And a lot of the processors that worked with Arduino 64 00:03:00,330 --> 00:03:01,600 also worked with CircuitPython. 65 00:03:02,440 --> 00:03:07,120 I dabbled in that and one of my first projects 66 00:03:07,900 --> 00:03:10,940 was something called the EasyMake Oven, 67 00:03:12,060 --> 00:03:14,920 which it's a reflow oven. 68 00:03:15,780 --> 00:03:18,760 And I was looking at reflow ovens at the time 69 00:03:18,900 --> 00:03:23,219 and we had a lot of Chinese manufacturers 70 00:03:23,220 --> 00:03:31,240 And we had all these reviews and they were using paper insulation and they were not very 71 00:03:31,360 --> 00:03:31,780 high quality. 72 00:03:31,810 --> 00:03:33,540 I thought, "Well, what if I made my own?" 73 00:03:33,540 --> 00:03:34,480 And I kind of looked around. 74 00:03:34,480 --> 00:03:38,420 I looked at the Adafruit store and I said, "Hey, they've got all the parts I need except 75 00:03:38,520 --> 00:03:39,339 for the toaster oven." 76 00:03:39,830 --> 00:03:42,600 I basically converted a toaster oven into a reflow oven. 77 00:03:43,420 --> 00:03:48,880 So I took the toaster oven, Pi Portal, which was an Adafruit product that had just come 78 00:03:48,820 --> 00:03:54,540 out. I had a thermocouple, which is kind of like measures the temperature inside the toaster oven. 79 00:03:54,940 --> 00:04:00,620 Then there was a switch, basically a, looked like a power strip, but you can program this power 80 00:04:00,700 --> 00:04:05,640 strip to turn on and off. And I didn't want to do any kind of high voltage wiring. So I thought, 81 00:04:05,670 --> 00:04:10,660 hey, I can just regulate this by just programmatically turning the toaster oven on and 82 00:04:10,880 --> 00:04:16,479 off. And I can graph it, you know, the temperature versus time. And I, that's how I came up with the 83 00:04:16,900 --> 00:04:21,920 the EasyMake oven. So it's actually one of my favorite projects and I still use it. 84 00:04:22,580 --> 00:04:26,680 I love the name of it. And that was my next question was actually if you were still using it, 85 00:04:26,740 --> 00:04:31,220 so it's good to hear that it's still around. Yeah, yeah. I mean, and for people who don't 86 00:04:31,240 --> 00:04:36,480 know what a reflow oven is, it's basically, you know, you could do through-hole soldering, but 87 00:04:36,780 --> 00:04:42,019 if you want to get into PCBs and smaller components, then that's where you would use a 88 00:04:42,020 --> 00:04:48,280 a reflow oven. So yeah, I have some things that have some small parts that the reflow 89 00:04:48,340 --> 00:04:52,240 oven is ideal for making components like that. 90 00:04:53,540 --> 00:04:58,640 You've created the Z-Machine, which can run classic Zork games. How did that first start 91 00:04:58,760 --> 00:04:59,080 for you? 92 00:04:59,720 --> 00:05:08,539 It started out with Arduino. I wrote a, or I ported a Z-Machine to Arduino on an Adafruit 93 00:05:08,540 --> 00:05:17,600 itsy-bitsy device, which is really like the size of your thumb. And I ported that using Arduino NC. 94 00:05:18,100 --> 00:05:23,800 And I thought at the time, I'd like to do that in CircuitPython too at some point. But back then, 95 00:05:24,280 --> 00:05:33,540 the hardware, you basically needed a screen, enough memory. And so what I did was, 96 00:05:34,300 --> 00:05:42,540 I kind of put that on the side and then when I saw the fruit jam come out, I said, "Oh, this would be perfect for that." 97 00:05:42,540 --> 00:05:50,480 It's got the keyboard, it's got the screen, it's got memory, enough memory, you can save files to it. 98 00:05:51,100 --> 00:05:53,940 So it had basically all the parts that I needed for the Z machine. 99 00:05:54,480 --> 00:05:59,140 So I guess the only question I had was how the performance would be, 100 00:05:59,180 --> 00:06:05,020 since you've got an interpreted language running an interpreted computer. 101 00:06:05,240 --> 00:06:09,900 So I thought, well, I want to go with this and see how far I get with it. 102 00:06:10,620 --> 00:06:12,140 And that's kind of how it came about. 103 00:06:12,160 --> 00:06:15,080 And I think the performance turned out great. 104 00:06:15,080 --> 00:06:18,040 I was really impressed with the performance. 105 00:06:19,000 --> 00:06:20,780 What are some of the features of CPZMachine? 106 00:06:20,960 --> 00:06:22,400 How does someone get started with it? 107 00:06:23,600 --> 00:06:29,160 Well, we have, you can run it either standalone or there's something called 108 00:06:29,160 --> 00:06:36,920 which is a way you can run pre-packaged CircuitPython games and applications. 109 00:06:37,860 --> 00:06:39,360 So you can run it either way. 110 00:06:41,120 --> 00:06:45,180 So the performance was one thing I was looking at, and that turned out really nice. 111 00:06:46,420 --> 00:06:54,380 The save game, there's an issue with CircuitPython where you have one operating system that can read and write, 112 00:06:54,380 --> 00:06:57,820 and the other operating system can only do read-only. 113 00:06:58,120 --> 00:07:03,820 So the nice thing about CircuitPython version 10 is that they have a saves or 114 00:07:03,920 --> 00:07:11,260 cpsaves folder which allows you to have the CircuitPython operating system read 115 00:07:11,320 --> 00:07:18,360 and write those files in that saves folder while the host computer has 116 00:07:18,480 --> 00:07:22,420 read and write access so you can copy files and you can copy the CircuitPython 117 00:07:22,420 --> 00:07:29,120 libraries, you know, the CPZ machine, the game files, so you can do all that and still 118 00:07:29,240 --> 00:07:31,780 have rewrite access for the save games. 119 00:07:34,020 --> 00:07:38,720 Save is really important when you're playing Zork and Z machine games, because you can 120 00:07:38,800 --> 00:07:41,620 die and you lose what you have. 121 00:07:43,240 --> 00:07:49,700 So that was one nice thing that came out with CircuitPython 10 recently, so that was a big 122 00:07:49,820 --> 00:07:50,180 help too. 123 00:07:50,620 --> 00:07:57,380 Yeah, that CP saves partition is pretty neat for creating games now. You're not the first one to take advantage of that. 124 00:07:57,780 --> 00:07:58,600 Mm-hmm. 125 00:07:59,220 --> 00:08:01,620 Were there any challenges in creating the CPZ machine? 126 00:08:02,840 --> 00:08:08,520 Yeah, well, it's an interpreted, almost like assembly language. So I kind of 127 00:08:09,420 --> 00:08:11,300 resurrected my skills from college days, 128 00:08:12,000 --> 00:08:13,060 assembly language, and 129 00:08:13,760 --> 00:08:19,520 basically, there's a bunch of machine codes that you have to emulate and then you have to debug them. 130 00:08:19,520 --> 00:08:23,200 And so the debugging part is the hard part where you have to step through and say, 131 00:08:23,700 --> 00:08:28,200 you know, is this what it's supposed to be doing? So that took the most amount of time, was 132 00:08:29,220 --> 00:08:36,219 writing the machine codes and debugging them. And so what I did was, you know, since ZMachine's 133 00:08:36,219 --> 00:08:42,139 been around forever, there's other implementations of it. So I took a ZMachine that someone else 134 00:08:42,080 --> 00:08:50,360 wrote in C, and I put some debug statements so I could follow that version and compare it to the 135 00:08:50,500 --> 00:08:54,480 version I was writing and see when they diverged and say, "Oh, you know what? Why is my program 136 00:08:54,600 --> 00:08:59,280 diverging at this point? I'll go back to the reference C machine that I'm working with." 137 00:08:59,280 --> 00:09:06,960 And I said, "Oh, okay. I forgot something or whatever." So, yeah. So, that was very helpful. 138 00:09:08,310 --> 00:09:12,060 So, for those that might be a little younger than us, can you take a minute to explain what 139 00:09:12,060 --> 00:09:12,900 game Zork is? 140 00:09:13,870 --> 00:09:25,840 >> The Zork came out in the '80s. It was developed by staff and students at MIT. It came off of a, I believe it was a PDP-11 141 00:09:26,420 --> 00:09:42,040 computer, and they decided to commercialize it. Back in the '80s, you know, the computers were not very powerful, but there was a lot of 142 00:09:42,040 --> 00:09:44,980 different computers out there, they all ran different software. 143 00:09:45,750 --> 00:09:49,600 And so they thought, well, we're going to try to write something that will work on all 144 00:09:49,680 --> 00:09:50,760 these devices. 145 00:09:51,240 --> 00:09:55,300 And they decided to split the program in two. 146 00:09:55,400 --> 00:10:03,140 They took one part of it, which was the story, basically the data that had all the text and 147 00:10:03,400 --> 00:10:04,000 the logic. 148 00:10:04,820 --> 00:10:05,800 That was one part of it. 149 00:10:06,370 --> 00:10:09,580 And that part could run on any of the computers that were out there in the day. 150 00:10:09,800 --> 00:10:17,660 only part they had to write was the machine codes for that particular operating system. 151 00:10:18,260 --> 00:10:25,020 So that way they were able to maximize their stories and the logic there and just have to 152 00:10:25,300 --> 00:10:31,860 write what they call the Z machine, which is the program that runs the Zork game. 153 00:10:32,380 --> 00:10:37,480 And they came out with other games too, not just Zork, but they have Zork 2, Zork 3, and there's 154 00:10:38,200 --> 00:10:43,020 probably several dozen ZMachine type games that you could run on it. 155 00:10:43,610 --> 00:10:45,800 And the CPZMachine supports all those games? 156 00:10:46,590 --> 00:10:52,860 It supports version 3, which was the first version that came out. I'm probably going to look at 157 00:10:53,460 --> 00:10:56,940 supporting other versions in the future, but I think the majority of them are version 3, 158 00:10:56,990 --> 00:11:04,240 so you get most of them with that. And I'm also working on a learn guide for the 159 00:11:04,680 --> 00:11:11,600 CPC machine and Zwork and all that. So hopefully that'll be out by the time this airs. 160 00:11:11,990 --> 00:11:14,820 Yeah, I'll make sure that if it is, I'll link to it in the show notes as well. 161 00:11:15,730 --> 00:11:18,940 Tell me about the latest game you've been working on, a Moonlander type game. 162 00:11:20,140 --> 00:11:24,560 Yeah, so once I finished with the Z-Machine, I thought, well, 163 00:11:25,300 --> 00:11:30,180 now I think get something a little bit more graphical. Zwork and Z-Machine's all text-based, 164 00:11:30,180 --> 00:11:36,220 there's no graphics. In fact, the only graphics is I have a blinking cursor. It's a little square 165 00:11:36,320 --> 00:11:41,680 that I turn on and off. So that was that was the extent of my graphics with the Z machine. But 166 00:11:42,260 --> 00:11:45,240 I thought I want to try to get a little more fancy. And one of the games I liked when I was 167 00:11:45,260 --> 00:11:51,420 in college was this lunar lander game where you take the lunar module and you try to land it on 168 00:11:51,420 --> 00:11:56,980 the moon. And I thought, well, I'm going to make a version of that and see what I can do in Circuit 169 00:11:56,980 --> 00:12:02,480 Python. So I've been working on that. It's basically a physics-based game where you're 170 00:12:02,940 --> 00:12:10,040 trying to land without crashing on the moon, and so you have to deal with gravity thrust from the 171 00:12:10,480 --> 00:12:15,940 rocket angles. And you want to land vertically, you don't want to land on your side, which 172 00:12:17,580 --> 00:12:26,960 is happening on the moon recently. So I thought, "Yeah, this will be something nice to do." And 173 00:12:26,960 --> 00:12:28,940 at some point in the near future. 174 00:12:29,600 --> 00:12:31,920 - What's your experience been working with graphics 175 00:12:31,920 --> 00:12:32,740 and display IO? 176 00:12:32,900 --> 00:12:33,760 Has it been a challenge? 177 00:12:34,740 --> 00:12:37,220 - And CircuitPython, it's great for a lot of things, 178 00:12:37,340 --> 00:12:40,180 but sometimes, heavy graphics, 179 00:12:40,400 --> 00:12:44,820 it's particularly real-time graphics, it's hard to do. 180 00:12:44,980 --> 00:12:49,300 So sometimes I have to change my mind on what I wanna do. 181 00:12:49,400 --> 00:12:51,560 Like I originally wanted to have a scrolling background 182 00:12:52,740 --> 00:12:55,420 with my Lunar Lander scrolling, 183 00:12:55,760 --> 00:12:57,120 looking at the lunar surface. 184 00:12:57,340 --> 00:13:01,140 And I thought, well, I took a look at trying that. 185 00:13:01,760 --> 00:13:03,340 And I was using a high resolution, 186 00:13:03,520 --> 00:13:05,120 which is also what I wanted to do. 187 00:13:05,280 --> 00:13:07,960 And so higher resolution means, you know, 188 00:13:08,000 --> 00:13:11,420 you got more bits to work with and it slows things down. 189 00:13:11,620 --> 00:13:13,540 So the trade-off was, you know, 190 00:13:13,620 --> 00:13:15,500 either lower resolution and higher, 191 00:13:16,180 --> 00:13:18,920 you know, scrolling or higher resolution. 192 00:13:19,120 --> 00:13:21,100 And then, so I kind of do is I just page, 193 00:13:21,180 --> 00:13:22,640 I go from one page to the next. 194 00:13:22,700 --> 00:13:24,620 I don't do the scrolling. 195 00:13:24,760 --> 00:13:27,940 So that was fine. 196 00:13:30,460 --> 00:13:33,240 I think it works great, and you just 197 00:13:33,320 --> 00:13:36,220 get a slight delay when you go from one screen to the next. 198 00:13:37,520 --> 00:13:39,820 If anyone wants to learn more about you and your work, 199 00:13:39,880 --> 00:13:40,540 where should they go? 200 00:13:41,540 --> 00:13:44,980 Well, I'm on Blue Sky at Cogliano. 201 00:13:45,500 --> 00:13:49,040 My last name's C-O-G-L-I-A-N-O. And I 202 00:13:49,040 --> 00:13:51,520 do have some Learn Guides up there on the Adafruit site, 203 00:13:51,620 --> 00:13:54,180 so you can check out some other Learn Guides. 204 00:13:54,320 --> 00:13:57,700 I've got a few other CircuitPython learn guides there. 205 00:13:57,700 --> 00:14:01,420 I have one where I, related to the EasyMakeOven, 206 00:14:02,040 --> 00:14:03,940 I use the PyPortal. 207 00:14:04,520 --> 00:14:07,640 And I didn't, in that case, I did not use the feature 208 00:14:07,760 --> 00:14:09,340 where you'd be able to get to the internet, 209 00:14:09,540 --> 00:14:10,820 'cause I didn't need the internet for that. 210 00:14:11,500 --> 00:14:15,580 But I do have another project where I pull artwork down 211 00:14:15,720 --> 00:14:17,700 from the Museum of Art in Cleveland. 212 00:14:18,000 --> 00:14:22,900 So it kind of cycles through images there. 213 00:14:24,080 --> 00:14:26,340 I'll make sure to link to those in the show notes as well. 214 00:14:27,580 --> 00:14:28,920 Last question I ask each guest, 215 00:14:29,040 --> 00:14:30,920 you're starting a new project or prototype, 216 00:14:31,560 --> 00:14:32,660 which board do you reach for? 217 00:14:33,980 --> 00:14:35,880 Well, right now it's the Fruit Jam. 218 00:14:36,540 --> 00:14:38,320 I'm really excited about the Fruit Jam. 219 00:14:39,160 --> 00:14:40,760 I think there's a lot of potential there, 220 00:14:41,060 --> 00:14:44,260 and I've seen some of the emulators that have come out. 221 00:14:45,480 --> 00:14:47,160 There's the Mac emulator, 222 00:14:47,420 --> 00:14:48,580 which is something I want to try. 223 00:14:49,320 --> 00:14:51,580 It's not just CircuitPython or Arduino, 224 00:14:51,580 --> 00:14:57,960 but you know, you have these emulators. So it's got the gamut of options there for you. 225 00:14:58,860 --> 00:15:02,160 I'll probably be sticking with CircuitPython, but I do want to try some of these emulators. 226 00:15:03,120 --> 00:15:06,820 Yeah, I agree. There's a new 286 emulator that just came out, and Apple II, 227 00:15:06,980 --> 00:15:11,180 Sega Genesis. It's just crazy how much support is coming out for the Fruit Jam. 228 00:15:13,140 --> 00:15:14,600 Dan, thanks so much for coming on the show. 229 00:15:15,100 --> 00:15:21,940 Oh, I appreciate it. I love being here and I appreciate getting invited. Thank you.