Sean Carolan
S07:E54

Sean Carolan

Episode description

In this episode, Paul is joined by Sean Carolan. Sean shares how he used CoPilot with Claude Opus to create a Pac-Man clone in CircuitPython in just one day.

Show Notes

00:00 Intro

00:32 Sean’s start with computers

1:34 Choosing Pac-Man

2:30 Seeed Wio Terminal

4:04 Coding Pac-Man in CircuitPython

5:17 The game’s art assets

6:51 Re-creating the sounds of Pac-Man

8:29 Pac-Man on the Fruit Jam

9:51 What worked well when using Claude Opus for Ai

12:50 The challenges in using AI

14:14 Recommendations for someone just starting to use AI to code

16:38 Learn more about Sean

17:01 Which board?

18:36 Wrap-up

Download transcript (.srt)
0:02

- Welcome to the CircuitPython Show.

0:04

I'm your host, Paul Cutler.

0:06

This episode, I'm joined by Sean Carolan.

0:08

Sean is a maker and gardener in upstate New York

0:10

who enjoys playing video games

0:12

and building projects with CircuitPython.

0:15

Sean got his start with computers on a Commodore 64

0:17

and worked for Electronic Arts as a systems administrator.

0:21

Sean works as a sales engineer for Grafana Labs,

0:23

an open source monitoring and observability company.

0:27

He lives with his wife, two cats,

0:28

in a Shiba Inu near Albany, the state capital.

0:32

Sean, welcome to the show.

0:34

- Hi Paul, thanks for having me.

0:35

- Glad you're here.

0:36

How did you first get started with computers and electronics?

0:39

- Well, as a child, I went to a computer class

0:42

with my parents.

0:43

They decided, let's go and learn more about computers.

0:46

At that time, like, it wasn't really that common

0:49

for folks to have a personal computer in the home.

0:53

I was just getting started.

0:55

And I took this class and I was terribly shy and nerdy,

0:59

but I had a really nice lady instructor

1:01

who took a liking to me and encouraged me.

1:04

And she told my mom and dad,

1:06

"Hey, you should get this kid a computer."

1:08

So I was really, really lucky.

1:10

And a few months later Commodore 64 showed up

1:13

and I was, you know, love at first sight.

1:16

I jumped right in and, you know,

1:18

typed in the program from the magazine.

1:21

And it's been a lifelong journey since then,

1:24

you know, watching the technology evolve from these 8-bit machines, you know, to, you know,

1:31

supercomputers that you hold in your pocket.

1:34

You've created a Pac-Man clone written in Just Circuit Python.

1:37

Why choose Pac-Man?

1:40

Yeah, that's a great question.

1:42

Pac-Man was one of the first video games I remember playing as a kid.

1:47

You know, kind of a fun way to gauge someone's age.

1:50

Just ask them, "What is the first game you remember playing?"

1:52

You can kind of tell what era they're from.

1:55

So, meet Pac-Man.

1:57

It was in an ice cream parlor.

2:00

And we walked in and there was this machine

2:03

making beeps and boops and had color graphics.

2:06

And this was kind of mind-blowing

2:08

because before Pac-Man we had Space Invaders and Pong.

2:13

And they were okay.

2:14

But then all of a sudden there's this game

2:16

with color and ghosts and a little guy eating stuff.

2:21

I begged for a quarter to play the game and I've been hooked ever since.

2:26

I've been playing Pac-Man ever since 1981.

2:30

Before we get into how you coded it, tell me about the hardware you used to get Pac-Man

2:34

up and running, the Seeed WIO Terminal.

2:37

Yeah, so the Seeed WIO Terminal is a nice all-in-one microcontroller that comes with some fun accessories

2:44

like a display, it's got a little joystick, a few buttons.

2:48

even a light sensor on the back. And typically you'd program these devices with like Arduino

2:56

or something. And you know, Arduino is hard. You've got to download the IDE and learn how to

3:03

get the libraries in place. And I learned that this device was now supported on CircuitPython.

3:10

So I flashed it with CircuitPython and all of a sudden it became really easy to program.

3:16

With CircuitPython, you just basically edit a file, hit save, and then immediately it runs

3:22

on the device. So it's a really fun little device for prototyping. I had it sitting in a drawer.

3:28

I'd actually taken a stab at trying to build Pac-Man several months earlier. I got as far as

3:36

moving Pac-Man with the joystick. There was no maze, no ghosts. I put the Wio back in the

3:47

it's gotten easier to write code, you know, using like a coding assistant or copilot.

3:53

So I thought, well, why not give this a try, you know, pull the device out.

3:57

And I looked at it and thought, it's got a joystick.

3:59

The screen's about the right size.

4:02

This would look great, you know, running Pac-Man.

4:04

And so you were able to do that in just a day.

4:07

How were you able to code all of Pac-Man in CircuitPython in under a day?

4:12

Well, I had some help.

4:13

I did use AI and AI Copilot.

4:17

So it was actually Visual Studio Code, which is your programmer's editor.

4:23

And I used the built-in GitHub Copilot feature with the Cloud Opus 4.5 model.

4:33

And it took a lot of iteration and different exploring different avenues and kind of like

4:41

coaching the AI.

4:42

I was able to build it in a day with this co-pilot assistant, sort of doing the very

4:48

technical tasks like drawing the maze and working out the logic for the ghosts.

4:53

And I ended up actually acting more like a QA tester, sort of architect/tester, where

5:01

the co-pilot AI would write some code and then we would flash it to the device, and

5:07

then I'd play the game for a little bit and see what happened.

5:10

So that was the process.

5:13

Starting in the morning and by evening time, I had Pac-Man ready to ship.

5:17

Where did you get the art assets for the game?

5:20

So the art assets came from a site called Spriter's Resource.

5:25

Now this is a huge database of game sprites.

5:30

A lot of them are commercially owned, though.

5:32

So just a warning for the listeners out there.

5:36

Don't try to take Mario and build a game and sell it, because Nintendo will send its lawyers

5:42

after you.

5:43

But you can use these assets for free projects, demos, proofs of concept, as long as you're

5:51

not trying to commercially benefit from some licensed character.

5:56

It seems like it's an okay thing.

5:59

So Bandai Namco, please don't sue me.

6:01

I love Pac-Man.

6:03

This is a tribute to your awesome game and I don't make any money from it.

6:07

Anyway, Spriter's Resource.

6:09

Check it out.

6:09

There's a ton of cool sprite sheets that you can use.

6:12

There are also some other sites out there too where you can get free sprite sheets.

6:17

Another one I just found recently is called KENNY.

6:22

This developer kind of makes money just selling packs of assets for people who want to develop

6:29

games.

6:31

So you can download some of them for free.

6:33

If you want the whole collection, you pay.

6:36

It's kind of really cool because I'm not a graphic artist myself.

6:40

So it was really nice to discover that someone else had graphic titles and textures and things

6:45

that you could use right away for your game.

6:48

That's pretty neat.

6:48

I'll have to link to both of those in the show notes.

6:51

How did you replicate the sounds in the game?

6:54

The sounds of Pac-Man are very classic.

6:56

You know, they're sort of unforgettable.

6:58

like the waka waka waka, you know,

7:00

Pac-Man's eating dots.

7:01

And there's a little music, you know,

7:04

kind of a little jaunty little tune

7:05

that plays at the beginning of each level

7:08

to get you fired up and, you know,

7:09

get the player ready to play the level.

7:13

On the microcontroller, there is a little speaker.

7:17

And so with these microcontrollers,

7:18

you can actually kind of make beeps and boops

7:21

without having to download an MP3 or a digital sound file.

7:26

So I thought, let's just go retro.

7:28

we'll just try it, see what happens.

7:30

You know, if we send a signal to the speaker,

7:33

you could tweak it to get different notes, right?

7:36

And so I worked with, again, the co-pilot and said,

7:40

could you make the waka waka sound?

7:42

You know, and it's pretty close.

7:44

You can hear it when you play the game, you know,

7:47

Pac-Man just sort of doing that thing.

7:49

And then I really wanted to have the music, you know,

7:53

the start level music is so iconic

7:55

and it just sets the Pac-Man mood.

7:57

But the AI wasn't quite getting it right, you know.

8:01

So I went and found basically sheet music, the musical notation of the Pac-Man startup

8:08

song and fed that to the co-pilot AI.

8:12

And then it was able to write the song like, you know, pitch perfect.

8:16

No kidding.

8:17

That little doo-doo-doo-doo-doo-doo-doo, like music that starts the level.

8:22

It's very recognizable, right?

8:24

who played the original game will go, "Oh yeah, that's the song."

8:28

Pac-Man also runs on the Adafruit FruitJam.

8:31

How did that come to be?

8:33

That was entirely organic.

8:34

And it's one of the things I love about working with open source software and frameworks is

8:40

the community will pick up something and make it better.

8:44

So my afternoon project on one CircuitPython device, the WIO terminal, became something

8:51

that a whole lot more people can enjoy on the Fruit Jam.

8:55

Because the Fruit Jam, you can hook it up to a TV,

8:57

and it's got proper peripherals and sound and all of that.

9:02

So I just got this notification in GitHub one day,

9:07

and I looked, and someone had basically

9:09

ported the entire game to the Fruit Jam

9:12

and sent me a pull request, all tied up with a neat bow.

9:16

And it was really, really a nice thing.

9:18

So the community member, Cooper Dalrymple,

9:23

he's relic-se on GitHub, took what I wrote

9:27

and spent another afternoon porting it to the Fruit Jam.

9:32

So this is kind of the beauty and strength

9:34

of the CircuitPython platform.

9:36

These are two completely different microcontroller chips,

9:40

but because the code was written

9:41

in this CircuitPython language,

9:44

it was easy to map everything over.

9:46

So Cooper was also able to get that version working in one day.

9:50

>> That's amazing.

9:51

You mentioned that you used Copilot with Cloud Opus 4.5.

9:55

What was your overall experience using AI?

9:57

What worked well?

9:59

>> I'm kind of an AI skeptic, at least I was until so very recently.

10:05

Previous attempts to code using AI didn't go well.

10:09

This Opus 4.5 model though seems to have finally

10:14

reach a useful enough stage where you can give it

10:18

instructions, complex instructions,

10:21

or even have it help you make a plan.

10:23

And it gets eventually to the right answer.

10:27

And so that was the game changer.

10:30

Working with Claude Opus 4.5, I was

10:35

able to just express what I wanted out of the game

10:40

without having to worry too much about the technical details.

10:43

So there are a lot of small details in Pac-Man

10:46

that you'll notice if you study the game.

10:49

Each ghost has its own personality and behavior.

10:53

And they actually change the behavior

10:56

from kind of go back to the corners,

10:59

and then about 9 or 10 seconds later, they flip.

11:03

And you can see the change in the movement.

11:05

Like if you watch the game of Pac-Man,

11:07

the ghosts will be sort of looking

11:08

like they're just randomly moving.

11:10

And then all of a sudden, the red ghost

11:12

starts coming like, you know, for Pac-Man,

11:15

like the Terminator, you know, beeline.

11:18

You know, the other ghosts have complex, like AI

11:20

that tries to chase, you know,

11:23

four squares ahead of where Pac-Man is.

11:26

Here's a pro tip.

11:27

If the pink ghost is in front of you, run towards her.

11:30

- Good to know.

11:32

- Pinky will run away.

11:33

So it's the one ghost you can do that with.

11:35

Don't panic, just run towards Pinky if you get boxed in,

11:39

and then you might be able to escape.

11:41

That was one of the things I really wanted to replicate

11:45

because the original arcade has the ghost AI

11:49

that is unforgettable.

11:52

And so I just told Claude,

11:55

"Could you please make this just like the arcade,

11:59

authentic AI?"

12:01

And it knew what I meant.

12:03

And that was really insightful to me.

12:05

I didn't have to go explain or figure out,

12:07

to go research what Blinky was supposed to do.

12:10

And that all just came in organically.

12:14

And then I was just able to test the game and play it

12:16

and go, yeah, that looks right.

12:18

That feels right.

12:19

The ghosts kind of are acting the way they did in the arcade.

12:23

- So it's really like you said before,

12:24

you were the architect giving it the strict prompts

12:26

or re-prompts to do it again.

12:29

And then you just got to play it

12:30

and be the QA tester over and over again.

12:33

- Yeah, that's what's new and game changing,

12:36

if I may make a pun about this whole thing,

12:39

is that you can now write code entirely without an IDE,

12:44

right, without a text editor,

12:46

and actually build useful and entertaining software.

12:50

- So that's what worked well.

12:51

What were the challenges in using AI?

12:54

- Oh, there were lots, especially in the beginning.

12:58

I spent a ton of time just trying to figure out

13:02

how to not get the ghosts to get stuck in the walls.

13:06

It sounds silly,

13:07

but these are the things you have to account for,

13:09

you know, in an arcade game.

13:11

It's like, well, where am I allowed to move?

13:14

And, you know, in every loop of the program,

13:16

you have to detect, am I touching a wall

13:19

or am I close to a wall?

13:22

So there were some weird bugs that emerged, right?

13:25

Like Pac-Man goes out of the maze and just disappears.

13:31

Whereas, you know, he's supposed to go through the tunnel

13:33

and come back through the other side, right?

13:35

So we had to iterate through that.

13:38

Another bug that I found was that Pac-Man

13:40

could get inside the ghost box.

13:43

And in the arcade game, Pac-Man doesn't go in the ghost box.

13:45

It's a one-way door.

13:47

So each of these things came up and I had to tell Claude,

13:52

no, can you please fix this or make it like this?

13:56

It's not quite right.

13:58

Yeah, so it's sort of weird, right?

14:00

Because now the computer or the AI is doing the work.

14:05

and you are the organic eyes and fingers that play the game and test it.

14:12

It's a strange feeling, you know?

14:15

What recommendations would you have for someone interested in programming with AI?

14:20

Start small and pick a little project that you can tackle.

14:26

I recommend a browser-based retro game.

14:30

Because web browsers nowadays are very powerful.

14:34

They come with all sorts of built-in stuff that you can do with JavaScript that lets you build almost any classic video game, especially Atari games.

14:47

You might start with something like Breakout because it's very simple.

14:51

You don't need a bunch of graphics because it's rectangles and a ball and basically some physics, right?

15:00

but start small and have a plan.

15:05

When you start to code with AI,

15:08

especially cloud code,

15:10

you can use directly in the terminal,

15:12

or you can do this with GitHub Copilot too.

15:15

But the first step should always be, let's make a plan.

15:19

And most of these AIs will understand what you mean

15:22

and go into sort of plan mode

15:24

where they deeply research a topic

15:27

and try to work out any kinks ahead of time.

15:29

And then it presents you back the plan.

15:32

So you can review the plan and say, yeah, that looks good,

15:35

or I'd like to make some changes.

15:37

Sometimes it'll even interrogate you a little bit.

15:40

I noticed Cloud Code does this, where it'll say,

15:44

do you want retro sprites for your Space Invaders game?

15:49

Do you need a high score thing at the top?

15:52

And it'll ask you some preference-like questions

15:55

before it actually initiates and starts building stuff.

15:59

Other point of advice is don't over-task the AI.

16:03

Make it break all of the things down into stages.

16:07

The way I was able to build Pac-Man in a day

16:10

was just in little bites, again with the puns,

16:13

but I can't help it, sorry.

16:16

- No, it's all good.

16:18

- Bite off a little bit at a time, right?

16:20

And get something working and then iterate,

16:24

add some more and keep going.

16:27

And then, you know, you'll eventually get to the goal, right?

16:31

But do it in smaller steps.

16:33

So those are my pointers for like coding with AI.

16:36

- That's good advice.

16:37

If anyone wants to learn more about you and your work,

16:40

where should they go?

16:42

- I've got a GitHub pages site.

16:44

So it's just scarolan.github.io.

16:48

And that's got my portfolio and a bunch of stuff.

16:51

You can also find me on LinkedIn,

16:53

just search for Sean Carolan

16:54

and I'll show up somewhere in the top five.

16:57

- I'll make sure we link to that

16:58

in the show notes as well.

17:00

Last question I ask each guest,

17:02

if starting a new CircuitPython or microcontroller project,

17:06

which board do you reach for?

17:08

- So it depends on the use case.

17:11

If we're talking about like a wearable,

17:14

I would go with the Circuit Playground.

17:18

So Adafruit makes this gorgeous like round device

17:23

that is so fun and it's got Bluetooth

17:26

and NeoPixels around the edges.

17:29

You can even use it without soldering.

17:32

So you could take alligator clips to this thing

17:35

or even like conductive thread, right?

17:38

If you are into like textiles and sewing,

17:41

you can literally like sew an interactive costume

17:45

using a circuit Python.

17:47

If it's a smaller like IoT device

17:50

or something that needs to be very low powered,

17:53

I'll typically go with like the Seeed Xiao.

17:57

It's a tiny little, you know,

17:59

like stamp sized microcontroller.

18:03

Also the Adafruit QT PY.

18:06

My go-to chip is like ESP32 S3.

18:11

I like it 'cause it's got really good

18:13

like deep sleep capabilities.

18:15

So I actually have outside in the garden,

18:18

a device that spends most of its time sleeping,

18:21

but that's 'cause it's got a battery and a solar panel,

18:25

right, so it just wakes up, it does its little thing,

18:29

and then it goes back to sleep.

18:31

And you can run all these things.

18:33

CircuitPython runs all of them nowadays.

18:35

It's amazing.

18:36

- Those are great choices.

18:37

Sean, thanks so much for coming on the show.

18:40

- Hey, thanks for having me.

18:42

- Thank you for listening to the CircuitPython Show.

18:45

For show notes and transcript,

18:46

please visit www.circuitpythonshow.com.

18:50

Until next time, stay positive.