River Wang
S06:E51

River Wang

Episode description

Paul welcomes River Wang to the show. River was a STEAM teacher before becoming a full time software developer 3 years ago. He created the CircuitPython Online IDE, a browser based platform that allows users to work on a CircuitPython project on the web or as a self-hosted website.

Follow the show on Mastodon or Bluesky.

Show Notes

00:00 Intro

00:29 River’s start with computers and electronics

3:42 River’s start with Python

4:31 Teaching

5:42 Discovering CircuitPython

9:18 Creating the CircuitPython Online IDE

13:04 How the CircuitPython Online IDE works

14:28 The challenges in building the CircuitPython Online IDE

20:34 Self-hosting the CircuitPython Online IDE

19:02 How the CircuitPython Online IDE helps educators

20:34 CircuitPython Online IDE’s key features

23:13 What’s next for the CircuitPython Online IDE

24:41 How to support the CircuitPython Online IDE

25:05 Where to learn more

25:23 Which board?

Download transcript (.srt)
0:02

Welcome to the CircuitPython Show. I'm your host, Paul Cutler. This episode, I welcome

0:07

River Wang. River was a Steam teacher before becoming a full-time software developer three

0:11

years ago. He created the CircuitPython Online IDE, a browser-based platform that allows

0:17

users to work on a CircuitPython project on the web or as a self-hosted website.

0:25

- River, welcome to the show.

0:27

- Great to be on the show.

0:29

- How did you first get started

0:30

with computers and electronics?

0:32

- So unlike many guests,

0:34

I didn't have a Commodore 64 when I was a child.

0:38

So all the journey started when I go to the college.

0:42

My major was electrical engineering.

0:45

So in my freshman year,

0:46

we had a C++ programming course.

0:49

That is pretty standard.

0:52

So it was boring at the beginning, I would say,

0:55

just as you were variables, if-else,

0:58

for-loop, something like that.

1:00

But there was a homework problem to print out

1:03

a pyramid in the terminal.

1:05

So basically, you do one star in the first row,

1:08

two star in the second, and et cetera.

1:10

And the problem was actually pretty easy.

1:14

But I suddenly realized that even if I am in a terminal,

1:19

just plain tasks, I'm actually doing graphics.

1:22

And if I can do this periodically

1:25

with slight change in the between,

1:28

I can actually do graphics, right?

1:30

And if I can capture user inputs,

1:34

and this is basically a video game.

1:36

So I spent a whole night writing 200 lines of C++,

1:41

and I got a snake game working.

1:44

So I was very, very excited.

1:46

And that was the first time I found coding is pretty fun.

1:51

And in terms of electronics, it's

1:54

very natural because I was in the electric engineering

1:57

department.

1:58

And what we had was we had a lot of microcontroller computations.

2:04

We have projects, and we do presentations,

2:08

and we hosted some booths for our classmates

2:11

to come and play with the demos.

2:13

So basically, it kind of makes a fair thing.

2:17

So my first project was an assistive device

2:21

for people who cannot use regular mouse.

2:24

We put gyros and accelerometers inside a hat

2:29

so people can move their neck to move the cursor.

2:33

And it was based on C51 microcontrollers back in the days.

2:38

And the USB part was done by a separate chip

2:41

called USB-D12.

2:45

And another device I joined the competition

2:49

was a competition hosted by a wireless sensor lab.

2:55

So they provided us a lot of MSP430 microcontrollers,

2:59

which are first ultra low power, and second,

3:03

they have a great computational power

3:05

that you can do FFTs on board.

3:08

And they give us these chips and want

3:10

to know what kind of sensor applications we can do.

3:14

But what I made was a game handheld out of it again.

3:19

I just want to be fun.

3:21

So instead of doing some classic games like Snake, Tetris,

3:25

what I did was I copied many of the popular phone games

3:29

back in the days, like Flappy Bird, 2048, and Dodo Jump.

3:34

And I also did a little bit of research

3:37

to do a connect file, which was a strategy.

3:42

How did you get started with Python?

3:44

So that was when I went to graduate school, my research work requires a lot of

3:50

scientific computation, uh, scientific programming and school bought us metal

3:56

at license for scientific programming.

4:00

And it was very popular in engineering departments.

4:03

And I actually like it a lot, unpopular, I'll bet you.

4:08

I even use it for my personal projects,

4:10

such as I did synthesizers, I did task processing,

4:14

and I think I should use this even after I graduate.

4:18

So I checked the price for a personal license a year,

4:22

well, so high.

4:24

So I realized I need to look for some alternatives,

4:27

so I switched to Python to use NumPy and SciPy.

4:31

- You mentioned that you were a STEAM teacher.

4:33

What were you teaching?

4:35

In my last few years in the graduate school, I got a part-time job teaching

4:40

the outreach program in the electric engineering department.

4:44

So basically the outreach program is we use university resources, such as labs,

4:50

faculties to teach some field trips and summer camps to local school districts,

4:58

like high school, middle school, and sometimes primary school.

5:01

So in our automation lab, we got 3D printers, we have software stations, and computers installed with Arduino IDE and AVR Studio.

5:15

So we create courses of different levels.

5:19

And microcontroller was always my favorite topic because it has a bit circuit, a bit programming.

5:28

And we usually use the RGB LED in our projects.

5:33

And we have 3D printers, so we print out 3D cases onto that.

5:38

So it's also a very good amount of art in it.

5:41

How did you discover CircuitPython?

5:44

So we had a very nice lab setup.

5:47

And everything worked very well in the beginning.

5:50

And then suddenly, the pandemic hit us.

5:53

and schools are shut down and no one can come to the lab.

5:58

And many departments in our university, they just shut down their outreach program because of this.

6:05

And we tried to survive, and we tried to mimic everything in our lab with the remote learning experience.

6:14

So some parts are very easy.

6:16

The lectures can be given by Zoom, and we use Zoom for small group discussions.

6:22

and we ship the lab kits to the students,

6:26

and 3D printed models are printed in the lab,

6:29

and we ship the result to the students.

6:32

And for soldering, we pre-solder the sockets

6:36

onto the PCB board,

6:39

and students insert the components into the socket.

6:42

But one part is actually very hard,

6:45

is we didn't know how to get the students

6:49

to write program to the microcontroller.

6:52

So two sides.

6:54

On the hardware side, it's like we used ATtiny chips to lower the cost for the students.

7:01

And in the lab, we used some special device to write program onto ATtiny chips.

7:07

I think the previous teacher used a debugger or GTAC or something like that.

7:12

I used a programmer.

7:14

And those devices are very special first and very expensive.

7:19

And we cannot ship these devices to students.

7:22

And second, on the software side,

7:25

it's like first, students are at home, not in school.

7:30

So they have all different kinds of computers.

7:34

And some use PC, some use Mac.

7:36

And a majority of the students are actually using Chromebooks

7:41

and actually locked down by the school districts.

7:44

So it's very, very hard.

7:46

First, because so many platforms,

7:48

we don't know how to teach them to install the IDEs onto their computers.

7:54

And second, if they are using Chromebook, it's almost impossible to install anything.

7:59

And even when it is possible, we just found out the setup process is not very easy.

8:06

So at that time, I was looking for solutions that students can program their microcontrollers.

8:13

First, no special hardware needed.

8:16

And second, no special software needed.

8:19

I wasn't very optimistic at the beginning,

8:22

but I actually found two solutions.

8:25

And MakeCode was the solution for younger kids.

8:29

And I found CircuitPython for older kids,

8:32

like middle school and high school students.

8:35

So it was in the days of CircuitPython 6, I think.

8:40

And it was advertised as the easiest to set up,

8:45

the bare minimum set up to do a circuit bypassing project

8:49

is you have a USB cable, connect the microcontroller

8:53

to the computer, and on the computer,

8:55

you need nothing but a code editor or just text editor

9:00

to edit the code file.

9:03

So that was amazing.

9:06

That was so mind-blowing to me.

9:08

I never imagined such a thing can be possible.

9:12

So I think this thing can be used

9:15

in our Altrage program online.

9:18

- You created the CircuitPython online IDE.

9:21

What IDE were you using that led you to create your own?

9:26

- We set a bare minimum set up

9:27

for a CircuitPython development.

9:29

It's just a text editor,

9:32

but the classroom experience can be very much improved

9:35

if we have a dedicated IDE, and what do we want from it?

9:41

So as we said, we want the experience to be consistent

9:45

across all operating systems.

9:48

And we don't want to install anything,

9:51

and we don't actually want to set up any configurations

9:56

to make a microcontroller work.

9:58

And what is that?

10:01

no installation, and same on all operating systems.

10:06

And that is a website.

10:08

So what features do we want from the IDE?

10:12

As we said, we need a text editor.

10:15

Yes, I saw a lot of websites have a text editor.

10:19

And I just happened to use a web-based serial console

10:24

back in the days in my own project.

10:26

So I know this is also possible in a website.

10:31

Not surprisingly, I was not the first person

10:34

to think about that.

10:36

So I actually found a lot of projects doing that.

10:40

But it's like not all of them are very active, developed.

10:45

And almost all of them are missing some feature I like.

10:49

Some of them works, but very, very bare minimum.

10:53

So what if I want to add some features to that?

10:56

For example, the best one doesn't have a serial plotter.

10:59

So if I want a serial plotter, do I back the author to add it?

11:06

So because I want this so much, why don't I

11:09

start in my own project?

11:11

So I call it CircuitPythonOnlineIDE.

11:16

So around this CircuitPythonOnlineIDE,

11:18

I created three courses.

11:20

So the first one was a traffic light simulator.

11:23

So the PCB board is basically a picture of a crosswalk.

11:27

and we put NeoPixels onto the PCB to mimic the traffic lights.

11:32

And students write programs to simulate the pattern.

11:36

And the second one we call the sensor interface,

11:39

which is a handheld device that has a screen and a buzzer.

11:43

Students using alligator clips to clip sensors

11:47

onto the device.

11:48

And the students write programs to show

11:51

the readings on the screen, and they

11:54

use the buzzer for alarming.

11:56

And this can be combined with a lot of science class,

12:00

like they can be used in some physics experiments.

12:04

So scientists teachers like it.

12:07

The third course I created was a RGB night light.

12:10

It is basically a Trinket M0 with a photoresistor

12:16

and with 3D print case onto that.

12:19

So it measures the ambient light

12:20

and show color patterns in the dark.

12:23

So in my days, I taught the classes via Zoom calls, so everything was remote.

12:30

It worked out very well.

12:32

And then I left the program.

12:35

My fellow teacher actually went to the schools.

12:39

And because the schools resumed, but the university lab was still closed.

12:45

So she basically went to the school classrooms and teach there.

12:50

It's just a regular classroom, regular classroom Chromebooks, but we can use the IDE, just

12:56

in regular classrooms.

12:57

So this simplifies the setup a lot.

13:00

They don't need a dedicated lab to teach these classes.

13:04

Tell me more about the CircuitPython Online IDE.

13:07

How does it work?

13:09

The most basic part is a text editor and a serial console.

13:14

So the text editor relies on a browser feature

13:18

called File System API.

13:20

So basically, your website can open a local folder

13:24

inside your computer and edit the file in it.

13:28

And Serial Console relies on a Chrome-specific feature

13:33

called the Web Serial API.

13:36

So that allows your website to directly talk to a serial port.

13:40

These are the two foundation technologies

13:44

inside the SQLpi.NET IDE.

13:47

And all the features are built based upon these two features,

13:53

such as the plotter is based on the serial connection,

13:56

and the library management is based on the file system API.

14:02

So when you use the IDE, you can go to the website,

14:06

the CircuitPi.dev and then you first connect your microcontroller to the computer by USB cable

14:13

and inside the website and you can open CircuitPi drive as a folder with one button

14:20

and connect your serial port with another button and you're all set to work on your project.

14:28

What kind of challenges did you face in developing the Online IDE?

14:32

Yeah, so actually, when I started this project, I had no experience on web development at all.

14:42

So basically, I asked my CS major friend, and it's like, "Well, do you have any resource,

14:50

do you have any class material on web development?" He just dig out one homework folder and send that

14:58

to me and I started everything from there.

15:01

It was a very bare minimum HTML page with no static refinement, but it just worked.

15:11

There was a text editor, there was serial communication, and now I call it version 0.

15:18

And I then start to add some features to this version 0, like some shortcuts that I like.

15:27

And I also added the plotter into that.

15:29

And after I add the serial plotter, everything is just so messed up because that was my first

15:36

JavaScript project.

15:38

And when I tried to add folder view and editor tabs, I just had to start over and create

15:47

a new project for it.

15:49

And that one was doing pure JavaScript.

15:53

And that one was called version one.

15:56

So when I was teaching online, I was using version 0.

16:00

And my fellow teacher, when she was

16:03

teaching the high school classrooms,

16:06

she was using version 1.

16:09

And when I just tried to fix some bugs in the folder view,

16:13

I found this code is too messy again.

16:16

And when people see if you are not

16:18

using a front-end framework, you're

16:20

basically writing your own framework.

16:22

So definitely, my framework was not very well.

16:26

So I adopted the most popular one, React at the moment.

16:31

So I basically refactored everything and rewrote the online IDE again in React.

16:39

Because that was still my first React project, and the first trial was still very, very messed

16:47

up.

16:48

That was version 2 beta until, and when I tried to release the version 2 official without

16:55

beta that was refactored again.

16:58

So it's like major refactoring all the time.

17:02

What was the biggest challenge is that everything was developed while learning.

17:09

It's like, but, and also proved that if one wants to make some contribution,

17:15

doesn't have to be an expert.

17:17

So you can start from zero experience.

17:20

One of the things I like about the CircuitPython online IDE that you've

17:23

created is that you can host your own version, which can probably help in a

17:27

locked down IT environment like a school.

17:30

Yeah.

17:31

How hard is it to self-host?

17:33

So first the SQLPython online IDE is an open source project.

17:39

So the source code is hosted on GitHub and actually the IDE itself is a static

17:45

page that is hosted on GitHub page.

17:49

So the only feature that requires a backend service over the internet is the library management service.

17:56

A proxy service is used to download the Adafruit bundle and the community bundle to the IDE.

18:04

And that proxy service is hosted on Google Cloud.

18:07

So if you want to host your own version, you can just fork my GitHub repo and make modifications if you want,

18:17

and create a GitHub page out of that repo.

18:21

So if you want to host a proxy yourself, you can check the source code in the repo and

18:27

create a Google Cloud Run function out of that source code.

18:31

So that's everything you need to host your own version.

18:35

But in addition to that, if the only thing you need is just to run the IDE, but you cannot

18:41

access my deployed version.

18:44

Actually, I know many school districts

18:47

have very, very strict firewalls

18:49

so that my version is often blocked.

18:52

In that case, you can go to my GitHub repo

18:55

and go to the release section.

18:58

And there you can download the latest version

19:01

of the online IDE as a single HTML file.

19:06

And you can run that HTML file locally offline.

19:10

How does it help educators?

19:13

Because the idea was created inside the classroom.

19:17

It was created to solve classroom problems.

19:20

And this has never changed.

19:22

It's my always how education in the first place.

19:26

So some design principles.

19:28

Captive from the beginning.

19:31

So if you open the website, it's a good pilot dab.

19:35

It will show what the students need to finish their first class project.

19:40

and nothing more and nothing less.

19:44

So all the advanced features are hidden

19:46

in the manuals and shortcuts.

19:48

And I also try to reduce confusion in the UI

19:52

as much as possible, such as I don't often use icons.

19:57

Everything is just written out as plain text.

20:00

Because I use the IDE myself, if that is useful to me,

20:06

it can also be useful to others.

20:07

So, well, I think everyone working on a DIY project can benefit from this.

20:15

And I also remember many of my students who expressed their interest in microcontrollers even after the course.

20:24

So I also want to support the students and continue to work on their projects even after the camps or the field trips.

20:34

You've mentioned some of the features of the IDE.

20:36

Can you share some of the useful ones?

20:39

So in the IDE, in the menu bar, there is a button called Tools.

20:43

Click on that.

20:44

It will show you some useful features.

20:47

And serial plotter is going to be the most used feature.

20:50

And you can plot, zoom, truncate in time,

20:55

and add legends to it, and also use one of the column

20:58

as x-axis.

21:00

So this is a very powerful plotting tool.

21:05

The plotter is actually compatible with Moo Editor.

21:09

So if you have a plot code that is already working with Moo,

21:13

it should also work here.

21:16

And another feature I recently added to it

21:18

is library management.

21:20

So if you used the CircCraft before or heard about it,

21:25

it's basically similar but with GUI.

21:28

So there are two ways you can use it.

21:31

So first, if you use the auto installation,

21:35

it will analyze your CircuitPython code

21:37

and install all the libraries needed,

21:39

and also with dependencies.

21:41

And that is from the Adafruit bundle

21:44

and the community bundle.

21:46

So there is also a list of all libraries

21:49

from both of the bundle.

21:51

You can search libraries from this list

21:55

and install, uninstall, or upgrade on demand.

21:59

And also there is a button in the UI

22:02

that links to the library repo

22:04

so that you can read more documents

22:06

and source code or example.

22:08

And the third feature that I want to share

22:12

is the camera feature, the camera tool.

22:15

This one has nothing to do with the microcontroller itself,

22:19

but whenever I want to show people something,

22:22

I just found myself need to open a separated app for camera.

22:28

Because microcontroller projects are not just a code.

22:31

You want to photo your dev board breadboard.

22:36

And that's why you need a camera.

22:40

So in the camera tool, you can point your webcam

22:44

to the microcontroller and view it just inside IDE.

22:49

and you can flip, rotate, zoom, everything you want to do.

22:54

This can be very helpful for teachers

22:57

and you can show whatever is on your desk

23:01

on the large projector in the classroom.

23:04

And also if you're a hobbyist that want to stream

23:08

or record your project, this can be also very helpful.

23:12

- That's pretty cool.

23:13

What's next for the CircuitPython online IDE?

23:17

Yeah, so if you go to the repo and go to the issues section,

23:23

there are a lot of feature plans and enhancements plan.

23:28

So there are two features I am actively working on

23:32

at the moment.

23:33

One is called connected variables.

23:36

So if you want to talk to a running program,

23:41

usually we just use a serial console,

23:45

But text flow is not the most intuitive.

23:48

Even if you can use the plotter, sometimes it's still not

23:52

the best way to show what is going on in the program.

23:57

So I want to provide a bunch of wedges that can directly talk

24:01

into variables inside the program,

24:04

such as buttons, selections, meters, and color pickers,

24:08

et cetera, so that you can talk to a running

24:12

program both ways.

24:14

Another feature is debugger.

24:18

So as far as I know, MicroPython and CirclePython

24:22

doesn't have PDB, which is the default Python debugger.

24:28

So I am working on some kind of workaround solutions

24:32

to provide step-by-step debugging, breakpoints,

24:36

and expression wash.

24:40

How can people support your project?

24:43

If you want to support a project, just please use it as much as possible and share it with

24:49

others, share it with other teachers specifically, and give me some feedback and tell me how

24:57

you are using the IDE, what is your story, or if you have bug reports, feature requests,

25:04

please let me know.

25:05

So, if anyone wants to learn more about it, where should they go?

25:08

I have a YouTube channel called CircuitPythonic,

25:11

and I also post on Twitter and FosterDom.

25:15

I really post IDE updates and my personal microcontroller

25:19

projects.

25:20

I'll make sure I link to those in the show notes as well.

25:23

Last question I ask each guest.

25:25

You're starting a new project or prototype.

25:28

Which board do you reach for?

25:30

So I don't have a specific chip set to go to,

25:35

But I do have a go-to form factor, which is the Cedarino shell or Adafruit Qt Pie.

25:43

One of the reasons is I still don't know how to do reflow.

25:47

So usually I just solder the whole data board onto the PCB.

25:51

So the smaller the data board is, the better.

25:55

And another reason is I have a very, very long commute every day.

25:59

So I often work on my personal projects on the train.

26:03

So I wish the data board can be as small as possible.

26:06

At this moment, my setup is a Cedrino Celsin 52840,

26:13

and I use a mil-to-mil adapter, not a cable, just an adapter,

26:18

to plug into my laptop, just like a USB dongle.

26:22

But you know what can be better?

26:24

A type-C chain key, which doesn't exist yet.

26:28

I will surely carry one with me all the time.

26:31

So, Elafrod, if you are listening to this, please make it happen.

26:35

River, thanks so much for coming on the show.

26:38

Thank you. It's great to be on the show.

26:41

Thank you for listening to The CircuitPython Show. The show notes have links to the CircuitPython

26:46

online IDE available at circuitpy.dev, and I encourage you to try it out. For show notes

26:52

and transcripts, visit www.circuitpythonshow.com. And if you're enjoying the show, consider sponsoring

26:59

the show to help offset the costs of podcast hosting, recording, and more. Visit the sponsors

27:04

page at CircuitPythonShow.com to learn more. Thank you for your support, and until next time,

27:09

stay positive!

27:11

you